Skip to content

Commit 70dae67

Browse files
authored
Build: Migrate from JSHint & JSCS to ESLint
Fixes #15393 Closes gh-1958
1 parent a12c985 commit 70dae67

File tree

251 files changed

+1486
-61556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+1486
-61556
lines changed
File renamed without changes.

.eslintrc.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"root": true,
3+
4+
"extends": "jquery",
5+
6+
// Uncomment to find useless comment disable directives
7+
// "reportUnusedDisableDirectives": true,
8+
9+
"parserOptions": {
10+
"ecmaVersion": 2018
11+
},
12+
13+
"env": {
14+
"es6": true,
15+
"node": true
16+
},
17+
18+
"rules": {
19+
"strict": [ "error", "global" ]
20+
}
21+
}

.jscsrc

-18
This file was deleted.

.jshintrc

-16
This file was deleted.

.npmignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
demos
22
tests
33
.editorconfig
4-
.jscsrc
5-
.jshintrc
4+
.eslintrc.json
5+
.eslintignore
66
.mailmap
77
.travis.yml
88
Gruntfile.js

Gruntfile.js

+15-35
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function( grunt ) {
2-
31
"use strict";
42

3+
module.exports = function( grunt ) {
4+
55
var
66
glob = require( "glob" ),
77

@@ -177,33 +177,14 @@ grunt.initConfig( {
177177
}
178178
},
179179

180-
jscs: {
181-
ui: {
182-
options: {
183-
config: true
184-
},
185-
files: {
186-
src: [ "demos/**/*.js", "build/**/*.js", "ui/**/*.js" ]
187-
}
188-
},
189-
tests: {
190-
options: {
191-
config: true,
192-
maximumLineLength: null
193-
},
194-
files: {
195-
src: [ "tests/**/*.js" ]
196-
}
197-
}
198-
},
199180
uglify: minify,
200181
htmllint: {
201182
good: {
202183
options: {
203184
ignore: [
204185
/The text content of element script was not in the required format: Expected space, tab, newline, or slash but found . instead/
205186
] },
206-
src: glob.sync("{demos,tests}/**/*.html", {
187+
src: glob.sync( "{demos,tests}/**/*.html", {
207188
ignore: htmllintBad
208189
} )
209190
},
@@ -242,12 +223,10 @@ grunt.initConfig( {
242223
}
243224
}
244225
},
245-
jshint: {
246-
options: {
247-
jshintrc: true
248-
},
226+
eslint: {
249227
all: [
250-
"ui/*.js",
228+
"ui/**/*.js",
229+
"!ui/vendor/**/*.js",
251230
"Gruntfile.js",
252231
"build/**/*.js",
253232
"tests/unit/**/*.js",
@@ -287,10 +266,12 @@ grunt.initConfig( {
287266
"qunit/qunit.css": "qunit/qunit/qunit.css",
288267
"qunit/LICENSE.txt": "qunit/LICENSE.txt",
289268

290-
"qunit-assert-classes/qunit-assert-classes.js": "qunit-assert-classes/qunit-assert-classes.js",
269+
"qunit-assert-classes/qunit-assert-classes.js":
270+
"qunit-assert-classes/qunit-assert-classes.js",
291271
"qunit-assert-classes/LICENSE.txt": "qunit-assert-classes/LICENSE",
292272

293-
"qunit-assert-close/qunit-assert-close.js": "qunit-assert-close/qunit-assert-close.js",
273+
"qunit-assert-close/qunit-assert-close.js":
274+
"qunit-assert-close/qunit-assert-close.js",
294275
"qunit-assert-close/MIT-LICENSE.txt": "qunit-assert-close/MIT-LICENSE.txt",
295276

296277
"qunit-composite/qunit-composite.js": "qunit-composite/qunit-composite.js",
@@ -305,9 +286,6 @@ grunt.initConfig( {
305286
"jquery-simulate/jquery.simulate.js": "jquery-simulate/jquery.simulate.js",
306287
"jquery-simulate/LICENSE.txt": "jquery-simulate/LICENSE.txt",
307288

308-
"jshint/jshint.js": "jshint/dist/jshint.js",
309-
"jshint/LICENSE": "jshint/LICENSE",
310-
311289
"jquery/jquery.js": "jquery-1.x/dist/jquery.js",
312290
"jquery/LICENSE.txt": "jquery-1.x/LICENSE.txt",
313291

@@ -443,10 +421,12 @@ grunt.initConfig( {
443421
"jquery-3.6.0/jquery.js": "jquery-3.6.0/dist/jquery.js",
444422
"jquery-3.6.0/LICENSE.txt": "jquery-3.6.0/LICENSE.txt",
445423

446-
"jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.4.1/dist/jquery-migrate.js",
424+
"jquery-migrate-1.4.1/jquery-migrate.js":
425+
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
447426
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
448427

449-
"jquery-migrate-3.3.2/jquery-migrate.js": "jquery-migrate-3.3.2/dist/jquery-migrate.js",
428+
"jquery-migrate-3.3.2/jquery-migrate.js":
429+
"jquery-migrate-3.3.2/dist/jquery-migrate.js",
450430
"jquery-migrate-3.3.2/LICENSE.txt": "jquery-migrate-3.3.2/LICENSE.txt"
451431
}
452432
}
@@ -512,7 +492,7 @@ grunt.registerTask( "update-authors", function() {
512492

513493
grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
514494
grunt.registerTask( "jenkins", [ "default", "concat" ] );
515-
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ] );
495+
grunt.registerTask( "lint", [ "asciilint", "eslint", "csslint", "htmllint" ] );
516496
grunt.registerTask( "test", [ "qunit" ] );
517497
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
518498
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );

bower.json

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"jquery-color": "2.2.0",
1616
"jquery-mousewheel": "3.1.12",
1717
"jquery-simulate": "1.1.1",
18-
"jshint": "2.4.4",
1918
"qunit": "1.18.0",
2019
"qunit-assert-classes": "1.0.2",
2120
"qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1",

build/release-test.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
var shell = require( "shelljs" );
24
var Release = {
35
define: function( props ) {

build/release.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
module.exports = function( Release ) {
24

35
var crypto = require( "crypto" );
@@ -35,7 +37,7 @@ function replaceAtVersion() {
3537
return matches;
3638
}
3739

38-
function removeExternals ( packager ) {
40+
function removeExternals( packager ) {
3941
Object.keys( packager.builtFiles ).forEach( function( filepath ) {
4042
if ( /^external\//.test( filepath ) ) {
4143
delete packager.builtFiles[ filepath ];

build/tasks/build.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function( grunt ) {
2-
31
"use strict";
42

3+
module.exports = function( grunt ) {
4+
55
grunt.registerTask( "clean", function() {
66
require( "rimraf" ).sync( "dist" );
77
} );

build/tasks/testswarm.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
module.exports = function( grunt ) {
2-
31
"use strict";
42

3+
module.exports = function( grunt ) {
4+
55
var versions = {
66
"git": "git",
77
"3.x-git": "3.x-git",
@@ -95,7 +95,7 @@ grunt.registerTask( "testswarm", function( commit, configFile, browserSets ) {
9595
var test,
9696
latestTests = {};
9797
for ( test in tests ) {
98-
latestTests[ test ] = tests[ test ] + "?nojshint=true";
98+
latestTests[ test ] = tests[ test ];
9999
}
100100
submit( commit, latestTests, configFile, browserSets, "", this.async() );
101101
} );
@@ -104,7 +104,7 @@ grunt.registerTask( "testswarm-multi-jquery", function( commit, configFile, mino
104104
var allTests = {};
105105
versions[ minor ].split( " " ).forEach( function( version ) {
106106
for ( var test in tests ) {
107-
allTests[ test + "-" + version ] = tests[ test ] + "?nojshint=true&jquery=" + version;
107+
allTests[ test + "-" + version ] = tests[ test ] + "?jquery=" + version;
108108
}
109109
} );
110110
submit( commit, allTests, configFile, browserSets, "core " + minor, this.async() );

demos/.eslintrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"root": true,
3+
4+
"extends": "../ui/.eslintrc.json"
5+
}

demos/bootstrap.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* globals window, document */
22
( function() {
3+
"use strict";
34

45
// Find the script element
56
var scripts = document.getElementsByTagName( "script" );

external/jshint/LICENSE/LICENSE

-20
This file was deleted.

0 commit comments

Comments
 (0)