Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9735edd

Browse files
authored
Build: Update ESLint & eslint-plugin-import, fixing the build
Latest `main` started failing the build after some transitive dependenciesgot 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 dueto use in our CI, skip ESLint in Node 10.Refgh-3225Closesgh-4961
1 parente124893 commit9735edd

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

‎Gruntfile.js

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ module.exports = function( grunt ) {
1212
returndata;
1313
}
1414

15+
// Support: Node.js <12
16+
// Skip running tasks that dropped support for Node.js 10
17+
// in this Node version.
18+
functionrunIfNewNode(task){
19+
returnoldNode ?"print_old_node_message:"+task :task;
20+
}
21+
1522
varfs=require("fs"),
1623
gzip=require("gzip-js"),
24+
oldNode=/^v10\./.test(process.version),
1725
isTravis=process.env.TRAVIS,
18-
travisBrowsers=process.env.BROWSERS&&process.env.BROWSERS.split(","),
19-
CLIEngine=require("eslint").CLIEngine;
26+
travisBrowsers=process.env.BROWSERS&&process.env.BROWSERS.split(",");
2027

2128
if(!grunt.option("filename")){
2229
grunt.option("filename","jquery.js");
@@ -117,9 +124,14 @@ module.exports = function( grunt ) {
117124

118125
// Ignore files from .eslintignore
119126
// See https://github.com/sindresorhus/grunt-eslint/issues/119
120-
...newCLIEngine()
121-
.getConfigForFile("Gruntfile.js")
122-
.ignorePatterns.map((p)=>`!${p}`)
127+
...fs
128+
.readFileSync(`${__dirname}/.eslintignore`,"utf-8")
129+
.split("\n")
130+
.filter(filePath=>filePath)
131+
.map(filePath=>filePath[0]==="!" ?
132+
filePath.slice(1) :
133+
`!${filePath}`
134+
)
123135
]
124136
}
125137
},
@@ -334,28 +346,35 @@ module.exports = function( grunt ) {
334346
});
335347

336348
// Load grunt tasks from NPM packages
337-
require("load-grunt-tasks")(grunt);
349+
require("load-grunt-tasks")(grunt,{
350+
pattern:oldNode ?["grunt-*","!grunt-eslint"] :["grunt-*"]
351+
});
338352

339353
// Integrate jQuery specific tasks
340354
grunt.loadTasks("build/tasks");
341355

356+
grunt.registerTask("print_old_node_message",( ...args)=>{
357+
vartask=args.join(":");
358+
grunt.log.writeln("Old Node.js detected, running the task \""+task+"\" skipped...");
359+
});
360+
342361
grunt.registerTask("lint",[
343362
"jsonlint",
344363

345364
// Running the full eslint task without breaking it down to targets
346365
// would run the dist target first which would point to errors in the built
347366
// file, making it harder to fix them. We want to check the built file only
348367
// if we already know the source files pass the linter.
349-
"eslint:dev",
350-
"eslint:dist"
368+
runIfNewNode("eslint:dev"),
369+
runIfNewNode("eslint:dist")
351370
]);
352371

353372
grunt.registerTask("lint:newer",[
354373
"newer:jsonlint",
355374

356375
// Don't replace it with just the task; see the above comment.
357-
"newer:eslint:dev",
358-
"newer:eslint:dist"
376+
runIfNewNode("newer:eslint:dev"),
377+
runIfNewNode("newer:eslint:dist")
359378
]);
360379

361380
grunt.registerTask("test:fast","node_smoke_tests");
@@ -378,7 +397,7 @@ module.exports = function( grunt ) {
378397

379398
grunt.registerTask("dev",[
380399
"build:*:*",
381-
"newer:eslint:dev",
400+
runIfNewNode("newer:eslint:dev"),
382401
"newer:uglify",
383402
"remove_map_comment",
384403
"dist:*",
@@ -387,14 +406,14 @@ module.exports = function( grunt ) {
387406
]);
388407

389408
grunt.registerTask("default",[
390-
"eslint:dev",
409+
runIfNewNode("eslint:dev"),
391410
"build:*:*",
392411
"amd",
393412
"uglify",
394413
"remove_map_comment",
395414
"dist:*",
396415
"test:prepare",
397-
"eslint:dist",
416+
runIfNewNode("eslint:dist"),
398417
"test:fast",
399418
"compare_size"
400419
]);

‎package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
"commitplease":"3.2.0",
3131
"core-js-bundle":"3.6.5",
3232
"eslint-config-jquery":"3.0.0",
33-
"eslint-plugin-import":"2.22.0",
33+
"eslint-plugin-import":"2.25.2",
3434
"grunt":"1.2.1",
3535
"grunt-babel":"8.0.0",
3636
"grunt-cli":"1.3.2",
3737
"grunt-compare-size":"0.4.2",
3838
"grunt-contrib-uglify":"3.4.0",
3939
"grunt-contrib-watch":"1.1.0",
40-
"grunt-eslint":"23.0.0",
40+
"grunt-eslint":"24.0.0",
4141
"grunt-git-authors":"3.2.0",
4242
"grunt-jsonlint":"2.1.2",
4343
"grunt-karma":"4.0.0",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp