1 import jqueryConfig from "eslint-config-jquery";
2 import importPlugin from "eslint-plugin-import";
3 import globals from "globals";
8 // Only global ignores will bypass the parser
9 // and avoid JS parsing errors
10 // See https://github.com/eslint/eslint/discussions/17412
13 "test/data/json_obj.js"
21 "test/node_smoke_tests/commonjs/**",
22 "test/node_smoke_tests/module/**",
23 "test/promises_aplus_adapters/**",
24 "test/middleware-mockserver.cjs"
32 ...jqueryConfig.rules,
33 strict: [ "error", "global" ]
45 // The browser env is not enabled on purpose so that code takes
46 // all browser-only globals from window instead of assuming
47 // they're available as globals. This makes it possible to use
48 // jQuery with tools like jsdom which provide a custom window
55 ...jqueryConfig.rules,
56 "import/extensions": [ "error", "always" ],
57 "import/no-cycle": "error",
59 // TODO: Enable this rule when eslint-plugin-import supports
60 // it when using flat config.
61 // See https://github.com/import-js/eslint-plugin-import/issues/2556
63 // "import/no-unused-modules": [
66 // unusedExports: true,
68 // // When run via WebStorm, the root path against which these paths
69 // // are resolved is the path where this ESLint config file lies,
70 // // i.e. `src`. When run via the command line, it's usually the root
71 // // folder of the jQuery repository. This pattern intends to catch both.
72 // // Note that we cannot specify two patterns here:
73 // // [ "src/*.js", "*.js" ]
74 // // as they're analyzed individually and the rule crashes if a pattern
75 // // cannot be matched.
76 // ignoreExports: [ "{src/,}*.js" ]
86 "one-var": [ "error", { var: "always" } ],
87 strict: [ "error", "function" ]
95 "src/wrapper-factory.js",
96 "src/wrapper-factory-esm.js"
104 "no-unused-vars": "off",
110 // This makes it so code within the wrapper is not indented.
112 "Program > FunctionDeclaration > *"
122 "src/wrapper-factory.js"
125 sourceType: "script",
133 files: [ "src/wrapper.js" ],
140 // This makes it so code within the wrapper is not indented.
142 "Program > ExpressionStatement > CallExpression > :last-child > *"
150 files: [ "src/exports/amd.js" ],
164 "test/data/jquery-1.9.1.js",
165 "test/data/badcall.js",
166 "test/data/badjson.js",
167 "test/data/support/csp.js",
168 "test/data/support/getComputedSupport.js",
169 "test/data/core/jquery-iterability-transpiled.js"
181 createDashboardXML: false,
182 createWithFriesXML: false,
183 createXMLFragment: false,
184 includesModule: false,
185 moduleTeardown: false,
196 originaljQuery: true,
204 ...jqueryConfig.rules,
205 strict: [ "error", "function" ],
207 // See https://github.com/eslint/eslint/issues/2342
208 "no-unused-vars": "off",
219 "test/data/testrunner.js",
220 "test/data/core/jquery-iterability-transpiled-es6.js"
229 "test/unit/deferred.js"
233 // Deferred tests set strict mode for certain tests
240 "test/node_smoke_tests/commonjs/**",
241 "test/node_smoke_tests/module/**",
242 "test/promises_aplus_adapters/**",
243 "test/middleware-mockserver.cjs"
252 strict: [ "error", "global" ]
259 "test/data/testinit.js",
260 "test/data/testinit-jsdom.js"
269 ...jqueryConfig.rules,
270 strict: [ "error", "global" ]
277 "test/data/testinit.js",
278 "test/data/testinit-jsdom.js"
281 sourceType: "commonjs"
288 "dist/jquery.slim.js",
289 "dist/jquery.factory.js",
290 "dist/jquery.factory.slim.js",
291 "dist-module/jquery.module.js",
292 "dist-module/jquery.slim.module.js",
293 "dist-module/jquery.factory.module.js",
294 "dist-module/jquery.factory.slim.module.js"
308 ...jqueryConfig.rules,
310 // That is okay for the built version
311 "no-multiple-empty-lines": "off",
313 // When custom compilation is used, the version string
314 // can get large. Accept that in the built version.