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

Commit7497052

Browse files
authored
Build: improve specificity of eslint config; add ecma versions
Closesgh-5501
1 parent46b9e48 commit7497052

File tree

15 files changed

+141
-125
lines changed

15 files changed

+141
-125
lines changed

‎eslint.config.js‎

Lines changed: 121 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,14 @@ export default [
1515
]
1616
},
1717

18-
{
19-
files:[
20-
"eslint.config.js",
21-
"Gruntfile.cjs",
22-
"test/bundler_smoke_tests/**/*",
23-
"test/node_smoke_tests/**",
24-
"test/promises_aplus_adapters/**",
25-
"test/middleware-mockserver.cjs"
26-
],
27-
languageOptions:{
28-
globals:{
29-
...globals.node
30-
}
31-
},
32-
rules:{
33-
...jqueryConfig.rules,
34-
strict:["error","global"]
35-
}
36-
},
37-
3818
// Source
3919
{
4020
files:["src/**"],
4121
plugins:{
4222
import:importPlugin
4323
},
4424
languageOptions:{
25+
ecmaVersion:2015,
4526

4627
// The browser env is not enabled on purpose so that code takes
4728
// all browser-only globals from window instead of assuming
@@ -84,6 +65,7 @@ export default [
8465
outerIIFEBody:0
8566
}
8667
],
68+
"no-implicit-globals":"error",
8769
"one-var":["error",{var:"always"}],
8870
strict:["error","function"]
8971
}
@@ -159,7 +141,10 @@ export default [
159141
// Tests
160142
{
161143
files:[
162-
"test/**"
144+
"test/*",
145+
"test/data/**",
146+
"test/integration/**",
147+
"test/unit/**"
163148
],
164149
ignores:[
165150
"test/data/jquery-3.7.1.js",
@@ -170,11 +155,11 @@ export default [
170155
"test/data/core/jquery-iterability-transpiled.js"
171156
],
172157
languageOptions:{
158+
ecmaVersion:2015,
159+
sourceType:"script",
173160
globals:{
174161
...globals.browser,
175162
require:false,
176-
Promise:false,
177-
Symbol:false,
178163
trustedTypes:false,
179164
QUnit:false,
180165
ajaxTest:false,
@@ -186,32 +171,43 @@ export default [
186171
moduleTeardown:false,
187172
url:false,
188173
q:false,
189-
jQuery:true,
190-
sinon:true,
191-
amdDefined:true,
192-
fireNative:true,
193-
Globals:true,
194-
hasPHP:true,
195-
isLocal:true,
196-
supportjQuery:true,
197-
originaljQuery:true,
198-
$:true,
199-
original$:true,
200-
baseURL:true,
201-
externalHost:true
174+
jQuery:false,
175+
$:false,
176+
sinon:false,
177+
amdDefined:false,
178+
fireNative:false,
179+
Globals:false,
180+
hasPHP:false,
181+
isLocal:false,
182+
supportjQuery:false,
183+
originaljQuery:false,
184+
original$:false,
185+
baseURL:false,
186+
externalHost:false
202187
}
203188
},
204189
rules:{
205190
...jqueryConfig.rules,
206-
strict:["error","function"],
207191

208-
// See https://github.com/eslint/eslint/issues/2342
209-
"no-unused-vars":"off",
192+
"no-unused-vars":[
193+
"error",
194+
{args:"after-used",argsIgnorePattern:"^_"}
195+
],
210196

211197
// Too many errors
212198
"max-len":"off",
213-
camelcase:"off",
214-
"one-var":"off"
199+
camelcase:"off"
200+
}
201+
},
202+
203+
{
204+
files:[
205+
"test/unit/core.js"
206+
],
207+
rules:{
208+
209+
// Core has several cases where unused vars are expected
210+
"no-unused-vars":"off"
215211
}
216212
},
217213

@@ -220,10 +216,10 @@ export default [
220216
"test/runner/**/*.js"
221217
],
222218
languageOptions:{
219+
ecmaVersion:"latest",
223220
globals:{
224221
...globals.node
225-
},
226-
sourceType:"module"
222+
}
227223
},
228224
rules:{
229225
...jqueryConfig.rules
@@ -234,70 +230,80 @@ export default [
234230
files:["test/runner/listeners.js"],
235231
languageOptions:{
236232
ecmaVersion:5,
237-
sourceType:"script"
233+
sourceType:"script",
234+
globals:{
235+
...globals.browser,
236+
QUnit:false,
237+
Symbol:false
238+
}
238239
}
239240
},
240241

241242
{
242243
files:[
244+
"test/data/testinit.js",
243245
"test/data/testrunner.js",
244246
"test/data/core/jquery-iterability-transpiled-es6.js"
245247
],
246248
languageOptions:{
247-
sourceType:"script"
249+
ecmaVersion:2015,
250+
sourceType:"script",
251+
globals:{
252+
...globals.browser
253+
}
254+
},
255+
rules:{
256+
...jqueryConfig.rules,
257+
strict:["error","function"]
248258
}
249259
},
250260

251261
{
252262
files:[
253-
"test/unit/deferred.js"
263+
"test/data/testinit.js"
254264
],
255265
rules:{
256-
257-
// Deferred tests set strict mode for certain tests
258-
strict:"off"
266+
strict:["error","global"]
259267
}
260268
},
261269

262270
{
263271
files:[
264-
"test/bundler_smoke_tests/**",
265-
"test/node_smoke_tests/**",
266-
"test/promises_aplus_adapters/**",
267-
"test/middleware-mockserver.cjs"
272+
"test/unit/deferred.js"
268273
],
269-
languageOptions:{
270-
globals:{
271-
...globals.node,
272-
...globals.es2021
273-
}
274-
},
275274
rules:{
276-
strict:["error","global"]
275+
276+
// Deferred tests set strict mode for certain tests
277+
strict:"off"
277278
}
278279
},
279280

280281
{
281282
files:[
282283
"build/**",
283-
"test/data/testinit.js"
284+
"eslint.config.js",
285+
"test/node_smoke_tests/**",
286+
"test/bundler_smoke_tests/**/*",
287+
"test/promises_aplus_adapters/**",
288+
"test/middleware-mockserver.cjs"
284289
],
285290
languageOptions:{
291+
ecmaVersion:"latest",
286292
globals:{
287-
...globals.node,
288-
...globals.es2021
293+
...globals.browser,
294+
...globals.node
289295
}
290296
},
291297
rules:{
292298
...jqueryConfig.rules,
299+
"no-implicit-globals":"error",
293300
strict:["error","global"]
294301
}
295302
},
296303

297304
{
298305
files:[
299-
"build/**/*.js",
300-
"test/data/testinit.js"
306+
"build/**/*.js"
301307
],
302308
languageOptions:{
303309
sourceType:"commonjs"
@@ -313,40 +319,26 @@ export default [
313319
"dist-module/jquery.module.js",
314320
"dist-module/jquery.slim.module.js",
315321
"dist-module/jquery.factory.module.js",
316-
"dist-module/jquery.factory.slim.module.js"
317-
],
318-
319-
languageOptions:{
320-
globals:{
321-
...globals.es2021,
322-
define:false,
323-
module:false,
324-
Symbol:false
325-
}
326-
}
327-
},
328-
329-
{
330-
files:[
322+
"dist-module/jquery.factory.slim.module.js",
331323
"dist/jquery.bundler-require-wrapper.js",
332324
"dist/jquery.bundler-require-wrapper.slim.js",
333325
"dist-module/jquery.node-module-wrapper.js",
334326
"dist-module/jquery.node-module-wrapper.slim.js"
335327
],
336-
337328
languageOptions:{
329+
ecmaVersion:2015,
338330
globals:{
339-
...globals.node,
340-
...globals.es2021,
341331
define:false,
342332
module:false,
343-
Symbol:false
333+
Symbol:false,
334+
window:false
344335
}
345336
},
346-
347337
rules:{
348338
...jqueryConfig.rules,
349339

340+
"no-implicit-globals":"error",
341+
350342
// That is okay for the built version
351343
"no-multiple-empty-lines":"off",
352344

@@ -355,5 +347,49 @@ export default [
355347
"max-len":"off",
356348
"one-var":"off"
357349
}
350+
},
351+
352+
{
353+
files:[
354+
"src/wrapper.js",
355+
"src/wrapper-factory.js",
356+
"dist/jquery.factory.js",
357+
"dist/jquery.factory.slim.js",
358+
"test/middleware-mockserver.cjs"
359+
],
360+
rules:{
361+
"no-implicit-globals":"off"
362+
}
363+
},
364+
365+
{
366+
files:[
367+
"dist/**"
368+
],
369+
languageOptions:{
370+
ecmaVersion:5,
371+
sourceType:"script"
372+
}
373+
},
374+
375+
{
376+
files:[
377+
"dist-module/**"
378+
],
379+
languageOptions:{
380+
ecmaVersion:2015,
381+
sourceType:"module"
382+
}
383+
},
384+
385+
{
386+
files:[
387+
"dist/jquery.bundler-require-wrapper.js",
388+
"dist/jquery.bundler-require-wrapper.slim.js"
389+
],
390+
languageOptions:{
391+
ecmaVersion:2015,
392+
sourceType:"commonjs"
393+
}
358394
}
359395
];

‎test/bundler_smoke_tests/run-jsdom-tests.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function runJSDOMTest( { title, folder } ) {
2121

2222
constvirtualConsole=newjsdom.VirtualConsole();
2323
virtualConsole.sendTo(console);
24-
virtualConsole.on("assert",(success,message)=>{
24+
virtualConsole.on("assert",(success)=>{
2525
if(!success){
2626
process.exitCode=1;
2727
}

‎test/data/csp-nonce-external.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global startIframeTest */
2-
31
jQuery(function(){
42
$("body").append("<script nonce='jquery+hardcoded+nonce' src='csp-nonce.js'></script>");
53
});

‎test/data/csp-nonce-globaleval.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global startIframeTest */
2-
31
jQuery(function(){
42
$.globalEval("startIframeTest()",{nonce:"jquery+hardcoded+nonce"});
53
});

‎test/data/csp-nonce.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* global startIframeTest */
2-
31
jQuery(function(){
42
varscript=document.createElement("script");
53
script.setAttribute("nonce","jquery+hardcoded+nonce");

‎test/jquery.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// Use the right jQuery source on the test page (and iframes)
22
(function(){
3-
/* global loadTests: false */
4-
53
vardynamicImportSource,config,src,
64
parentUrl=window.location.protocol+"//"+window.location.host,
75
QUnit=window.QUnit;

‎test/unit/attributes.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ QUnit.test( "attr(String, Object)", function( assert ) {
261261

262262
var$input,$text,$details,
263263
attributeNode,commentNode,textNode,obj,
264-
table,td,j,type,
264+
table,td,j,
265265
check,thrown,button,$radio,$radios,$svg,
266266
div=jQuery("#qunit-fixture div").attr("foo","bar"),
267267
i=0,
@@ -418,7 +418,6 @@ QUnit.test( "attr(String, Object)", function( assert ) {
418418
j.removeAttr("name");
419419

420420
// Type
421-
type=jQuery("#check2").attr("type");
422421
try{
423422
jQuery("#check2").attr("type","hidden");
424423
assert.ok(true,"No exception thrown on input type change");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp