Skip to content

Commit f80ae67

Browse files
committed
Build: Switch from jscs+jshint to eslint
1 parent 019c8f1 commit f80ae67

File tree

14 files changed

+261
-160
lines changed

14 files changed

+261
-160
lines changed

.eslintignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
external
2+
test/data/jquery-1.9.1.js
3+
test/data/badcall.js
4+
test/data/badjson.js
5+
test/data/json_obj.js
6+
test/data/readywaitasset.js
7+
test/data/readywaitloader.js
8+
test/data/support/csp.js
9+
test/data/support/getComputedSupport.js
10+
test/node_smoke_tests/lib/ensure_iterability.js
11+
node_modules
12+
dist

.eslintrc

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"env": {},
3+
"globals": {},
4+
"rules": {
5+
"no-cond-assign": [
6+
"error",
7+
"except-parens"
8+
],
9+
"curly": [
10+
"error",
11+
"all"
12+
],
13+
"object-curly-spacing": [
14+
"error",
15+
"always"
16+
],
17+
"computed-property-spacing": [
18+
"error",
19+
"always"
20+
],
21+
"array-bracket-spacing": [
22+
"error",
23+
"always"
24+
],
25+
"eqeqeq": [
26+
"error",
27+
"smart"
28+
],
29+
30+
// Shows errors where jshint wouldn't (see jshint "expr" rule)
31+
// clarifing this with eslint team
32+
// "no-unused-expressions": "error",
33+
"wrap-iife": [
34+
"error",
35+
"inside"
36+
],
37+
"no-caller": "error",
38+
"quotes": [
39+
"error",
40+
"double",
41+
"avoid-escape"
42+
],
43+
"no-undef": "error",
44+
"no-unused-vars": "error",
45+
"operator-linebreak": [
46+
"error",
47+
"after"
48+
],
49+
"comma-style": [
50+
"error",
51+
"last"
52+
],
53+
"camelcase": [
54+
"error",
55+
{
56+
"properties": "never"
57+
}
58+
],
59+
"dot-notation": [
60+
"error",
61+
{
62+
"allowPattern": "^[a-z]+(_[a-z]+)+$"
63+
}
64+
],
65+
"max-len": [
66+
"error",
67+
{
68+
"code": 100,
69+
"ignoreComments": true
70+
}
71+
],
72+
"no-mixed-spaces-and-tabs": "error",
73+
"no-trailing-spaces": "error",
74+
"no-multi-str": "error",
75+
"comma-dangle": [
76+
"error",
77+
"never"
78+
],
79+
"comma-spacing": [
80+
"error",
81+
{
82+
"before": false,
83+
"after": true
84+
}
85+
],
86+
"space-before-blocks": [
87+
"error",
88+
"always"
89+
],
90+
"space-in-parens": [
91+
"error",
92+
"always"
93+
],
94+
"keyword-spacing": [
95+
2
96+
],
97+
"semi": [
98+
"error",
99+
"always"
100+
],
101+
"semi-spacing": [
102+
"error",
103+
{
104+
// Because of the `for ( ; ...)` requirement
105+
// "before": true,
106+
"after": true
107+
}
108+
],
109+
"space-infix-ops": "error",
110+
"eol-last": "error",
111+
"lines-around-comment": [
112+
"error",
113+
{
114+
"beforeLineComment": true
115+
}
116+
],
117+
"linebreak-style": [
118+
"error",
119+
"unix"
120+
],
121+
"no-with": "error",
122+
"brace-style": "error",
123+
"space-before-function-paren": [
124+
"error",
125+
"never"
126+
],
127+
"no-loop-func": "error",
128+
"no-spaced-func": "error",
129+
"key-spacing": [
130+
"error",
131+
{
132+
"beforeColon": false,
133+
"afterColon": true
134+
}
135+
],
136+
"space-unary-ops": [
137+
"error",
138+
{
139+
"words": false,
140+
"nonwords": false
141+
}
142+
],
143+
"no-multiple-empty-lines": 2
144+
}
145+
}

.jscsrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

.jshintrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.npmignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.jshintignore
2-
.jshintrc
1+
.eslintignore
2+
.eslintrc
33

44
/.editorconfig
55
/.gitattributes

Gruntfile.js

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ module.exports = function( grunt ) {
1414

1515
var fs = require( "fs" ),
1616
gzip = require( "gzip-js" ),
17-
srcHintOptions = readOptionalJSON( "src/.jshintrc" ),
1817

1918
// Skip jsdom-related tests in Node.js 0.10 & 0.12
2019
runJsdomTests = !/^v0/.test( process.version );
@@ -103,34 +102,14 @@ module.exports = function( grunt ) {
103102
src: [ "package.json" ]
104103
}
105104
},
106-
jshint: {
107-
all: {
108-
src: [
109-
"src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
110-
],
111-
options: {
112-
jshintrc: true
113-
}
105+
eslint: {
106+
options: {
107+
108+
// See https://github.com/sindresorhus/grunt-eslint/issues/119
109+
quiet: true
114110
},
115-
dist: {
116-
src: "dist/jquery.js",
117-
options: srcHintOptions
118-
}
119-
},
120-
jscs: {
121-
src: "src",
122-
gruntfile: "Gruntfile.js",
123-
124-
// Check parts of tests that pass
125-
test: [
126-
"test/data/testrunner.js",
127-
"test/unit/animation.js",
128-
"test/unit/basic.js",
129-
"test/unit/support.js",
130-
"test/unit/tween.js",
131-
"test/unit/wrap.js"
132-
],
133-
build: "build"
111+
all: ".",
112+
dev: [ "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js" ]
134113
},
135114
testswarm: {
136115
tests: [
@@ -164,7 +143,7 @@ module.exports = function( grunt ) {
164143
]
165144
},
166145
watch: {
167-
files: [ "<%= jshint.all.src %>" ],
146+
files: [ "<%= eslint.dev %>" ],
168147
tasks: [ "dev" ]
169148
},
170149
uglify: {
@@ -201,7 +180,7 @@ module.exports = function( grunt ) {
201180
// Integrate jQuery specific tasks
202181
grunt.loadTasks( "build/tasks" );
203182

204-
grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );
183+
grunt.registerTask( "lint", [ "jsonlint" ] );
205184

206185
// Don't run Node-related tests in Node.js < 1.0.0 as they require an old
207186
// jsdom version that needs compiling, making it harder for people to compile
@@ -213,9 +192,15 @@ module.exports = function( grunt ) {
213192
) );
214193

215194
// Short list as a high frequency watch task
216-
grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
195+
grunt.registerTask( "dev", [
196+
"build:*:*",
197+
"uglify",
198+
"remove_map_comment",
199+
"dist:*"
200+
]
201+
);
217202

218203
grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );
219204

220-
grunt.registerTask( "precommit_lint", [ "newer:jsonlint", "newer:jshint:all", "newer:jscs" ] );
205+
grunt.registerTask( "precommit_lint", [ "newer:jsonlint" ] );
221206
};

build/.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"env": {
3+
"node": true
4+
},
5+
"extends": "../.eslintrc",
6+
"root": true
7+
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
"grunt-babel": "6.0.0",
3434
"grunt-cli": "1.2.0",
3535
"grunt-compare-size": "0.4.2",
36-
"grunt-contrib-jshint": "1.0.0",
3736
"grunt-contrib-uglify": "1.0.1",
3837
"grunt-contrib-watch": "1.0.0",
38+
"grunt-eslint": "18.1.0",
3939
"grunt-git-authors": "3.2.0",
40-
"grunt-jscs": "2.8.0",
4140
"grunt-jsonlint": "1.0.7",
4241
"grunt-newer": "1.2.0",
4342
"grunt-npmcopy": "0.1.0",

src/.eslintrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"env": {
3+
"browser"
4+
},
5+
"extends": "../.eslintrc",
6+
"root": true,
7+
"globals": {
8+
"window": true,
9+
"JSON": false,
10+
"jQuery": true,
11+
"define": true,
12+
"module": true,
13+
"noGlobal": true
14+
}
15+
}

src/.jshintrc

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)