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",
15 "test/data/jquery-*.js"
28 // The browser env is not enabled on purpose so that code takes
29 // all browser-only globals from window instead of assuming
30 // they're available as globals. This makes it possible to use
31 // jQuery with tools like jsdom which provide a custom window
38 ...jqueryConfig.rules,
39 "import/extensions": [ "error", "always" ],
40 "import/no-cycle": "error",
42 // TODO: Enable this rule when eslint-plugin-import supports
43 // it when using flat config.
44 // See https://github.com/import-js/eslint-plugin-import/issues/2556
46 // "import/no-unused-modules": [
49 // unusedExports: true,
51 // // When run via WebStorm, the root path against which these paths
52 // // are resolved is the path where this ESLint config file lies,
53 // // i.e. `src`. When run via the command line, it's usually the root
54 // // folder of the jQuery repository. This pattern intends to catch both.
55 // // Note that we cannot specify two patterns here:
56 // // [ "src/*.js", "*.js" ]
57 // // as they're analyzed individually and the rule crashes if a pattern
58 // // cannot be matched.
59 // ignoreExports: [ "{src/,}*.js" ]
69 "no-implicit-globals": "error",
72 { caughtErrorsIgnorePattern: "^_" }
74 "one-var": [ "error", { var: "always" } ],
75 strict: [ "error", "function" ]
83 "src/wrapper-factory.js",
84 "src/wrapper-factory-esm.js"
92 "no-unused-vars": "off",
98 // This makes it so code within the wrapper is not indented.
100 "Program > FunctionDeclaration > *"
110 "src/wrapper-factory.js"
113 sourceType: "script",
121 files: [ "src/wrapper.js" ],
128 // This makes it so code within the wrapper is not indented.
130 "Program > ExpressionStatement > CallExpression > :last-child > *"
138 files: [ "src/exports/amd.js" ],
151 "test/integration/**",
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"
163 sourceType: "script",
173 createDashboardXML: false,
174 createWithFriesXML: false,
175 createXMLFragment: false,
176 includesModule: false,
177 moduleTeardown: false,
188 supportjQuery: false,
189 originaljQuery: false,
196 ...jqueryConfig.rules,
200 { args: "after-used", argsIgnorePattern: "^_" }
215 // Core has several cases where unused vars are expected
216 "no-unused-vars": "off"
222 "test/runner/**/*.js"
225 ecmaVersion: "latest",
231 ...jqueryConfig.rules
236 files: [ "test/runner/listeners.js" ],
239 sourceType: "script",
250 "test/data/testinit.js",
251 "test/data/testrunner.js",
252 "test/data/core/jquery-iterability-transpiled-es6.js"
256 sourceType: "script",
262 ...jqueryConfig.rules,
263 strict: [ "error", "function" ]
269 "test/data/testinit.js"
272 strict: [ "error", "global" ]
278 "test/unit/deferred.js"
282 // Deferred tests set strict mode for certain tests
292 "test/node_smoke_tests/**",
293 "test/bundler_smoke_tests/**/*",
294 "test/promises_aplus_adapters/**",
295 "test/middleware-mockserver.cjs"
298 ecmaVersion: "latest",
305 ...jqueryConfig.rules,
306 "no-implicit-globals": "error",
309 { caughtErrorsIgnorePattern: "^_" }
311 strict: [ "error", "global" ]
318 "dist/jquery.slim.js",
319 "dist/jquery.factory.js",
320 "dist/jquery.factory.slim.js",
321 "dist-module/jquery.module.js",
322 "dist-module/jquery.slim.module.js",
323 "dist-module/jquery.factory.module.js",
324 "dist-module/jquery.factory.slim.module.js",
325 "dist/wrappers/*.js",
326 "dist-module/wrappers/*.js"
338 ...jqueryConfig.rules,
340 "no-implicit-globals": "error",
342 // That is okay for the built version
343 "no-multiple-empty-lines": "off",
347 { caughtErrorsIgnorePattern: "^_" }
350 // When custom compilation is used, the version string
351 // can get large. Accept that in the built version.
359 "dist/jquery.slim.js",
360 "dist/jquery.factory.slim.js",
361 "dist-module/jquery.slim.module.js",
362 "dist-module/jquery.factory.slim.module.js"
366 // Rollup is now smart enough to remove the use
367 // of parameters if the argument is not passed
368 // anywhere in the build.
369 // The removal of effects in the slim build
370 // results in some parameters not being used,
371 // which can be safely ignored.
382 "src/wrapper-factory.js",
383 "dist/jquery.factory.js",
384 "dist/jquery.factory.slim.js",
385 "test/middleware-mockserver.cjs"
388 "no-implicit-globals": "off"
418 sourceType: "commonjs"