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" ]
92 files: [ "src/wrapper.js" ],
101 "no-unused-vars": "off",
107 // This makes it so code within the wrapper is not indented.
109 "Program > ExpressionStatement > CallExpression > :last-child > *"
117 files: [ "src/wrapper-esm.js" ],
124 "no-unused-vars": "off",
130 // This makes it so code within the wrapper is not indented.
132 "Program > FunctionDeclaration > *"
140 files: [ "src/exports/amd.js" ],
154 "test/data/jquery-1.9.1.js",
155 "test/data/badcall.js",
156 "test/data/badjson.js",
157 "test/data/support/csp.js",
158 "test/data/support/getComputedSupport.js",
159 "test/data/core/jquery-iterability-transpiled.js"
171 createDashboardXML: false,
172 createWithFriesXML: false,
173 createXMLFragment: false,
174 includesModule: false,
175 moduleTeardown: false,
186 originaljQuery: true,
194 ...jqueryConfig.rules,
195 strict: [ "error", "function" ],
197 // See https://github.com/eslint/eslint/issues/2342
198 "no-unused-vars": "off",
209 "test/data/testrunner.js",
210 "test/data/core/jquery-iterability-transpiled-es6.js"
219 "test/unit/deferred.js"
223 // Deferred tests set strict mode for certain tests
230 "test/node_smoke_tests/commonjs/**",
231 "test/node_smoke_tests/module/**",
232 "test/promises_aplus_adapters/**",
233 "test/middleware-mockserver.cjs"
242 strict: [ "error", "global" ]
249 "test/data/testinit.js",
250 "test/data/testinit-jsdom.js"
259 ...jqueryConfig.rules,
260 strict: [ "error", "global" ]
267 "test/data/testinit.js",
268 "test/data/testinit-jsdom.js"
271 sourceType: "commonjs"
278 "dist/jquery.slim.js",
279 "dist-module/jquery.module.js",
280 "dist-module/jquery.slim.module.js"
294 ...jqueryConfig.rules,
296 // That is okay for the built version
297 "no-multiple-empty-lines": "off",
299 // When custom compilation is used, the version string
300 // can get large. Accept that in the built version.