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
14 "test/data/json_obj.js"
22 "test/bundler_smoke_tests/**/*",
23 "test/node_smoke_tests/**",
24 "test/promises_aplus_adapters/**",
25 "test/middleware-mockserver.cjs"
33 ...jqueryConfig.rules,
34 strict: [ "error", "global" ]
46 // The browser env is not enabled on purpose so that code takes
47 // all browser-only globals from window instead of assuming
48 // they're available as globals. This makes it possible to use
49 // jQuery with tools like jsdom which provide a custom window
56 ...jqueryConfig.rules,
57 "import/extensions": [ "error", "always" ],
58 "import/no-cycle": "error",
60 // TODO: Enable this rule when eslint-plugin-import supports
61 // it when using flat config.
62 // See https://github.com/import-js/eslint-plugin-import/issues/2556
64 // "import/no-unused-modules": [
67 // unusedExports: true,
69 // // When run via WebStorm, the root path against which these paths
70 // // are resolved is the path where this ESLint config file lies,
71 // // i.e. `src`. When run via the command line, it's usually the root
72 // // folder of the jQuery repository. This pattern intends to catch both.
73 // // Note that we cannot specify two patterns here:
74 // // [ "src/*.js", "*.js" ]
75 // // as they're analyzed individually and the rule crashes if a pattern
76 // // cannot be matched.
77 // ignoreExports: [ "{src/,}*.js" ]
87 "one-var": [ "error", { var: "always" } ],
88 strict: [ "error", "function" ]
96 "src/wrapper-factory.js",
97 "src/wrapper-factory-esm.js"
105 "no-unused-vars": "off",
111 // This makes it so code within the wrapper is not indented.
113 "Program > FunctionDeclaration > *"
123 "src/wrapper-factory.js"
126 sourceType: "script",
134 files: [ "src/wrapper.js" ],
141 // This makes it so code within the wrapper is not indented.
143 "Program > ExpressionStatement > CallExpression > :last-child > *"
151 files: [ "src/exports/amd.js" ],
165 "test/data/jquery-3.7.1.js",
166 "test/data/badcall.js",
167 "test/data/badjson.js",
168 "test/data/support/csp.js",
169 "test/data/support/getComputedSupport.js",
170 "test/data/core/jquery-iterability-transpiled.js"
182 createDashboardXML: false,
183 createWithFriesXML: false,
184 createXMLFragment: false,
185 includesModule: false,
186 moduleTeardown: false,
197 originaljQuery: true,
205 ...jqueryConfig.rules,
206 strict: [ "error", "function" ],
208 // See https://github.com/eslint/eslint/issues/2342
209 "no-unused-vars": "off",
220 "test/runner/**/*.js"
229 ...jqueryConfig.rules
234 files: [ "test/runner/listeners.js" ],
243 "test/data/testrunner.js",
244 "test/data/core/jquery-iterability-transpiled-es6.js"
253 "test/unit/deferred.js"
257 // Deferred tests set strict mode for certain tests
264 "test/bundler_smoke_tests/**",
265 "test/node_smoke_tests/**",
266 "test/promises_aplus_adapters/**",
267 "test/middleware-mockserver.cjs"
276 strict: [ "error", "global" ]
283 "test/data/testinit.js"
292 ...jqueryConfig.rules,
293 strict: [ "error", "global" ]
300 "test/data/testinit.js"
303 sourceType: "commonjs"
310 "dist/jquery.slim.js",
311 "dist/jquery.factory.js",
312 "dist/jquery.factory.slim.js",
313 "dist-module/jquery.module.js",
314 "dist-module/jquery.slim.module.js",
315 "dist-module/jquery.factory.module.js",
316 "dist-module/jquery.factory.slim.module.js"
331 "dist/jquery.bundler-require-wrapper.js",
332 "dist/jquery.bundler-require-wrapper.slim.js",
333 "dist-module/jquery.node-module-wrapper.js",
334 "dist-module/jquery.node-module-wrapper.slim.js"
348 ...jqueryConfig.rules,
350 // That is okay for the built version
351 "no-multiple-empty-lines": "off",
353 // When custom compilation is used, the version string
354 // can get large. Accept that in the built version.