Skip to content

Commit

Permalink
added jshint and strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Berkan Dirim authored and Berkan Dirim committed Feb 2, 2017
1 parent b487358 commit 98ff9d9
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 73 deletions.
9 changes: 5 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = function(grunt) {
// Project configuration

grunt.initConfig({
sass: {
Expand Down Expand Up @@ -29,15 +28,17 @@ module.exports = function(grunt) {
},
js: {
files: 'lib/*.js',
tasks: ['uglify', 'copy']
tasks: ['uglify', 'copy', 'jshint']
}
},
jshint: {
all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js']
},
uglify: {
target: {
files: {
'dist/jquery.listswap.min.js': ['lib/jquery.listswap.js']
}

},
options: {
sourceMap: true
Expand Down Expand Up @@ -74,6 +75,6 @@ module.exports = function(grunt) {
require('load-grunt-tasks')(grunt, {pattern: ['grunt-*', '@*/grunt-*']});

// Default task(s).
grunt.registerTask('default', ['sass', 'uglify', 'browserSync', 'watch']);
grunt.registerTask('default', ['sass', 'uglify', 'jshint', 'browserSync', 'watch']);
grunt.registerTask('build', ['sass', 'uglify', 'copy']);
};
49 changes: 26 additions & 23 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"name": "jquery.listswap",
"version": "0.1.1",
"description": "ListSwap is a jQuery plugin that allows you to swap (add/remove) items between two drop-down lists.",
"main": "",
"authors": [
"Berkan Dirim <berkandirim@gmail.com> (http://dirim.co/)"
],
"license": "MIT",
"keywords": [
"jquery",
"plugin",
"select",
"lists",
"swap"
],
"homepage": "http://dirim.co/jquery-listswap",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
"name": "jquery.listswap",
"version": "0.1.1",
"description": "ListSwap is a jQuery plugin that allows you to swap (add/remove) items between two drop-down lists.",
"main": "",
"authors": [
"Berkan Dirim <berkandirim@gmail.com> (http://dirim.co/)"
],
"license": "MIT",
"keywords": [
"jquery",
"plugin",
"select",
"lists",
"swap"
],
"homepage": "http://dirim.co/jquery-listswap",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "2.2.4"
}
}
6 changes: 2 additions & 4 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
font: 14px/1.5 sans-serif;
}
</style>
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
</head>
<body>

Expand Down Expand Up @@ -40,10 +41,7 @@

</form>

<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<script src="../dist/jquery.listswap.min.js"></script>
<script>
$('#source, #destination').listSwap({
Expand Down
9 changes: 5 additions & 4 deletions dist/jquery.listswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* Licensed under the MIT license
*/

;
(function($, window, document, undefined) {
;(function($, window, document, undefined) {

'use strict';

var pluginName = "listSwap",
defaults = {
Expand Down Expand Up @@ -67,7 +68,7 @@
this.setLayout(this.element, source, destination, this.options);
this.bindUIActions(this.element, source, destination, wrap);

instance++
instance++;
},

setLayout: function(el, src, dest, options) {
Expand Down Expand Up @@ -152,7 +153,7 @@
var val = $(this).val().toString().toLowerCase();
$(selector + ' > li').each(function() {
var text = $(this).text().toString().toLowerCase();
(text.indexOf(val) != -1) ? $(this).show() : $(this).hide();
if (text.indexOf(val) != -1) $(this).show(); else $(this).hide();
});
});
_this.clearButton(selector);
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.listswap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquery.listswap.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions lib/jquery.listswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* Licensed under the MIT license
*/

;
(function($, window, document, undefined) {
;(function($, window, document, undefined) {

'use strict';

var pluginName = "listSwap",
defaults = {
Expand Down Expand Up @@ -67,7 +68,7 @@
this.setLayout(this.element, source, destination, this.options);
this.bindUIActions(this.element, source, destination, wrap);

instance++
instance++;
},

setLayout: function(el, src, dest, options) {
Expand Down Expand Up @@ -152,7 +153,7 @@
var val = $(this).val().toString().toLowerCase();
$(selector + ' > li').each(function() {
var text = $(this).text().toString().toLowerCase();
(text.indexOf(val) != -1) ? $(this).show() : $(this).hide();
if (text.indexOf(val) != -1) $(this).show(); else $(this).hide();
});
});
_this.clearButton(selector);
Expand Down

0 comments on commit 98ff9d9

Please sign in to comment.