Skip to content

Build: Migrate from JSHint & JSCS to ESLint #1958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"root": true,

"extends": "jquery",

// Uncomment to find useless comment disable directives
// "reportUnusedDisableDirectives": true,

"parserOptions": {
"ecmaVersion": 2018
},

"env": {
"es6": true,
"node": true
},

"rules": {
"strict": [ "error", "global" ]
}
}
18 changes: 0 additions & 18 deletions .jscsrc

This file was deleted.

16 changes: 0 additions & 16 deletions .jshintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
demos
tests
.editorconfig
.jscsrc
.jshintrc
.eslintrc.json
.eslintignore
.mailmap
.travis.yml
Gruntfile.js
Expand Down
50 changes: 15 additions & 35 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function( grunt ) {

"use strict";

module.exports = function( grunt ) {

var
glob = require( "glob" ),

Expand Down Expand Up @@ -177,33 +177,14 @@ grunt.initConfig( {
}
},

jscs: {
ui: {
options: {
config: true
},
files: {
src: [ "demos/**/*.js", "build/**/*.js", "ui/**/*.js" ]
}
},
tests: {
options: {
config: true,
maximumLineLength: null
},
files: {
src: [ "tests/**/*.js" ]
}
}
},
uglify: minify,
htmllint: {
good: {
options: {
ignore: [
/The text content of element “script” was not in the required format: Expected space, tab, newline, or slash but found “.” instead/
] },
src: glob.sync("{demos,tests}/**/*.html", {
src: glob.sync( "{demos,tests}/**/*.html", {
ignore: htmllintBad
} )
},
Expand Down Expand Up @@ -242,12 +223,10 @@ grunt.initConfig( {
}
}
},
jshint: {
options: {
jshintrc: true
},
eslint: {
all: [
"ui/*.js",
"ui/**/*.js",
"!ui/vendor/**/*.js",
"Gruntfile.js",
"build/**/*.js",
"tests/unit/**/*.js",
Expand Down Expand Up @@ -287,10 +266,12 @@ grunt.initConfig( {
"qunit/qunit.css": "qunit/qunit/qunit.css",
"qunit/LICENSE.txt": "qunit/LICENSE.txt",

"qunit-assert-classes/qunit-assert-classes.js": "qunit-assert-classes/qunit-assert-classes.js",
"qunit-assert-classes/qunit-assert-classes.js":
"qunit-assert-classes/qunit-assert-classes.js",
"qunit-assert-classes/LICENSE.txt": "qunit-assert-classes/LICENSE",

"qunit-assert-close/qunit-assert-close.js": "qunit-assert-close/qunit-assert-close.js",
"qunit-assert-close/qunit-assert-close.js":
"qunit-assert-close/qunit-assert-close.js",
"qunit-assert-close/MIT-LICENSE.txt": "qunit-assert-close/MIT-LICENSE.txt",

"qunit-composite/qunit-composite.js": "qunit-composite/qunit-composite.js",
Expand All @@ -305,9 +286,6 @@ grunt.initConfig( {
"jquery-simulate/jquery.simulate.js": "jquery-simulate/jquery.simulate.js",
"jquery-simulate/LICENSE.txt": "jquery-simulate/LICENSE.txt",

"jshint/jshint.js": "jshint/dist/jshint.js",
"jshint/LICENSE": "jshint/LICENSE",

"jquery/jquery.js": "jquery-1.x/dist/jquery.js",
"jquery/LICENSE.txt": "jquery-1.x/LICENSE.txt",

Expand Down Expand Up @@ -443,10 +421,12 @@ grunt.initConfig( {
"jquery-3.6.0/jquery.js": "jquery-3.6.0/dist/jquery.js",
"jquery-3.6.0/LICENSE.txt": "jquery-3.6.0/LICENSE.txt",

"jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.4.1/dist/jquery-migrate.js",
"jquery-migrate-1.4.1/jquery-migrate.js":
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",

"jquery-migrate-3.3.2/jquery-migrate.js": "jquery-migrate-3.3.2/dist/jquery-migrate.js",
"jquery-migrate-3.3.2/jquery-migrate.js":
"jquery-migrate-3.3.2/dist/jquery-migrate.js",
"jquery-migrate-3.3.2/LICENSE.txt": "jquery-migrate-3.3.2/LICENSE.txt"
}
}
Expand Down Expand Up @@ -512,7 +492,7 @@ grunt.registerTask( "update-authors", function() {

grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
grunt.registerTask( "jenkins", [ "default", "concat" ] );
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ] );
grunt.registerTask( "lint", [ "asciilint", "eslint", "csslint", "htmllint" ] );
grunt.registerTask( "test", [ "qunit" ] );
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );
Expand Down
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"jquery-color": "2.2.0",
"jquery-mousewheel": "3.1.12",
"jquery-simulate": "1.1.1",
"jshint": "2.4.4",
"qunit": "1.18.0",
"qunit-assert-classes": "1.0.2",
"qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1",
Expand Down
2 changes: 2 additions & 0 deletions build/release-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var shell = require( "shelljs" );
var Release = {
define: function( props ) {
Expand Down
4 changes: 3 additions & 1 deletion build/release.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

module.exports = function( Release ) {

var crypto = require( "crypto" );
Expand Down Expand Up @@ -35,7 +37,7 @@ function replaceAtVersion() {
return matches;
}

function removeExternals ( packager ) {
function removeExternals( packager ) {
Object.keys( packager.builtFiles ).forEach( function( filepath ) {
if ( /^external\//.test( filepath ) ) {
delete packager.builtFiles[ filepath ];
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function( grunt ) {

"use strict";

module.exports = function( grunt ) {

grunt.registerTask( "clean", function() {
require( "rimraf" ).sync( "dist" );
} );
Expand Down
8 changes: 4 additions & 4 deletions build/tasks/testswarm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function( grunt ) {

"use strict";

module.exports = function( grunt ) {

var versions = {
"git": "git",
"3.x-git": "3.x-git",
Expand Down Expand Up @@ -95,7 +95,7 @@ grunt.registerTask( "testswarm", function( commit, configFile, browserSets ) {
var test,
latestTests = {};
for ( test in tests ) {
latestTests[ test ] = tests[ test ] + "?nojshint=true";
latestTests[ test ] = tests[ test ];
}
submit( commit, latestTests, configFile, browserSets, "", this.async() );
} );
Expand All @@ -104,7 +104,7 @@ grunt.registerTask( "testswarm-multi-jquery", function( commit, configFile, mino
var allTests = {};
versions[ minor ].split( " " ).forEach( function( version ) {
for ( var test in tests ) {
allTests[ test + "-" + version ] = tests[ test ] + "?nojshint=true&jquery=" + version;
allTests[ test + "-" + version ] = tests[ test ] + "?jquery=" + version;
}
} );
submit( commit, allTests, configFile, browserSets, "core " + minor, this.async() );
Expand Down
5 changes: 5 additions & 0 deletions demos/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"root": true,

"extends": "../ui/.eslintrc.json"
}
1 change: 1 addition & 0 deletions demos/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals window, document */
( function() {
"use strict";

// Find the script element
var scripts = document.getElementsByTagName( "script" );
Expand Down
20 changes: 0 additions & 20 deletions external/jshint/LICENSE/LICENSE

This file was deleted.

Loading