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"
27 // The browser env is not enabled on purpose so that code takes
28 // all browser-only globals from window instead of assuming
29 // they're available as globals. This makes it possible to use
30 // jQuery with tools like jsdom which provide a custom window
37 ...jqueryConfig.rules,
38 "import/extensions": [ "error", "always" ],
39 "import/no-cycle": "error",
41 // TODO: Enable this rule when eslint-plugin-import supports
42 // it when using flat config.
43 // See https://github.com/import-js/eslint-plugin-import/issues/2556
45 // "import/no-unused-modules": [
48 // unusedExports: true,
50 // // When run via WebStorm, the root path against which these paths
51 // // are resolved is the path where this ESLint config file lies,
52 // // i.e. `src`. When run via the command line, it's usually the root
53 // // folder of the jQuery repository. This pattern intends to catch both.
54 // // Note that we cannot specify two patterns here:
55 // // [ "src/*.js", "*.js" ]
56 // // as they're analyzed individually and the rule crashes if a pattern
57 // // cannot be matched.
58 // ignoreExports: [ "{src/,}*.js" ]
68 "no-implicit-globals": "error",
69 "one-var": [ "error", { var: "always" } ],
70 strict: [ "error", "function" ]
78 "src/wrapper-factory.js",
79 "src/wrapper-factory-esm.js"
87 "no-unused-vars": "off",
93 // This makes it so code within the wrapper is not indented.
95 "Program > FunctionDeclaration > *"
105 "src/wrapper-factory.js"
108 sourceType: "script",
116 files: [ "src/wrapper.js" ],
123 // This makes it so code within the wrapper is not indented.
125 "Program > ExpressionStatement > CallExpression > :last-child > *"
133 files: [ "src/exports/amd.js" ],
146 "test/integration/**",
150 "test/data/jquery-3.7.1.js",
151 "test/data/badcall.js",
152 "test/data/badjson.js",
153 "test/data/support/csp.js",
154 "test/data/support/getComputedSupport.js",
155 "test/data/core/jquery-iterability-transpiled.js"
159 sourceType: "script",
167 createDashboardXML: false,
168 createWithFriesXML: false,
169 createXMLFragment: false,
170 includesModule: false,
171 moduleTeardown: false,
182 supportjQuery: false,
183 originaljQuery: false,
190 ...jqueryConfig.rules,
194 { args: "after-used", argsIgnorePattern: "^_" }
209 // Core has several cases where unused vars are expected
210 "no-unused-vars": "off"
216 "test/runner/**/*.js"
219 ecmaVersion: "latest",
225 ...jqueryConfig.rules
230 files: [ "test/runner/listeners.js" ],
233 sourceType: "script",
244 "test/data/testinit.js",
245 "test/data/testrunner.js",
246 "test/data/core/jquery-iterability-transpiled-es6.js"
250 sourceType: "script",
256 ...jqueryConfig.rules,
257 strict: [ "error", "function" ]
263 "test/data/testinit.js"
266 strict: [ "error", "global" ]
272 "test/unit/deferred.js"
276 // Deferred tests set strict mode for certain tests
285 "test/node_smoke_tests/**",
286 "test/bundler_smoke_tests/**/*",
287 "test/promises_aplus_adapters/**",
288 "test/middleware-mockserver.cjs"
291 ecmaVersion: "latest",
298 ...jqueryConfig.rules,
299 "no-implicit-globals": "error",
300 strict: [ "error", "global" ]
309 sourceType: "commonjs"
316 "dist/jquery.slim.js",
317 "dist/jquery.factory.js",
318 "dist/jquery.factory.slim.js",
319 "dist-module/jquery.module.js",
320 "dist-module/jquery.slim.module.js",
321 "dist-module/jquery.factory.module.js",
322 "dist-module/jquery.factory.slim.module.js",
323 "dist/jquery.bundler-require-wrapper.js",
324 "dist/jquery.bundler-require-wrapper.slim.js",
325 "dist-module/jquery.node-module-wrapper.js",
326 "dist-module/jquery.node-module-wrapper.slim.js"
338 ...jqueryConfig.rules,
340 "no-implicit-globals": "error",
342 // That is okay for the built version
343 "no-multiple-empty-lines": "off",
345 // When custom compilation is used, the version string
346 // can get large. Accept that in the built version.
355 "src/wrapper-factory.js",
356 "dist/jquery.factory.js",
357 "dist/jquery.factory.slim.js",
358 "test/middleware-mockserver.cjs"
361 "no-implicit-globals": "off"
387 "dist/jquery.bundler-require-wrapper.js",
388 "dist/jquery.bundler-require-wrapper.slim.js"
392 sourceType: "commonjs"