Skip to content

Commit c6cfba2

Browse files
authored
Build: Improve ESLint configuration, check all test files as well
The new ESLint setup is largely based on the current jQuery Core one. Closes jquerygh-339
1 parent 4d91120 commit c6cfba2

23 files changed

+466
-264
lines changed

.eslintrc-browser.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"root": true,
3+
4+
"extends": "jquery",
5+
6+
// Support: IE <=9 only, Android <=4.0 only
7+
// The above browsers are failing a lot of tests in the ES5
8+
// test suite at http://test262.ecmascript.org.
9+
"parserOptions": {
10+
"ecmaVersion": 3
11+
},
12+
13+
// The browser env is not enabled on purpose so that code takes
14+
// all browser-only globals from window instead of assuming
15+
// they're available as globals. This makes it possible to use
16+
// jQuery with tools like jsdom which provide a custom window
17+
// implementation.
18+
"env": {},
19+
20+
"globals": {
21+
"window": true,
22+
"define": true,
23+
"module": true
24+
},
25+
26+
"rules": {
27+
"one-var": ["error", {"var": "always"}],
28+
"strict": ["error", "function"]
29+
}
30+
}

.eslintrc-node.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"root": true,
3+
4+
"extends": "jquery",
5+
6+
"parserOptions": {
7+
"ecmaVersion": 2017
8+
},
9+
10+
"env": {
11+
"es6": true,
12+
"node": true
13+
},
14+
15+
"rules": {
16+
"strict": ["error", "global"]
17+
}
18+
}

.eslintrc.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"extends": "jquery",
32
"root": true,
4-
"env": {
5-
"browser": false,
6-
"node": true
7-
}
3+
4+
"extends": "./.eslintrc-node.json"
85
}

Gruntfile.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
/*global module:false*/
2-
module.exports = function( grunt ) {
1+
"use strict";
2+
3+
/* global module:false */
34

4-
"use strict";
5+
module.exports = function( grunt ) {
56

67
var isTravis = process.env.TRAVIS;
78

build/release.js

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* JQuery Migrate Plugin Release Management
44
*/
55

6+
"use strict";
7+
68
// Debugging variables
79
var dryrun = false,
810
skipRemote = false;

dist/.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"root": true,
44
"rules": {
55
// That is okay for the built version
6-
"no-multiple-empty-lines": "off"
6+
"no-multiple-empty-lines": "off",
7+
"one-var": "off"
78
}
89
}

0 commit comments

Comments
 (0)