aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2016-05-10 12:06:37 +0300
committerOleg Gaidarenko <markelog@gmail.com>2016-06-11 10:39:51 +0300
commitf80ae67c53c0a4bfc95741ed39d7f9e498eaf02b (patch)
tree0499a584312648dabec36e3803b0ed5354146def
parent019c8f1f41de8696b2b90c43648fe339efdb6a02 (diff)
downloadjquery-f80ae67c53c0a4bfc95741ed39d7f9e498eaf02b.tar.gz
jquery-f80ae67c53c0a4bfc95741ed39d7f9e498eaf02b.zip
Build: Switch from jscs+jshint to eslint
-rw-r--r--.eslintignore12
-rw-r--r--.eslintrc145
-rw-r--r--.jscsrc10
-rw-r--r--.jshintrc14
-rw-r--r--.npmignore4
-rw-r--r--Gruntfile.js49
-rw-r--r--build/.eslintrc7
-rw-r--r--package.json3
-rw-r--r--src/.eslintrc15
-rw-r--r--src/.jshintrc30
-rw-r--r--test/.eslintrc55
-rw-r--r--test/.jshintrc56
-rw-r--r--test/node_smoke_tests/.eslintrc7
-rw-r--r--test/node_smoke_tests/.jshintrc14
14 files changed, 261 insertions, 160 deletions
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 000000000..adfbe3f4b
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,12 @@
+external
+test/data/jquery-1.9.1.js
+test/data/badcall.js
+test/data/badjson.js
+test/data/json_obj.js
+test/data/readywaitasset.js
+test/data/readywaitloader.js
+test/data/support/csp.js
+test/data/support/getComputedSupport.js
+test/node_smoke_tests/lib/ensure_iterability.js
+node_modules
+dist
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 000000000..4bb05b235
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,145 @@
+{
+ "env": {},
+ "globals": {},
+ "rules": {
+ "no-cond-assign": [
+ "error",
+ "except-parens"
+ ],
+ "curly": [
+ "error",
+ "all"
+ ],
+ "object-curly-spacing": [
+ "error",
+ "always"
+ ],
+ "computed-property-spacing": [
+ "error",
+ "always"
+ ],
+ "array-bracket-spacing": [
+ "error",
+ "always"
+ ],
+ "eqeqeq": [
+ "error",
+ "smart"
+ ],
+
+ // Shows errors where jshint wouldn't (see jshint "expr" rule)
+ // clarifing this with eslint team
+ // "no-unused-expressions": "error",
+ "wrap-iife": [
+ "error",
+ "inside"
+ ],
+ "no-caller": "error",
+ "quotes": [
+ "error",
+ "double",
+ "avoid-escape"
+ ],
+ "no-undef": "error",
+ "no-unused-vars": "error",
+ "operator-linebreak": [
+ "error",
+ "after"
+ ],
+ "comma-style": [
+ "error",
+ "last"
+ ],
+ "camelcase": [
+ "error",
+ {
+ "properties": "never"
+ }
+ ],
+ "dot-notation": [
+ "error",
+ {
+ "allowPattern": "^[a-z]+(_[a-z]+)+$"
+ }
+ ],
+ "max-len": [
+ "error",
+ {
+ "code": 100,
+ "ignoreComments": true
+ }
+ ],
+ "no-mixed-spaces-and-tabs": "error",
+ "no-trailing-spaces": "error",
+ "no-multi-str": "error",
+ "comma-dangle": [
+ "error",
+ "never"
+ ],
+ "comma-spacing": [
+ "error",
+ {
+ "before": false,
+ "after": true
+ }
+ ],
+ "space-before-blocks": [
+ "error",
+ "always"
+ ],
+ "space-in-parens": [
+ "error",
+ "always"
+ ],
+ "keyword-spacing": [
+ 2
+ ],
+ "semi": [
+ "error",
+ "always"
+ ],
+ "semi-spacing": [
+ "error",
+ {
+ // Because of the `for ( ; ...)` requirement
+ // "before": true,
+ "after": true
+ }
+ ],
+ "space-infix-ops": "error",
+ "eol-last": "error",
+ "lines-around-comment": [
+ "error",
+ {
+ "beforeLineComment": true
+ }
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "no-with": "error",
+ "brace-style": "error",
+ "space-before-function-paren": [
+ "error",
+ "never"
+ ],
+ "no-loop-func": "error",
+ "no-spaced-func": "error",
+ "key-spacing": [
+ "error",
+ {
+ "beforeColon": false,
+ "afterColon": true
+ }
+ ],
+ "space-unary-ops": [
+ "error",
+ {
+ "words": false,
+ "nonwords": false
+ }
+ ],
+ "no-multiple-empty-lines": 2
+ }
+}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index c6dc9ee69..000000000
--- a/.jscsrc
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "preset": "jquery",
-
- // remove after https://github.com/jscs-dev/node-jscs/issues/1685
- // and https://github.com/jscs-dev/node-jscs/issues/1686
- "requireCapitalizedComments": null,
-
- "excludeFiles": [ "external",
- "test/node_smoke_tests/lib/ensure_iterability.js", "node_modules" ]
-}
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 1445c7b18..000000000
--- a/.jshintrc
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "boss": true,
- "curly": true,
- "eqeqeq": true,
- "eqnull": true,
- "expr": true,
- "immed": true,
- "noarg": true,
- "quotmark": "double",
- "undef": true,
- "unused": true,
-
- "node": true
-}
diff --git a/.npmignore b/.npmignore
index d51094952..322f560b7 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,5 +1,5 @@
-.jshintignore
-.jshintrc
+.eslintignore
+.eslintrc
/.editorconfig
/.gitattributes
diff --git a/Gruntfile.js b/Gruntfile.js
index 3e81b6161..5f101050a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -14,7 +14,6 @@ module.exports = function( grunt ) {
var fs = require( "fs" ),
gzip = require( "gzip-js" ),
- srcHintOptions = readOptionalJSON( "src/.jshintrc" ),
// Skip jsdom-related tests in Node.js 0.10 & 0.12
runJsdomTests = !/^v0/.test( process.version );
@@ -103,34 +102,14 @@ module.exports = function( grunt ) {
src: [ "package.json" ]
}
},
- jshint: {
- all: {
- src: [
- "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
- ],
- options: {
- jshintrc: true
- }
+ eslint: {
+ options: {
+
+ // See https://github.com/sindresorhus/grunt-eslint/issues/119
+ quiet: true
},
- dist: {
- src: "dist/jquery.js",
- options: srcHintOptions
- }
- },
- jscs: {
- src: "src",
- gruntfile: "Gruntfile.js",
-
- // Check parts of tests that pass
- test: [
- "test/data/testrunner.js",
- "test/unit/animation.js",
- "test/unit/basic.js",
- "test/unit/support.js",
- "test/unit/tween.js",
- "test/unit/wrap.js"
- ],
- build: "build"
+ all: ".",
+ dev: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
},
testswarm: {
tests: [
@@ -164,7 +143,7 @@ module.exports = function( grunt ) {
]
},
watch: {
- files: [ "<%= jshint.all.src %>" ],
+ files: [ "<%= eslint.dev %>" ],
tasks: [ "dev" ]
},
uglify: {
@@ -201,7 +180,7 @@ module.exports = function( grunt ) {
// Integrate jQuery specific tasks
grunt.loadTasks( "build/tasks" );
- grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );
+ grunt.registerTask( "lint", [ "jsonlint" ] );
// Don't run Node-related tests in Node.js < 1.0.0 as they require an old
// jsdom version that needs compiling, making it harder for people to compile
@@ -213,9 +192,15 @@ module.exports = function( grunt ) {
) );
// Short list as a high frequency watch task
- grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
+ grunt.registerTask( "dev", [
+ "build:*:*",
+ "uglify",
+ "remove_map_comment",
+ "dist:*"
+ ]
+ );
grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );
- grunt.registerTask( "precommit_lint", [ "newer:jsonlint", "newer:jshint:all", "newer:jscs" ] );
+ grunt.registerTask( "precommit_lint", [ "newer:jsonlint" ] );
};
diff --git a/build/.eslintrc b/build/.eslintrc
new file mode 100644
index 000000000..11368d984
--- /dev/null
+++ b/build/.eslintrc
@@ -0,0 +1,7 @@
+{
+ "env": {
+ "node": true
+ },
+ "extends": "../.eslintrc",
+ "root": true
+}
diff --git a/package.json b/package.json
index c6ae7165d..00b7d2e65 100644
--- a/package.json
+++ b/package.json
@@ -33,11 +33,10 @@
"grunt-babel": "6.0.0",
"grunt-cli": "1.2.0",
"grunt-compare-size": "0.4.2",
- "grunt-contrib-jshint": "1.0.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
+ "grunt-eslint": "18.1.0",
"grunt-git-authors": "3.2.0",
- "grunt-jscs": "2.8.0",
"grunt-jsonlint": "1.0.7",
"grunt-newer": "1.2.0",
"grunt-npmcopy": "0.1.0",
diff --git a/src/.eslintrc b/src/.eslintrc
new file mode 100644
index 000000000..ef090331f
--- /dev/null
+++ b/src/.eslintrc
@@ -0,0 +1,15 @@
+{
+ "env": {
+ "browser"
+ },
+ "extends": "../.eslintrc",
+ "root": true,
+ "globals": {
+ "window": true,
+ "JSON": false,
+ "jQuery": true,
+ "define": true,
+ "module": true,
+ "noGlobal": true
+ }
+}
diff --git a/src/.jshintrc b/src/.jshintrc
deleted file mode 100644
index c3506e70f..000000000
--- a/src/.jshintrc
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "boss": true,
- "curly": true,
- "eqeqeq": true,
- "eqnull": true,
- "expr": true,
- "immed": true,
- "noarg": true,
- "quotmark": "double",
- "strict": true,
- "undef": true,
- "unused": true,
-
- "sub": true,
-
- // Support: IE <=9 only, Android <=4.0 only
- // The above browsers are failing a lot of tests in the ES5
- // test suite at http://test262.ecmascript.org.
- "es3": true,
-
- "globals": {
- "window": true,
- "JSON": false,
-
- "jQuery": true,
- "define": true,
- "module": true,
- "noGlobal": true
- }
-}
diff --git a/test/.eslintrc b/test/.eslintrc
new file mode 100644
index 000000000..439a07a6c
--- /dev/null
+++ b/test/.eslintrc
@@ -0,0 +1,55 @@
+{
+ "env": {
+ "browser": true
+ },
+ "extends": "../.eslintrc",
+ "root": true,
+ "globals": {
+ "require": false,
+ "define": false,
+ "DOMParser": false,
+ "JSON": false,
+ "Promise": false,
+ "Symbol": false,
+ "QUnit": false,
+ "ajaxTest": false,
+ "testIframe": false,
+ "testIframeWithCallback": false,
+ "iframeCallback": true,
+ "createDashboardXML": false,
+ "createXMLFragment": false,
+ "moduleTeardown": false,
+ "testFoo": false,
+ "url": false,
+ "t": false,
+ "q": false,
+ "jQuery": true,
+ "sinon": true,
+ "amdDefined": true,
+ "fireNative": true,
+ "Globals": true,
+ "hasPHP": true,
+ "isLocal": true,
+ "supportjQuery": true,
+ "originaljQuery": true,
+ "$": true,
+ "original$": true,
+ "baseURL": true,
+ "externalHost": true
+ },
+ "rules": {
+ // See https://github.com/eslint/eslint/issues/6125
+ "no-unused-vars": "off",
+
+ // Too much errors
+ "max-len": "off",
+ "brace-style": "off",
+ "key-spacing": "off",
+ "camelcase": "off",
+ "dot-notaion": "off",
+
+ // Not a lot really too much, but waiting for autofix for these rules
+ "lines-around-comment": "off",
+ "dot-notation": "off"
+ }
+}
diff --git a/test/.jshintrc b/test/.jshintrc
deleted file mode 100644
index 5516f8404..000000000
--- a/test/.jshintrc
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "boss": true,
- "curly": true,
- "eqeqeq": true,
- "eqnull": true,
- "expr": true,
- "immed": true,
- "noarg": true,
- "quotmark": "double",
- "undef": true,
- "unused": true,
-
- "es3": true,
-
- "evil": true,
- "sub": true,
-
- "browser": true,
- "devel": true,
- "wsh": true,
-
- "globals": {
- "require": false,
- "define": false,
- "DOMParser": false,
- "JSON": false,
- "Promise": false,
- "Symbol": false,
- "QUnit": false,
- "ajaxTest": false,
- "testIframe": false,
- "testIframeWithCallback": false,
- "iframeCallback": true,
- "createDashboardXML": false,
- "createXMLFragment": false,
- "moduleTeardown": false,
- "testFoo": false,
- "url": false,
- "t": false,
- "q": false,
-
- "jQuery": true,
- "sinon": true,
- "amdDefined": true,
- "fireNative": true,
- "Globals": true,
- "hasPHP": true,
- "isLocal": true,
- "supportjQuery": true,
- "originaljQuery": true,
- "$": true,
- "original$": true,
- "baseURL": true,
- "externalHost": true
- }
-}
diff --git a/test/node_smoke_tests/.eslintrc b/test/node_smoke_tests/.eslintrc
new file mode 100644
index 000000000..11368d984
--- /dev/null
+++ b/test/node_smoke_tests/.eslintrc
@@ -0,0 +1,7 @@
+{
+ "env": {
+ "node": true
+ },
+ "extends": "../.eslintrc",
+ "root": true
+}
diff --git a/test/node_smoke_tests/.jshintrc b/test/node_smoke_tests/.jshintrc
deleted file mode 100644
index 1445c7b18..000000000
--- a/test/node_smoke_tests/.jshintrc
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "boss": true,
- "curly": true,
- "eqeqeq": true,
- "eqnull": true,
- "expr": true,
- "immed": true,
- "noarg": true,
- "quotmark": "double",
- "undef": true,
- "unused": true,
-
- "node": true
-}