@@ -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{
4020files :[ "src/**" ] ,
4121plugins :{
4222import :importPlugin
4323} ,
4424languageOptions :{
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 [
8465outerIIFEBody :0
8566}
8667] ,
68+ "no-implicit-globals" :"error" ,
8769"one-var" :[ "error" , { var :"always" } ] ,
8870strict :[ "error" , "function" ]
8971}
@@ -159,7 +141,10 @@ export default [
159141// Tests
160142{
161143files :[
162- "test/**"
144+ "test/*" ,
145+ "test/data/**" ,
146+ "test/integration/**" ,
147+ "test/unit/**"
163148] ,
164149ignores :[
165150"test/data/jquery-3.7.1.js" ,
@@ -170,11 +155,11 @@ export default [
170155"test/data/core/jquery-iterability-transpiled.js"
171156] ,
172157languageOptions :{
158+ ecmaVersion :2015 ,
159+ sourceType :"script" ,
173160globals :{
174161...globals . browser ,
175162require :false ,
176- Promise :false ,
177- Symbol :false ,
178163trustedTypes :false ,
179164QUnit :false ,
180165ajaxTest :false ,
@@ -186,32 +171,43 @@ export default [
186171moduleTeardown :false ,
187172url :false ,
188173q :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} ,
204189rules :{
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] ,
222218languageOptions :{
219+ ecmaVersion :"latest" ,
223220globals :{
224221...globals . node
225- } ,
226- sourceType :"module"
222+ }
227223} ,
228224rules :{
229225...jqueryConfig . rules
@@ -234,70 +230,80 @@ export default [
234230files :[ "test/runner/listeners.js" ] ,
235231languageOptions :{
236232ecmaVersion :5 ,
237- sourceType :"script"
233+ sourceType :"script" ,
234+ globals :{
235+ ...globals . browser ,
236+ QUnit :false ,
237+ Symbol :false
238+ }
238239}
239240} ,
240241
241242{
242243files :[
244+ "test/data/testinit.js" ,
243245"test/data/testrunner.js" ,
244246"test/data/core/jquery-iterability-transpiled-es6.js"
245247] ,
246248languageOptions :{
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{
252262files :[
253- "test/unit/deferred .js"
263+ "test/data/testinit .js"
254264] ,
255265rules :{
256-
257- // Deferred tests set strict mode for certain tests
258- strict :"off"
266+ strict :[ "error" , "global" ]
259267}
260268} ,
261269
262270{
263271files :[
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- } ,
275274rules :{
276- strict :[ "error" , "global" ]
275+
276+ // Deferred tests set strict mode for certain tests
277+ strict :"off"
277278}
278279} ,
279280
280281{
281282files :[
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] ,
285290languageOptions :{
291+ ecmaVersion :"latest" ,
286292globals :{
287- ...globals . node ,
288- ...globals . es2021
293+ ...globals . browser ,
294+ ...globals . node
289295}
290296} ,
291297rules :{
292298...jqueryConfig . rules ,
299+ "no-implicit-globals" :"error" ,
293300strict :[ "error" , "global" ]
294301}
295302} ,
296303
297304{
298305files :[
299- "build/**/*.js" ,
300- "test/data/testinit.js"
306+ "build/**/*.js"
301307] ,
302308languageOptions :{
303309sourceType :"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-
337328languageOptions :{
329+ ecmaVersion :2015 ,
338330globals :{
339- ...globals . node ,
340- ...globals . es2021 ,
341331define :false ,
342332module :false ,
343- Symbol :false
333+ Symbol :false ,
334+ window :false
344335}
345336} ,
346-
347337rules :{
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] ;