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",
171 createDashboardXML
: false,
172 createWithFriesXML
: false,
173 createXMLFragment
: false,
174 includesModule
: false,
175 moduleTeardown
: false,
186 supportjQuery
: false,
187 originaljQuery
: false,
194 ...jqueryConfig
.rules
,
198 { args
: "after-used", argsIgnorePattern
: "^_" }
213 // Core has several cases where unused vars are expected
214 "no-unused-vars": "off"
220 "test/runner/**/*.js"
223 ecmaVersion
: "latest",
229 ...jqueryConfig
.rules
234 files
: [ "test/runner/listeners.js" ],
237 sourceType
: "script",
248 "test/data/testinit.js",
249 "test/data/testrunner.js",
250 "test/data/core/jquery-iterability-transpiled-es6.js"
254 sourceType
: "script",
260 ...jqueryConfig
.rules
,
261 strict
: [ "error", "function" ]
267 "test/data/testinit.js"
270 strict
: [ "error", "global" ]
276 "test/unit/deferred.js"
280 // Deferred tests set strict mode for certain tests
290 "test/node_smoke_tests/**",
291 "test/bundler_smoke_tests/**/*",
292 "test/promises_aplus_adapters/**",
293 "test/middleware-mockserver.cjs"
296 ecmaVersion
: "latest",
303 ...jqueryConfig
.rules
,
304 "no-implicit-globals": "error",
307 { caughtErrorsIgnorePattern
: "^_" }
309 strict
: [ "error", "global" ]
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/wrappers/*.js",
324 "dist-module/wrappers/*.js"
336 ...jqueryConfig
.rules
,
338 "no-implicit-globals": "error",
340 // That is okay for the built version
341 "no-multiple-empty-lines": "off",
345 { caughtErrorsIgnorePattern
: "^_" }
348 // When custom compilation is used, the version string
349 // can get large. Accept that in the built version.
357 "dist/jquery.slim.js",
358 "dist/jquery.factory.slim.js",
359 "dist-module/jquery.slim.module.js",
360 "dist-module/jquery.factory.slim.module.js"
364 // Rollup is now smart enough to remove the use
365 // of parameters if the argument is not passed
366 // anywhere in the build.
367 // The removal of effects in the slim build
368 // results in some parameters not being used,
369 // which can be safely ignored.
380 "src/wrapper-factory.js",
381 "dist/jquery.factory.js",
382 "dist/jquery.factory.slim.js",
383 "test/middleware-mockserver.cjs"
386 "no-implicit-globals": "off"
416 sourceType
: "commonjs"