mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Build: Update ESLint & eslint-plugin-import, fixing the build
Latest `main` started failing the build after some transitive dependencies got updated, incorrectly recognizing some files with default exports as unused. Since the new ESLint no longer supports Node 10 which we have to build on due to use in our CI, skip ESLint in Node 10. Ref gh-3225 Closes gh-4961
This commit is contained in:
parent
e124893132
commit
9735edd5cb
45
Gruntfile.js
45
Gruntfile.js
@ -12,11 +12,18 @@ module.exports = function( grunt ) {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Support: Node.js <12
|
||||||
|
// Skip running tasks that dropped support for Node.js 10
|
||||||
|
// in this Node version.
|
||||||
|
function runIfNewNode( task ) {
|
||||||
|
return oldNode ? "print_old_node_message:" + task : task;
|
||||||
|
}
|
||||||
|
|
||||||
var fs = require( "fs" ),
|
var fs = require( "fs" ),
|
||||||
gzip = require( "gzip-js" ),
|
gzip = require( "gzip-js" ),
|
||||||
|
oldNode = /^v10\./.test( process.version ),
|
||||||
isTravis = process.env.TRAVIS,
|
isTravis = process.env.TRAVIS,
|
||||||
travisBrowsers = process.env.BROWSERS && process.env.BROWSERS.split( "," ),
|
travisBrowsers = process.env.BROWSERS && process.env.BROWSERS.split( "," );
|
||||||
CLIEngine = require( "eslint" ).CLIEngine;
|
|
||||||
|
|
||||||
if ( !grunt.option( "filename" ) ) {
|
if ( !grunt.option( "filename" ) ) {
|
||||||
grunt.option( "filename", "jquery.js" );
|
grunt.option( "filename", "jquery.js" );
|
||||||
@ -117,9 +124,14 @@ module.exports = function( grunt ) {
|
|||||||
|
|
||||||
// Ignore files from .eslintignore
|
// Ignore files from .eslintignore
|
||||||
// See https://github.com/sindresorhus/grunt-eslint/issues/119
|
// See https://github.com/sindresorhus/grunt-eslint/issues/119
|
||||||
...new CLIEngine()
|
...fs
|
||||||
.getConfigForFile( "Gruntfile.js" )
|
.readFileSync( `${ __dirname }/.eslintignore`, "utf-8" )
|
||||||
.ignorePatterns.map( ( p ) => `!${ p }` )
|
.split( "\n" )
|
||||||
|
.filter( filePath => filePath )
|
||||||
|
.map( filePath => filePath[ 0 ] === "!" ?
|
||||||
|
filePath.slice( 1 ) :
|
||||||
|
`!${ filePath }`
|
||||||
|
)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -334,11 +346,18 @@ module.exports = function( grunt ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
// Load grunt tasks from NPM packages
|
// Load grunt tasks from NPM packages
|
||||||
require( "load-grunt-tasks" )( grunt );
|
require( "load-grunt-tasks" )( grunt, {
|
||||||
|
pattern: oldNode ? [ "grunt-*", "!grunt-eslint" ] : [ "grunt-*" ]
|
||||||
|
} );
|
||||||
|
|
||||||
// Integrate jQuery specific tasks
|
// Integrate jQuery specific tasks
|
||||||
grunt.loadTasks( "build/tasks" );
|
grunt.loadTasks( "build/tasks" );
|
||||||
|
|
||||||
|
grunt.registerTask( "print_old_node_message", ( ...args ) => {
|
||||||
|
var task = args.join( ":" );
|
||||||
|
grunt.log.writeln( "Old Node.js detected, running the task \"" + task + "\" skipped..." );
|
||||||
|
} );
|
||||||
|
|
||||||
grunt.registerTask( "lint", [
|
grunt.registerTask( "lint", [
|
||||||
"jsonlint",
|
"jsonlint",
|
||||||
|
|
||||||
@ -346,16 +365,16 @@ module.exports = function( grunt ) {
|
|||||||
// would run the dist target first which would point to errors in the built
|
// would run the dist target first which would point to errors in the built
|
||||||
// file, making it harder to fix them. We want to check the built file only
|
// file, making it harder to fix them. We want to check the built file only
|
||||||
// if we already know the source files pass the linter.
|
// if we already know the source files pass the linter.
|
||||||
"eslint:dev",
|
runIfNewNode( "eslint:dev" ),
|
||||||
"eslint:dist"
|
runIfNewNode( "eslint:dist" )
|
||||||
] );
|
] );
|
||||||
|
|
||||||
grunt.registerTask( "lint:newer", [
|
grunt.registerTask( "lint:newer", [
|
||||||
"newer:jsonlint",
|
"newer:jsonlint",
|
||||||
|
|
||||||
// Don't replace it with just the task; see the above comment.
|
// Don't replace it with just the task; see the above comment.
|
||||||
"newer:eslint:dev",
|
runIfNewNode( "newer:eslint:dev" ),
|
||||||
"newer:eslint:dist"
|
runIfNewNode( "newer:eslint:dist" )
|
||||||
] );
|
] );
|
||||||
|
|
||||||
grunt.registerTask( "test:fast", "node_smoke_tests" );
|
grunt.registerTask( "test:fast", "node_smoke_tests" );
|
||||||
@ -378,7 +397,7 @@ module.exports = function( grunt ) {
|
|||||||
|
|
||||||
grunt.registerTask( "dev", [
|
grunt.registerTask( "dev", [
|
||||||
"build:*:*",
|
"build:*:*",
|
||||||
"newer:eslint:dev",
|
runIfNewNode( "newer:eslint:dev" ),
|
||||||
"newer:uglify",
|
"newer:uglify",
|
||||||
"remove_map_comment",
|
"remove_map_comment",
|
||||||
"dist:*",
|
"dist:*",
|
||||||
@ -387,14 +406,14 @@ module.exports = function( grunt ) {
|
|||||||
] );
|
] );
|
||||||
|
|
||||||
grunt.registerTask( "default", [
|
grunt.registerTask( "default", [
|
||||||
"eslint:dev",
|
runIfNewNode( "eslint:dev" ),
|
||||||
"build:*:*",
|
"build:*:*",
|
||||||
"amd",
|
"amd",
|
||||||
"uglify",
|
"uglify",
|
||||||
"remove_map_comment",
|
"remove_map_comment",
|
||||||
"dist:*",
|
"dist:*",
|
||||||
"test:prepare",
|
"test:prepare",
|
||||||
"eslint:dist",
|
runIfNewNode( "eslint:dist" ),
|
||||||
"test:fast",
|
"test:fast",
|
||||||
"compare_size"
|
"compare_size"
|
||||||
] );
|
] );
|
||||||
|
@ -30,14 +30,14 @@
|
|||||||
"commitplease": "3.2.0",
|
"commitplease": "3.2.0",
|
||||||
"core-js-bundle": "3.6.5",
|
"core-js-bundle": "3.6.5",
|
||||||
"eslint-config-jquery": "3.0.0",
|
"eslint-config-jquery": "3.0.0",
|
||||||
"eslint-plugin-import": "2.22.0",
|
"eslint-plugin-import": "2.25.2",
|
||||||
"grunt": "1.2.1",
|
"grunt": "1.2.1",
|
||||||
"grunt-babel": "8.0.0",
|
"grunt-babel": "8.0.0",
|
||||||
"grunt-cli": "1.3.2",
|
"grunt-cli": "1.3.2",
|
||||||
"grunt-compare-size": "0.4.2",
|
"grunt-compare-size": "0.4.2",
|
||||||
"grunt-contrib-uglify": "3.4.0",
|
"grunt-contrib-uglify": "3.4.0",
|
||||||
"grunt-contrib-watch": "1.1.0",
|
"grunt-contrib-watch": "1.1.0",
|
||||||
"grunt-eslint": "23.0.0",
|
"grunt-eslint": "24.0.0",
|
||||||
"grunt-git-authors": "3.2.0",
|
"grunt-git-authors": "3.2.0",
|
||||||
"grunt-jsonlint": "2.1.2",
|
"grunt-jsonlint": "2.1.2",
|
||||||
"grunt-karma": "4.0.0",
|
"grunt-karma": "4.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user