summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.eslintrc28
-rw-r--r--.jshintrc63
-rw-r--r--Gruntfile.js68
-rw-r--r--HISTORY.md1
-rw-r--r--bower.json6
-rw-r--r--jquery.once.js14
-rw-r--r--package.json6
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']);
};
diff --git a/HISTORY.md b/HISTORY.md
index ea0c861..d29067b 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -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
diff --git a/bower.json b/bower.json
index 3c78c6a..65a95de 100644
--- a/bower.json
+++ b/bower.json
@@ -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