diff options
author | Rob Loach <robloach@gmail.com> | 2014-10-08 20:51:04 -0400 |
---|---|---|
committer | Rob Loach <robloach@gmail.com> | 2014-10-08 20:51:04 -0400 |
commit | 1317ef15e336fcf0fa5885529f5696292cd8fa29 (patch) | |
tree | b2b1ee1eddef334a529d21ac4d62e98e6cf2cfc0 | |
parent | 2f92d9eace2ca4fb9d49b8e91e3ec56cd1d7c259 (diff) | |
download | jquery-once-1317ef15e336fcf0fa5885529f5696292cd8fa29.zip jquery-once-1317ef15e336fcf0fa5885529f5696292cd8fa29.tar.gz jquery-once-1317ef15e336fcf0fa5885529f5696292cd8fa29.tar.bz2 |
Switch from JSHint to ESLint
-rw-r--r-- | .eslintrc | 28 | ||||
-rw-r--r-- | .jshintrc | 63 | ||||
-rw-r--r-- | Gruntfile.js | 68 | ||||
-rw-r--r-- | HISTORY.md | 1 | ||||
-rw-r--r-- | bower.json | 6 | ||||
-rw-r--r-- | jquery.once.js | 14 | ||||
-rw-r--r-- | package.json | 6 |
7 files changed, 53 insertions, 133 deletions
diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..1eb4479 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,28 @@ +{ + "env": { + "browser": true, + "node": true, + "amd": true + }, + "globals": { + "jQuery": true + }, + "rules": { + "eqeqeq": [2, "smart"], + "guard-for-in": 2, + "no-mixed-spaces-and-tabs": 2, + "no-trailing-spaces": 2, + "no-undef": 2, + "no-unused-vars": [2, {"vars": "local", "args": "none"}], + "strict": 2, + "new-cap": 2, + "quotes": 2, + "camelcase": 2, + "no-underscore-dangle": 2, + "no-new": 2, + "no-alert": 2, + "no-use-before-define": 2, + "consistent-return": 2, + "no-constant-condition": 2 + } +} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 643c399..0000000 --- a/.jshintrc +++ /dev/null @@ -1,63 +0,0 @@ -{ - // enforcing options - "bitwise": true, - "camelcase": true, - "curly": false, // we like one liners - "eqeqeq": true, - "es3": true, - "forin": true, - "freeze": true, - "immed": true, - "indent": 1, // we use tabs - "latedef": true, - "newcap": true, - "noarg": true, - "noempty": true, - "nonbsp": true, - "nonew": true, - "plusplus": false, // we are good at js - "quotmark": false, // we like flexibility - "undef": true, - "unused": true, - "strict": true, - "trailing": true, - "maxparams": false, // no - "maxdepth": false, // no - "maxstatements": false, // no - "maxcomplexity": false, // no - "maxlen": false, // no - - // relaxing options - "asi": true, // we use asi - "boss": true, // we understand assignments - "debug": false, - "eqnull": true, // we know how to do null/undefined checks - "esnext": false, - "evil": false, - "expr": false, - "funcscope": false, - "gcl": true, - "globalstrict": false, - "iterator": false, - "lastsemic": false, - "laxbreak": false, - "laxcomma": false, - "loopfunc": false, - "moz": false, - "multistr": false, - "notypeof": false, - "proto": false, - "scripturl": false, - "smarttabs": false, // default; spaces should only be mixed with tabs after words - "shadow": false, - "sub": false, - "supernew": false, - "noyield": false, - - // environments - "browser": true, - "node": true, - - // legacy - "onevar": false -} diff --git a/Gruntfile.js b/Gruntfile.js index 740293f..3c7201b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,6 @@ /*jshint node:true*/ module.exports = function(grunt) { - "use strict"; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), uglify: { @@ -15,74 +14,29 @@ module.exports = function(grunt) { }, all: { files: { - 'jquery.once.min.js': ['jquery.once.js'] + 'jquery.once.min.js': [ + 'jquery.once.js' + ] } } }, qunit: { - files: ['test/index.html'] - }, - jshint: { - options: { - curly: true, - eqeqeq: true, - immed: true, - latedef: true, - newcap: true, - noarg: true, - sub: true, - undef: true, - eqnull: true, - browser: true, - globals: { - jQuery: true, - $: true, - console: true, - require: true, - define: true - } - }, files: [ + 'test/index.html' + ] + }, + eslint: { + target: [ 'jquery.once.js' - ], - test: { - options: { - globals: { - jQuery: true, - $: true, - QUnit: true, - module: true, - test: true, - start: true, - stop: true, - expect: true, - ok: true, - equal: true, - deepEqual: true, - strictEqual: true - } - }, - files: { - src: [ - 'test/test.js' - ] - } - }, - grunt: { - files: { - src: [ - 'Gruntfile.js' - ] - } - } + ] } }); - grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-eslint'); - grunt.registerTask('default', ['jshint', 'qunit']); + grunt.registerTask('default', ['eslint', 'qunit']); grunt.registerTask('release', ['default', 'uglify']); }; @@ -3,6 +3,7 @@ ## v2.0.0-alpha.8 October 9, 2014 - Update documentation - Fix whitespace +- Switch from JSHint to ESLint ## v2.0.0-alpha.7 October 8, 2014 - Removed unneeded cache variable @@ -1,7 +1,7 @@ { "name": "jquery-once", "homepage": "http://github.com/robloach/jquery-once", - "description": "jQuery Once Plugin", + "description": "jQuery Once", "version": "2.0.0-alpha.8", "main": "jquery.once.js", "ignore": [ @@ -20,9 +20,9 @@ }, "devDependencies": { "grunt": "~0.4.5", - "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-qunit": "~0.5.2", "grunt-contrib-uglify": "~0.6.0", + "grunt-eslint": "~1.1.0", "projectz": "~0.3.15" } -}
\ No newline at end of file +} diff --git a/jquery.once.js b/jquery.once.js index d331e44..0b2bbb0 100644 --- a/jquery.once.js +++ b/jquery.once.js @@ -18,12 +18,12 @@ */ (function (factory) { "use strict"; - if (typeof exports === 'object') { + if (typeof exports === "object") { // CommonJS - factory(require('jquery')); - } else if (typeof define === 'function' && define.amd) { + factory(require("jquery")); + } else if (typeof define === "function" && define.amd) { // AMD - define(['jquery'], factory); + define(["jquery"], factory); } else { // Global object factory(jQuery); @@ -60,7 +60,7 @@ $.fn.once = function (id) { // Build the name for the data identifier. Generate a new unique id if the // id parameter is not provided. - var name = 'jquery-once-' + (id || ++uuid); + var name = "jquery-once-" + (id || ++uuid); // Filter the elements by which do not have the data yet. return this.filter(function() { @@ -94,7 +94,7 @@ */ $.fn.removeOnce = function (id) { // Filter through the elements to find the once'd elements. - return this.findOnce(id).removeData('jquery-once-' + id); + return this.findOnce(id).removeData("jquery-once-" + id); }; /** @@ -122,7 +122,7 @@ */ $.fn.findOnce = function (id) { // Filter the elements by which do have the data. - var name = 'jquery-once-' + id; + var name = "jquery-once-" + id; return this.filter(function() { return $(this).data(name) === true; diff --git a/package.json b/package.json index ae3dad0..1dcf8a4 100644 --- a/package.json +++ b/package.json @@ -50,15 +50,15 @@ }, "devDependencies": { "grunt": "~0.4.5", - "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-qunit": "~0.5.2", "grunt-contrib-uglify": "~0.6.0", + "grunt-eslint": "~1.1.0", "projectz": "~0.3.15" }, "scripts": { - "test": "grunt jshint qunit", + "test": "grunt", "projectz": "node_modules/.bin/projectz compile", "release": "grunt release", "jsdoc": "jsdoc jquery.once.js README.md" } -} +}
\ No newline at end of file |