eslint 9.23.0 → 9.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cli-engine/cli-engine.js +2 -2
- package/lib/cli.js +98 -1
- package/lib/config/config-loader.js +108 -34
- package/lib/config/flat-config-helpers.js +7 -4
- package/lib/eslint/eslint-helpers.js +50 -5
- package/lib/eslint/eslint.js +17 -53
- package/lib/eslint/legacy-eslint.js +1 -1
- package/lib/linter/code-path-analysis/code-path-state.js +1 -1
- package/lib/linter/linter.js +1 -1
- package/lib/linter/rules.js +1 -1
- package/lib/options.js +29 -0
- package/lib/rule-tester/rule-tester.js +1 -1
- package/lib/rules/accessor-pairs.js +1 -1
- package/lib/rules/array-bracket-newline.js +1 -1
- package/lib/rules/array-bracket-spacing.js +1 -1
- package/lib/rules/array-callback-return.js +1 -1
- package/lib/rules/array-element-newline.js +1 -1
- package/lib/rules/arrow-body-style.js +1 -1
- package/lib/rules/arrow-parens.js +1 -1
- package/lib/rules/arrow-spacing.js +1 -1
- package/lib/rules/block-scoped-var.js +1 -1
- package/lib/rules/block-spacing.js +1 -1
- package/lib/rules/brace-style.js +1 -1
- package/lib/rules/callback-return.js +1 -1
- package/lib/rules/camelcase.js +1 -1
- package/lib/rules/capitalized-comments.js +1 -1
- package/lib/rules/class-methods-use-this.js +46 -2
- package/lib/rules/comma-dangle.js +1 -1
- package/lib/rules/comma-spacing.js +1 -1
- package/lib/rules/comma-style.js +1 -1
- package/lib/rules/complexity.js +1 -1
- package/lib/rules/computed-property-spacing.js +1 -1
- package/lib/rules/consistent-return.js +1 -1
- package/lib/rules/consistent-this.js +1 -1
- package/lib/rules/constructor-super.js +1 -1
- package/lib/rules/curly.js +1 -1
- package/lib/rules/default-case-last.js +1 -1
- package/lib/rules/default-case.js +1 -1
- package/lib/rules/default-param-last.js +1 -1
- package/lib/rules/dot-location.js +1 -1
- package/lib/rules/dot-notation.js +1 -1
- package/lib/rules/eol-last.js +1 -1
- package/lib/rules/eqeqeq.js +1 -1
- package/lib/rules/for-direction.js +1 -1
- package/lib/rules/func-call-spacing.js +1 -1
- package/lib/rules/func-name-matching.js +1 -1
- package/lib/rules/func-names.js +1 -1
- package/lib/rules/func-style.js +1 -1
- package/lib/rules/function-call-argument-newline.js +1 -1
- package/lib/rules/function-paren-newline.js +1 -1
- package/lib/rules/generator-star-spacing.js +1 -1
- package/lib/rules/getter-return.js +1 -1
- package/lib/rules/global-require.js +1 -1
- package/lib/rules/grouped-accessor-pairs.js +1 -1
- package/lib/rules/guard-for-in.js +1 -1
- package/lib/rules/handle-callback-err.js +1 -1
- package/lib/rules/id-blacklist.js +1 -1
- package/lib/rules/id-denylist.js +1 -1
- package/lib/rules/id-length.js +1 -1
- package/lib/rules/id-match.js +1 -1
- package/lib/rules/implicit-arrow-linebreak.js +1 -1
- package/lib/rules/indent-legacy.js +1 -1
- package/lib/rules/indent.js +1 -1
- package/lib/rules/init-declarations.js +22 -1
- package/lib/rules/jsx-quotes.js +1 -1
- package/lib/rules/key-spacing.js +1 -1
- package/lib/rules/keyword-spacing.js +1 -1
- package/lib/rules/line-comment-position.js +1 -1
- package/lib/rules/linebreak-style.js +1 -1
- package/lib/rules/lines-around-comment.js +1 -1
- package/lib/rules/lines-around-directive.js +1 -1
- package/lib/rules/lines-between-class-members.js +1 -1
- package/lib/rules/logical-assignment-operators.js +1 -1
- package/lib/rules/max-classes-per-file.js +1 -1
- package/lib/rules/max-depth.js +1 -1
- package/lib/rules/max-len.js +1 -1
- package/lib/rules/max-lines-per-function.js +1 -1
- package/lib/rules/max-lines.js +1 -1
- package/lib/rules/max-nested-callbacks.js +1 -1
- package/lib/rules/max-params.js +1 -1
- package/lib/rules/max-statements-per-line.js +1 -1
- package/lib/rules/max-statements.js +1 -1
- package/lib/rules/multiline-comment-style.js +1 -1
- package/lib/rules/multiline-ternary.js +1 -1
- package/lib/rules/new-cap.js +1 -1
- package/lib/rules/new-parens.js +1 -1
- package/lib/rules/newline-after-var.js +1 -1
- package/lib/rules/newline-before-return.js +1 -1
- package/lib/rules/newline-per-chained-call.js +1 -1
- package/lib/rules/no-alert.js +1 -1
- package/lib/rules/no-array-constructor.js +4 -1
- package/lib/rules/no-async-promise-executor.js +1 -1
- package/lib/rules/no-await-in-loop.js +1 -1
- package/lib/rules/no-bitwise.js +1 -1
- package/lib/rules/no-buffer-constructor.js +1 -1
- package/lib/rules/no-caller.js +1 -1
- package/lib/rules/no-case-declarations.js +1 -1
- package/lib/rules/no-catch-shadow.js +1 -1
- package/lib/rules/no-class-assign.js +1 -1
- package/lib/rules/no-compare-neg-zero.js +1 -1
- package/lib/rules/no-cond-assign.js +1 -1
- package/lib/rules/no-confusing-arrow.js +1 -1
- package/lib/rules/no-console.js +1 -1
- package/lib/rules/no-const-assign.js +1 -1
- package/lib/rules/no-constant-binary-expression.js +2 -2
- package/lib/rules/no-constant-condition.js +1 -1
- package/lib/rules/no-constructor-return.js +1 -1
- package/lib/rules/no-continue.js +1 -1
- package/lib/rules/no-control-regex.js +1 -1
- package/lib/rules/no-debugger.js +1 -1
- package/lib/rules/no-delete-var.js +1 -1
- package/lib/rules/no-div-regex.js +1 -1
- package/lib/rules/no-dupe-args.js +1 -1
- package/lib/rules/no-dupe-class-members.js +10 -1
- package/lib/rules/no-dupe-else-if.js +1 -1
- package/lib/rules/no-dupe-keys.js +1 -1
- package/lib/rules/no-duplicate-case.js +1 -1
- package/lib/rules/no-duplicate-imports.js +1 -1
- package/lib/rules/no-else-return.js +1 -1
- package/lib/rules/no-empty-character-class.js +1 -1
- package/lib/rules/no-empty-function.js +1 -1
- package/lib/rules/no-empty-pattern.js +1 -1
- package/lib/rules/no-empty-static-block.js +1 -1
- package/lib/rules/no-empty.js +1 -1
- package/lib/rules/no-eq-null.js +1 -1
- package/lib/rules/no-eval.js +1 -1
- package/lib/rules/no-ex-assign.js +1 -1
- package/lib/rules/no-extend-native.js +1 -1
- package/lib/rules/no-extra-bind.js +1 -1
- package/lib/rules/no-extra-boolean-cast.js +1 -1
- package/lib/rules/no-extra-label.js +1 -1
- package/lib/rules/no-extra-parens.js +1 -1
- package/lib/rules/no-extra-semi.js +1 -1
- package/lib/rules/no-fallthrough.js +1 -1
- package/lib/rules/no-floating-decimal.js +1 -1
- package/lib/rules/no-func-assign.js +1 -1
- package/lib/rules/no-global-assign.js +1 -1
- package/lib/rules/no-implicit-coercion.js +1 -1
- package/lib/rules/no-implicit-globals.js +1 -1
- package/lib/rules/no-implied-eval.js +1 -1
- package/lib/rules/no-import-assign.js +1 -1
- package/lib/rules/no-inline-comments.js +1 -1
- package/lib/rules/no-inner-declarations.js +1 -1
- package/lib/rules/no-invalid-regexp.js +1 -1
- package/lib/rules/no-invalid-this.js +1 -1
- package/lib/rules/no-irregular-whitespace.js +1 -1
- package/lib/rules/no-iterator.js +1 -1
- package/lib/rules/no-label-var.js +1 -1
- package/lib/rules/no-labels.js +1 -1
- package/lib/rules/no-lone-blocks.js +1 -1
- package/lib/rules/no-lonely-if.js +1 -1
- package/lib/rules/no-loop-func.js +8 -4
- package/lib/rules/no-loss-of-precision.js +3 -1
- package/lib/rules/no-magic-numbers.js +1 -1
- package/lib/rules/no-misleading-character-class.js +1 -1
- package/lib/rules/no-mixed-operators.js +1 -1
- package/lib/rules/no-mixed-requires.js +1 -1
- package/lib/rules/no-mixed-spaces-and-tabs.js +1 -1
- package/lib/rules/no-multi-assign.js +1 -1
- package/lib/rules/no-multi-spaces.js +1 -1
- package/lib/rules/no-multi-str.js +1 -1
- package/lib/rules/no-multiple-empty-lines.js +1 -1
- package/lib/rules/no-native-reassign.js +1 -1
- package/lib/rules/no-negated-condition.js +1 -1
- package/lib/rules/no-negated-in-lhs.js +1 -1
- package/lib/rules/no-nested-ternary.js +1 -1
- package/lib/rules/no-new-func.js +1 -1
- package/lib/rules/no-new-native-nonconstructor.js +1 -1
- package/lib/rules/no-new-object.js +1 -1
- package/lib/rules/no-new-require.js +1 -1
- package/lib/rules/no-new-symbol.js +1 -1
- package/lib/rules/no-new-wrappers.js +1 -1
- package/lib/rules/no-new.js +1 -1
- package/lib/rules/no-nonoctal-decimal-escape.js +1 -1
- package/lib/rules/no-obj-calls.js +1 -1
- package/lib/rules/no-object-constructor.js +1 -1
- package/lib/rules/no-octal-escape.js +1 -1
- package/lib/rules/no-octal.js +1 -1
- package/lib/rules/no-param-reassign.js +1 -1
- package/lib/rules/no-path-concat.js +1 -1
- package/lib/rules/no-plusplus.js +1 -1
- package/lib/rules/no-process-env.js +1 -1
- package/lib/rules/no-process-exit.js +1 -1
- package/lib/rules/no-promise-executor-return.js +1 -1
- package/lib/rules/no-proto.js +1 -1
- package/lib/rules/no-prototype-builtins.js +1 -1
- package/lib/rules/no-redeclare.js +1 -1
- package/lib/rules/no-regex-spaces.js +1 -1
- package/lib/rules/no-restricted-exports.js +1 -1
- package/lib/rules/no-restricted-globals.js +1 -1
- package/lib/rules/no-restricted-imports.js +1 -1
- package/lib/rules/no-restricted-modules.js +1 -1
- package/lib/rules/no-restricted-properties.js +1 -1
- package/lib/rules/no-restricted-syntax.js +1 -1
- package/lib/rules/no-return-assign.js +1 -1
- package/lib/rules/no-return-await.js +1 -1
- package/lib/rules/no-script-url.js +1 -1
- package/lib/rules/no-self-assign.js +1 -1
- package/lib/rules/no-self-compare.js +1 -1
- package/lib/rules/no-sequences.js +1 -1
- package/lib/rules/no-setter-return.js +1 -1
- package/lib/rules/no-shadow-restricted-names.js +1 -1
- package/lib/rules/no-shadow.js +1 -1
- package/lib/rules/no-spaced-func.js +1 -1
- package/lib/rules/no-sparse-arrays.js +1 -1
- package/lib/rules/no-sync.js +1 -1
- package/lib/rules/no-tabs.js +1 -1
- package/lib/rules/no-template-curly-in-string.js +1 -1
- package/lib/rules/no-ternary.js +1 -1
- package/lib/rules/no-this-before-super.js +1 -1
- package/lib/rules/no-throw-literal.js +1 -1
- package/lib/rules/no-trailing-spaces.js +1 -1
- package/lib/rules/no-undef-init.js +1 -1
- package/lib/rules/no-undef.js +1 -1
- package/lib/rules/no-undefined.js +1 -1
- package/lib/rules/no-underscore-dangle.js +1 -1
- package/lib/rules/no-unexpected-multiline.js +1 -1
- package/lib/rules/no-unmodified-loop-condition.js +1 -1
- package/lib/rules/no-unneeded-ternary.js +1 -1
- package/lib/rules/no-unreachable-loop.js +1 -1
- package/lib/rules/no-unreachable.js +1 -1
- package/lib/rules/no-unsafe-finally.js +1 -1
- package/lib/rules/no-unsafe-negation.js +1 -1
- package/lib/rules/no-unsafe-optional-chaining.js +1 -1
- package/lib/rules/no-unused-expressions.js +1 -1
- package/lib/rules/no-unused-labels.js +1 -1
- package/lib/rules/no-unused-private-class-members.js +1 -1
- package/lib/rules/no-unused-vars.js +3 -3
- package/lib/rules/no-use-before-define.js +1 -1
- package/lib/rules/no-useless-assignment.js +1 -1
- package/lib/rules/no-useless-backreference.js +1 -1
- package/lib/rules/no-useless-call.js +1 -1
- package/lib/rules/no-useless-catch.js +1 -1
- package/lib/rules/no-useless-computed-key.js +1 -1
- package/lib/rules/no-useless-concat.js +1 -1
- package/lib/rules/no-useless-constructor.js +1 -1
- package/lib/rules/no-useless-escape.js +1 -1
- package/lib/rules/no-useless-rename.js +1 -1
- package/lib/rules/no-useless-return.js +1 -1
- package/lib/rules/no-var.js +1 -1
- package/lib/rules/no-void.js +1 -1
- package/lib/rules/no-warning-comments.js +1 -1
- package/lib/rules/no-whitespace-before-property.js +1 -1
- package/lib/rules/no-with.js +1 -1
- package/lib/rules/nonblock-statement-body-position.js +1 -1
- package/lib/rules/object-curly-newline.js +1 -1
- package/lib/rules/object-curly-spacing.js +1 -1
- package/lib/rules/object-property-newline.js +1 -1
- package/lib/rules/object-shorthand.js +1 -1
- package/lib/rules/one-var-declaration-per-line.js +1 -1
- package/lib/rules/one-var.js +1 -1
- package/lib/rules/operator-assignment.js +1 -1
- package/lib/rules/operator-linebreak.js +1 -1
- package/lib/rules/padded-blocks.js +1 -1
- package/lib/rules/padding-line-between-statements.js +1 -1
- package/lib/rules/prefer-arrow-callback.js +1 -1
- package/lib/rules/prefer-const.js +1 -1
- package/lib/rules/prefer-destructuring.js +1 -1
- package/lib/rules/prefer-exponentiation-operator.js +1 -1
- package/lib/rules/prefer-named-capture-group.js +1 -1
- package/lib/rules/prefer-numeric-literals.js +1 -1
- package/lib/rules/prefer-object-has-own.js +1 -1
- package/lib/rules/prefer-object-spread.js +1 -1
- package/lib/rules/prefer-promise-reject-errors.js +1 -1
- package/lib/rules/prefer-reflect.js +1 -1
- package/lib/rules/prefer-regex-literals.js +1 -1
- package/lib/rules/prefer-rest-params.js +1 -1
- package/lib/rules/prefer-spread.js +1 -1
- package/lib/rules/prefer-template.js +1 -1
- package/lib/rules/quote-props.js +1 -1
- package/lib/rules/quotes.js +1 -1
- package/lib/rules/radix.js +1 -1
- package/lib/rules/require-atomic-updates.js +1 -1
- package/lib/rules/require-await.js +1 -1
- package/lib/rules/require-unicode-regexp.js +1 -1
- package/lib/rules/require-yield.js +1 -1
- package/lib/rules/rest-spread-spacing.js +1 -1
- package/lib/rules/semi-spacing.js +1 -1
- package/lib/rules/semi-style.js +1 -1
- package/lib/rules/semi.js +1 -1
- package/lib/rules/sort-imports.js +1 -1
- package/lib/rules/sort-keys.js +1 -1
- package/lib/rules/sort-vars.js +1 -1
- package/lib/rules/space-before-blocks.js +1 -1
- package/lib/rules/space-before-function-paren.js +1 -1
- package/lib/rules/space-in-parens.js +1 -1
- package/lib/rules/space-infix-ops.js +1 -1
- package/lib/rules/space-unary-ops.js +1 -1
- package/lib/rules/spaced-comment.js +1 -1
- package/lib/rules/strict.js +1 -1
- package/lib/rules/switch-colon-spacing.js +1 -1
- package/lib/rules/symbol-description.js +1 -1
- package/lib/rules/template-curly-spacing.js +1 -1
- package/lib/rules/template-tag-spacing.js +1 -1
- package/lib/rules/unicode-bom.js +1 -1
- package/lib/rules/use-isnan.js +1 -1
- package/lib/rules/valid-typeof.js +1 -1
- package/lib/rules/vars-on-top.js +1 -1
- package/lib/rules/wrap-iife.js +1 -1
- package/lib/rules/wrap-regex.js +1 -1
- package/lib/rules/yield-star-spacing.js +1 -1
- package/lib/rules/yoda.js +1 -1
- package/lib/services/suppressions-service.js +289 -0
- package/lib/shared/flags.js +4 -0
- package/lib/shared/types.js +4 -27
- package/lib/types/index.d.ts +7 -7
- package/package.json +5 -5
package/README.md
CHANGED
@@ -321,7 +321,7 @@ to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
|
321
321
|
|
322
322
|
<h3>Platinum Sponsors</h3>
|
323
323
|
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
324
|
-
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a
|
324
|
+
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
|
325
325
|
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
|
326
326
|
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
|
327
327
|
<h3>Technology Sponsors</h3>
|
@@ -65,8 +65,8 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
|
|
65
65
|
/** @typedef {import("../shared/types").ParserOptions} ParserOptions */
|
66
66
|
/** @typedef {import("../shared/types").Plugin} Plugin */
|
67
67
|
/** @typedef {import("../shared/types").RuleConf} RuleConf */
|
68
|
-
/** @typedef {import("../
|
69
|
-
/** @typedef {import("../
|
68
|
+
/** @typedef {import("../types").Rule.RuleModule} Rule */
|
69
|
+
/** @typedef {import("../types").ESLint.FormatterFunction} FormatterFunction */
|
70
70
|
/** @typedef {ReturnType<CascadingConfigArrayFactory.getConfigArrayForFile>} ConfigArray */
|
71
71
|
/** @typedef {ReturnType<ConfigArray.extractConfig>} ExtractedConfig */
|
72
72
|
|
package/lib/cli.js
CHANGED
@@ -32,6 +32,8 @@ const {
|
|
32
32
|
Legacy: { naming },
|
33
33
|
} = require("@eslint/eslintrc");
|
34
34
|
const { ModuleImporter } = require("@humanwhocodes/module-importer");
|
35
|
+
const { getCacheFile } = require("./eslint/eslint-helpers");
|
36
|
+
const { SuppressionsService } = require("./services/suppressions-service");
|
35
37
|
const debug = require("debug")("eslint:cli");
|
36
38
|
|
37
39
|
//------------------------------------------------------------------------------
|
@@ -584,6 +586,39 @@ const cli = {
|
|
584
586
|
}
|
585
587
|
}
|
586
588
|
|
589
|
+
if (options.suppressAll && options.suppressRule) {
|
590
|
+
log.error(
|
591
|
+
"The --suppress-all option and the --suppress-rule option cannot be used together.",
|
592
|
+
);
|
593
|
+
return 2;
|
594
|
+
}
|
595
|
+
|
596
|
+
if (options.suppressAll && options.pruneSuppressions) {
|
597
|
+
log.error(
|
598
|
+
"The --suppress-all option and the --prune-suppressions option cannot be used together.",
|
599
|
+
);
|
600
|
+
return 2;
|
601
|
+
}
|
602
|
+
|
603
|
+
if (options.suppressRule && options.pruneSuppressions) {
|
604
|
+
log.error(
|
605
|
+
"The --suppress-rule option and the --prune-suppressions option cannot be used together.",
|
606
|
+
);
|
607
|
+
return 2;
|
608
|
+
}
|
609
|
+
|
610
|
+
if (
|
611
|
+
useStdin &&
|
612
|
+
(options.suppressAll ||
|
613
|
+
options.suppressRule ||
|
614
|
+
options.pruneSuppressions)
|
615
|
+
) {
|
616
|
+
log.error(
|
617
|
+
"The --suppress-all, --suppress-rule, and --prune-suppressions options cannot be used with piped-in code.",
|
618
|
+
);
|
619
|
+
return 2;
|
620
|
+
}
|
621
|
+
|
587
622
|
const ActiveESLint = usingFlatConfig ? ESLint : LegacyESLint;
|
588
623
|
const eslintOptions = await translateOptions(
|
589
624
|
options,
|
@@ -608,6 +643,58 @@ const cli = {
|
|
608
643
|
await ActiveESLint.outputFixes(results);
|
609
644
|
}
|
610
645
|
|
646
|
+
let unusedSuppressions = {};
|
647
|
+
|
648
|
+
if (!useStdin) {
|
649
|
+
const suppressionsFileLocation = getCacheFile(
|
650
|
+
options.suppressionsLocation || "eslint-suppressions.json",
|
651
|
+
process.cwd(),
|
652
|
+
{
|
653
|
+
prefix: "suppressions_",
|
654
|
+
},
|
655
|
+
);
|
656
|
+
|
657
|
+
if (
|
658
|
+
options.suppressionsLocation &&
|
659
|
+
!fs.existsSync(suppressionsFileLocation) &&
|
660
|
+
!options.suppressAll &&
|
661
|
+
!options.suppressRule
|
662
|
+
) {
|
663
|
+
log.error(
|
664
|
+
"The suppressions file does not exist. Please run the command with `--suppress-all` or `--suppress-rule` to create it.",
|
665
|
+
);
|
666
|
+
return 2;
|
667
|
+
}
|
668
|
+
|
669
|
+
if (
|
670
|
+
options.suppressAll ||
|
671
|
+
options.suppressRule ||
|
672
|
+
options.pruneSuppressions ||
|
673
|
+
fs.existsSync(suppressionsFileLocation)
|
674
|
+
) {
|
675
|
+
const suppressions = new SuppressionsService({
|
676
|
+
filePath: suppressionsFileLocation,
|
677
|
+
cwd: process.cwd(),
|
678
|
+
});
|
679
|
+
|
680
|
+
if (options.suppressAll || options.suppressRule) {
|
681
|
+
await suppressions.suppress(results, options.suppressRule);
|
682
|
+
}
|
683
|
+
|
684
|
+
if (options.pruneSuppressions) {
|
685
|
+
await suppressions.prune(results);
|
686
|
+
}
|
687
|
+
|
688
|
+
const suppressionResults = suppressions.applySuppressions(
|
689
|
+
results,
|
690
|
+
await suppressions.load(),
|
691
|
+
);
|
692
|
+
|
693
|
+
results = suppressionResults.results;
|
694
|
+
unusedSuppressions = suppressionResults.unused;
|
695
|
+
}
|
696
|
+
}
|
697
|
+
|
611
698
|
let resultsToPrint = results;
|
612
699
|
|
613
700
|
if (options.quiet) {
|
@@ -648,7 +735,17 @@ const cli = {
|
|
648
735
|
);
|
649
736
|
}
|
650
737
|
|
651
|
-
|
738
|
+
const unusedSuppressionsCount =
|
739
|
+
Object.keys(unusedSuppressions).length;
|
740
|
+
|
741
|
+
if (unusedSuppressionsCount > 0) {
|
742
|
+
log.error(
|
743
|
+
"There are suppressions left that do not occur anymore. Consider re-running the command with `--prune-suppressions`.",
|
744
|
+
);
|
745
|
+
debug(JSON.stringify(unusedSuppressions, null, 2));
|
746
|
+
}
|
747
|
+
|
748
|
+
if (shouldExitForFatalErrors || unusedSuppressionsCount > 0) {
|
652
749
|
return 2;
|
653
750
|
}
|
654
751
|
|
@@ -21,8 +21,10 @@ const { FlatConfigArray } = require("./flat-config-array");
|
|
21
21
|
//-----------------------------------------------------------------------------
|
22
22
|
|
23
23
|
/**
|
24
|
-
* @
|
25
|
-
|
24
|
+
* @import { ConfigData, ConfigData as FlatConfigObject } from "../shared/types.js";
|
25
|
+
*/
|
26
|
+
|
27
|
+
/**
|
26
28
|
* @typedef {Object} ConfigLoaderOptions
|
27
29
|
* @property {string|false|undefined} configFile The path to the config file to use.
|
28
30
|
* @property {string} cwd The current working directory.
|
@@ -30,7 +32,8 @@ const { FlatConfigArray } = require("./flat-config-array");
|
|
30
32
|
* @property {FlatConfigArray} [baseConfig] The base config to use.
|
31
33
|
* @property {Array<FlatConfigObject>} [defaultConfigs] The default configs to use.
|
32
34
|
* @property {Array<string>} [ignorePatterns] The ignore patterns to use.
|
33
|
-
* @property {FlatConfigObject|Array<FlatConfigObject>} overrideConfig The override config to use.
|
35
|
+
* @property {FlatConfigObject|Array<FlatConfigObject>} [overrideConfig] The override config to use.
|
36
|
+
* @property {boolean} [hasUnstableNativeNodeJsTSConfigFlag] The flag to indicate whether the `unstable_native_nodejs_ts_config` flag is enabled.
|
34
37
|
*/
|
35
38
|
|
36
39
|
//------------------------------------------------------------------------------
|
@@ -108,12 +111,87 @@ function isRunningInDeno() {
|
|
108
111
|
return !!globalThis.Deno;
|
109
112
|
}
|
110
113
|
|
114
|
+
/**
|
115
|
+
* Checks if native TypeScript support is
|
116
|
+
* enabled in the current Node.js process.
|
117
|
+
*
|
118
|
+
* This function determines if the
|
119
|
+
* {@linkcode NodeJS.ProcessFeatures.typescript | typescript}
|
120
|
+
* feature is present in the
|
121
|
+
* {@linkcode process.features} object
|
122
|
+
* and if its value is either "strip" or "transform".
|
123
|
+
* @returns {boolean} `true` if native TypeScript support is enabled, otherwise `false`.
|
124
|
+
* @since 9.24.0
|
125
|
+
*/
|
126
|
+
function isNativeTypeScriptSupportEnabled() {
|
127
|
+
return (
|
128
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- it's still an experimental feature.
|
129
|
+
["strip", "transform"].includes(process.features.typescript)
|
130
|
+
);
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Load the TypeScript configuration file.
|
135
|
+
* @param {string} filePath The absolute file path to load.
|
136
|
+
* @param {URL} fileURL The file URL to load.
|
137
|
+
* @param {number} mtime The last modified timestamp of the file.
|
138
|
+
* @returns {Promise<any>} The configuration loaded from the file.
|
139
|
+
* @since 9.24.0
|
140
|
+
*/
|
141
|
+
async function loadTypeScriptConfigFileWithJiti(filePath, fileURL, mtime) {
|
142
|
+
// eslint-disable-next-line no-use-before-define -- `ConfigLoader.loadJiti` can be overwritten for testing
|
143
|
+
const { createJiti } = await ConfigLoader.loadJiti().catch(() => {
|
144
|
+
throw new Error(
|
145
|
+
"The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.",
|
146
|
+
);
|
147
|
+
});
|
148
|
+
|
149
|
+
// `createJiti` was added in jiti v2.
|
150
|
+
if (typeof createJiti !== "function") {
|
151
|
+
throw new Error(
|
152
|
+
"You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features.",
|
153
|
+
);
|
154
|
+
}
|
155
|
+
|
156
|
+
/*
|
157
|
+
* Disabling `moduleCache` allows us to reload a
|
158
|
+
* config file when the last modified timestamp changes.
|
159
|
+
*/
|
160
|
+
|
161
|
+
const jiti = createJiti(__filename, {
|
162
|
+
moduleCache: false,
|
163
|
+
interopDefault: false,
|
164
|
+
});
|
165
|
+
const config = await jiti.import(fileURL.href);
|
166
|
+
|
167
|
+
importedConfigFileModificationTime.set(filePath, mtime);
|
168
|
+
|
169
|
+
return config?.default ?? config;
|
170
|
+
}
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Dynamically imports a module from the given file path.
|
174
|
+
* @param {string} filePath The absolute file path of the module to import.
|
175
|
+
* @param {URL} fileURL The file URL to load.
|
176
|
+
* @param {number} mtime The last modified timestamp of the file.
|
177
|
+
* @returns {Promise<any>} - A {@linkcode Promise | promise} that resolves to the imported ESLint config.
|
178
|
+
* @since 9.24.0
|
179
|
+
*/
|
180
|
+
async function dynamicImportConfig(filePath, fileURL, mtime) {
|
181
|
+
const module = await import(fileURL.href);
|
182
|
+
|
183
|
+
importedConfigFileModificationTime.set(filePath, mtime);
|
184
|
+
|
185
|
+
return module.default;
|
186
|
+
}
|
187
|
+
|
111
188
|
/**
|
112
189
|
* Load the config array from the given filename.
|
113
190
|
* @param {string} filePath The filename to load from.
|
191
|
+
* @param {boolean} hasUnstableNativeNodeJsTSConfigFlag The flag to indicate whether the `unstable_native_nodejs_ts_config` flag is enabled.
|
114
192
|
* @returns {Promise<any>} The config loaded from the config file.
|
115
193
|
*/
|
116
|
-
async function loadConfigFile(filePath) {
|
194
|
+
async function loadConfigFile(filePath, hasUnstableNativeNodeJsTSConfigFlag) {
|
117
195
|
debug(`Loading config from ${filePath}`);
|
118
196
|
|
119
197
|
const fileURL = pathToFileURL(filePath);
|
@@ -161,44 +239,36 @@ async function loadConfigFile(filePath) {
|
|
161
239
|
*
|
162
240
|
* When Node.js supports native TypeScript imports, we can remove this check.
|
163
241
|
*/
|
164
|
-
if (isTS && !isDeno && !isBun) {
|
165
|
-
// eslint-disable-next-line no-use-before-define -- `ConfigLoader.loadJiti` can be overwritten for testing
|
166
|
-
const { createJiti } = await ConfigLoader.loadJiti().catch(() => {
|
167
|
-
throw new Error(
|
168
|
-
"The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it.",
|
169
|
-
);
|
170
|
-
});
|
171
242
|
|
172
|
-
|
173
|
-
if (
|
243
|
+
if (isTS) {
|
244
|
+
if (hasUnstableNativeNodeJsTSConfigFlag) {
|
245
|
+
if (isNativeTypeScriptSupportEnabled()) {
|
246
|
+
return await dynamicImportConfig(filePath, fileURL, mtime);
|
247
|
+
}
|
248
|
+
|
249
|
+
if (!("typescript" in process.features)) {
|
250
|
+
throw new Error(
|
251
|
+
"The unstable_native_nodejs_ts_config flag is not supported in older versions of Node.js.",
|
252
|
+
);
|
253
|
+
}
|
254
|
+
|
174
255
|
throw new Error(
|
175
|
-
"
|
256
|
+
"The unstable_native_nodejs_ts_config flag is enabled, but native TypeScript support is not enabled in the current Node.js process. You need to either enable native TypeScript support by passing --experimental-strip-types or remove the unstable_native_nodejs_ts_config flag.",
|
176
257
|
);
|
177
258
|
}
|
178
259
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
interopDefault: false,
|
187
|
-
});
|
188
|
-
const config = await jiti.import(fileURL.href);
|
189
|
-
|
190
|
-
importedConfigFileModificationTime.set(filePath, mtime);
|
191
|
-
|
192
|
-
return config?.default ?? config;
|
260
|
+
if (!isDeno && !isBun) {
|
261
|
+
return await loadTypeScriptConfigFileWithJiti(
|
262
|
+
filePath,
|
263
|
+
fileURL,
|
264
|
+
mtime,
|
265
|
+
);
|
266
|
+
}
|
193
267
|
}
|
194
268
|
|
195
269
|
// fallback to normal runtime behavior
|
196
270
|
|
197
|
-
|
198
|
-
|
199
|
-
importedConfigFileModificationTime.set(filePath, mtime);
|
200
|
-
|
201
|
-
return config;
|
271
|
+
return await dynamicImportConfig(filePath, fileURL, mtime);
|
202
272
|
}
|
203
273
|
|
204
274
|
//-----------------------------------------------------------------------------
|
@@ -495,6 +565,7 @@ class ConfigLoader {
|
|
495
565
|
ignoreEnabled,
|
496
566
|
ignorePatterns,
|
497
567
|
overrideConfig,
|
568
|
+
hasUnstableNativeNodeJsTSConfigFlag = false,
|
498
569
|
defaultConfigs = [],
|
499
570
|
} = options;
|
500
571
|
|
@@ -510,7 +581,10 @@ class ConfigLoader {
|
|
510
581
|
// load config file
|
511
582
|
if (configFilePath) {
|
512
583
|
debug(`Loading config file ${configFilePath}`);
|
513
|
-
const fileConfig = await loadConfigFile(
|
584
|
+
const fileConfig = await loadConfigFile(
|
585
|
+
configFilePath,
|
586
|
+
hasUnstableNativeNodeJsTSConfigFlag,
|
587
|
+
);
|
514
588
|
|
515
589
|
/*
|
516
590
|
* It's possible that a config file could be empty or else
|
@@ -9,7 +9,10 @@
|
|
9
9
|
// Typedefs
|
10
10
|
//------------------------------------------------------------------------------
|
11
11
|
|
12
|
-
/**
|
12
|
+
/**
|
13
|
+
* @import { RuleDefinition } from "@eslint/core";
|
14
|
+
* @import { Linter } from "eslint";
|
15
|
+
*/
|
13
16
|
|
14
17
|
//------------------------------------------------------------------------------
|
15
18
|
// Private Members
|
@@ -59,8 +62,8 @@ function parseRuleId(ruleId) {
|
|
59
62
|
/**
|
60
63
|
* Retrieves a rule instance from a given config based on the ruleId.
|
61
64
|
* @param {string} ruleId The rule ID to look for.
|
62
|
-
* @param {
|
63
|
-
* @returns {
|
65
|
+
* @param {Linter.Config} config The config to search.
|
66
|
+
* @returns {RuleDefinition|undefined} The rule if found
|
64
67
|
* or undefined if not.
|
65
68
|
*/
|
66
69
|
function getRuleFromConfig(ruleId, config) {
|
@@ -71,7 +74,7 @@ function getRuleFromConfig(ruleId, config) {
|
|
71
74
|
|
72
75
|
/**
|
73
76
|
* Gets a complete options schema for a rule.
|
74
|
-
* @param {
|
77
|
+
* @param {RuleDefinition} rule A rule object
|
75
78
|
* @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.
|
76
79
|
* @returns {Object|null} JSON Schema for the rule's options. `null` if `meta.schema` is `false`.
|
77
80
|
*/
|
@@ -28,6 +28,12 @@ const MINIMATCH_OPTIONS = { dot: true };
|
|
28
28
|
// Types
|
29
29
|
//-----------------------------------------------------------------------------
|
30
30
|
|
31
|
+
/**
|
32
|
+
* @import { ESLintOptions } from "./eslint.js";
|
33
|
+
* @import { LintMessage, LintResult } from "../shared/types.js";
|
34
|
+
* @import { ConfigLoader, LegacyConfigLoader } from "../config/config-loader.js";
|
35
|
+
*/
|
36
|
+
|
31
37
|
/**
|
32
38
|
* @typedef {Object} GlobSearch
|
33
39
|
* @property {Array<string>} patterns The normalized patterns to use for a search.
|
@@ -115,7 +121,7 @@ function isNonEmptyString(value) {
|
|
115
121
|
*/
|
116
122
|
function isArrayOfNonEmptyString(value) {
|
117
123
|
return (
|
118
|
-
Array.isArray(value) && value.length && value.every(isNonEmptyString)
|
124
|
+
Array.isArray(value) && !!value.length && value.every(isNonEmptyString)
|
119
125
|
);
|
120
126
|
}
|
121
127
|
|
@@ -351,7 +357,7 @@ async function globSearch({
|
|
351
357
|
* as the user inputted them. Used for errors.
|
352
358
|
* @param {Array<string>} options.unmatchedPatterns A non-empty array of absolute path glob patterns
|
353
359
|
* that were unmatched in the original search.
|
354
|
-
* @returns {
|
360
|
+
* @returns {Promise<never>} Always throws an error.
|
355
361
|
* @throws {NoFilesFoundError} If the first unmatched pattern
|
356
362
|
* doesn't match any files even when there are no ignores.
|
357
363
|
* @throws {AllFilesIgnoredError} If the first unmatched pattern
|
@@ -454,7 +460,7 @@ async function globMultiSearch({
|
|
454
460
|
}
|
455
461
|
}
|
456
462
|
|
457
|
-
// second loop for `
|
463
|
+
// second loop for `fulfilled` results
|
458
464
|
return results.flatMap(result => result.value);
|
459
465
|
}
|
460
466
|
|
@@ -664,6 +670,42 @@ function createIgnoreResult(filePath, baseDir, configStatus) {
|
|
664
670
|
};
|
665
671
|
}
|
666
672
|
|
673
|
+
/**
|
674
|
+
* It will calculate the error and warning count for collection of messages per file
|
675
|
+
* @param {LintMessage[]} messages Collection of messages
|
676
|
+
* @returns {Object} Contains the stats
|
677
|
+
* @private
|
678
|
+
*/
|
679
|
+
function calculateStatsPerFile(messages) {
|
680
|
+
const stat = {
|
681
|
+
errorCount: 0,
|
682
|
+
fatalErrorCount: 0,
|
683
|
+
warningCount: 0,
|
684
|
+
fixableErrorCount: 0,
|
685
|
+
fixableWarningCount: 0,
|
686
|
+
};
|
687
|
+
|
688
|
+
for (let i = 0; i < messages.length; i++) {
|
689
|
+
const message = messages[i];
|
690
|
+
|
691
|
+
if (message.fatal || message.severity === 2) {
|
692
|
+
stat.errorCount++;
|
693
|
+
if (message.fatal) {
|
694
|
+
stat.fatalErrorCount++;
|
695
|
+
}
|
696
|
+
if (message.fix) {
|
697
|
+
stat.fixableErrorCount++;
|
698
|
+
}
|
699
|
+
} else {
|
700
|
+
stat.warningCount++;
|
701
|
+
if (message.fix) {
|
702
|
+
stat.fixableWarningCount++;
|
703
|
+
}
|
704
|
+
}
|
705
|
+
}
|
706
|
+
return stat;
|
707
|
+
}
|
708
|
+
|
667
709
|
//-----------------------------------------------------------------------------
|
668
710
|
// Options-related Helpers
|
669
711
|
//-----------------------------------------------------------------------------
|
@@ -915,9 +957,11 @@ function processOptions({
|
|
915
957
|
* if cacheFile points to a file or looks like a file then in will just use that file
|
916
958
|
* @param {string} cacheFile The name of file to be used to store the cache
|
917
959
|
* @param {string} cwd Current working directory
|
960
|
+
* @param {Object} options The options
|
961
|
+
* @param {string} [options.prefix] The prefix to use for the cache file
|
918
962
|
* @returns {string} the resolved path to the cache file
|
919
963
|
*/
|
920
|
-
function getCacheFile(cacheFile, cwd) {
|
964
|
+
function getCacheFile(cacheFile, cwd, { prefix = ".cache_" } = {}) {
|
921
965
|
/*
|
922
966
|
* make sure the path separators are normalized for the environment/os
|
923
967
|
* keeping the trailing path separator if present
|
@@ -932,7 +976,7 @@ function getCacheFile(cacheFile, cwd) {
|
|
932
976
|
* @returns {string} the resolved path to the cacheFile
|
933
977
|
*/
|
934
978
|
function getCacheFileForDirectory() {
|
935
|
-
return path.join(resolvedCacheFile,
|
979
|
+
return path.join(resolvedCacheFile, `${prefix}${hash(cwd)}`);
|
936
980
|
}
|
937
981
|
|
938
982
|
let fileStats;
|
@@ -988,6 +1032,7 @@ module.exports = {
|
|
988
1032
|
|
989
1033
|
createIgnoreResult,
|
990
1034
|
isErrorMessage,
|
1035
|
+
calculateStatsPerFile,
|
991
1036
|
|
992
1037
|
processOptions,
|
993
1038
|
|
package/lib/eslint/eslint.js
CHANGED
@@ -33,6 +33,7 @@ const {
|
|
33
33
|
|
34
34
|
createIgnoreResult,
|
35
35
|
isErrorMessage,
|
36
|
+
calculateStatsPerFile,
|
36
37
|
|
37
38
|
processOptions,
|
38
39
|
} = require("./eslint-helpers");
|
@@ -51,19 +52,15 @@ const { ConfigLoader, LegacyConfigLoader } = require("../config/config-loader");
|
|
51
52
|
//------------------------------------------------------------------------------
|
52
53
|
|
53
54
|
// For VSCode IntelliSense
|
54
|
-
/**
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
/** @typedef {import("../shared/types").RuleConf} RuleConf */
|
63
|
-
/** @typedef {import("../shared/types").Rule} Rule */
|
55
|
+
/**
|
56
|
+
* @import { ConfigArray } from "../cli-engine/cli-engine.js";
|
57
|
+
* @import { CLIEngineLintReport } from "./legacy-eslint.js";
|
58
|
+
* @import { FlatConfigArray } from "../config/flat-config-array.js";
|
59
|
+
* @import { RuleDefinition } from "@eslint/core";
|
60
|
+
* @import { ConfigData, DeprecatedRuleInfo, LintMessage, LintResult, Plugin, ResultsMeta } from "../shared/types.js";
|
61
|
+
*/
|
62
|
+
|
64
63
|
/** @typedef {ReturnType<ConfigArray.extractConfig>} ExtractedConfig */
|
65
|
-
/** @typedef {import('../cli-engine/cli-engine').CLIEngine} CLIEngine */
|
66
|
-
/** @typedef {import('./legacy-eslint').CLIEngineLintReport} CLIEngineLintReport */
|
67
64
|
|
68
65
|
/**
|
69
66
|
* The options with which to configure the ESLint instance.
|
@@ -110,45 +107,9 @@ const removedFormatters = new Set([
|
|
110
107
|
"visualstudio",
|
111
108
|
]);
|
112
109
|
|
113
|
-
/**
|
114
|
-
* It will calculate the error and warning count for collection of messages per file
|
115
|
-
* @param {LintMessage[]} messages Collection of messages
|
116
|
-
* @returns {Object} Contains the stats
|
117
|
-
* @private
|
118
|
-
*/
|
119
|
-
function calculateStatsPerFile(messages) {
|
120
|
-
const stat = {
|
121
|
-
errorCount: 0,
|
122
|
-
fatalErrorCount: 0,
|
123
|
-
warningCount: 0,
|
124
|
-
fixableErrorCount: 0,
|
125
|
-
fixableWarningCount: 0,
|
126
|
-
};
|
127
|
-
|
128
|
-
for (let i = 0; i < messages.length; i++) {
|
129
|
-
const message = messages[i];
|
130
|
-
|
131
|
-
if (message.fatal || message.severity === 2) {
|
132
|
-
stat.errorCount++;
|
133
|
-
if (message.fatal) {
|
134
|
-
stat.fatalErrorCount++;
|
135
|
-
}
|
136
|
-
if (message.fix) {
|
137
|
-
stat.fixableErrorCount++;
|
138
|
-
}
|
139
|
-
} else {
|
140
|
-
stat.warningCount++;
|
141
|
-
if (message.fix) {
|
142
|
-
stat.fixableWarningCount++;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
}
|
146
|
-
return stat;
|
147
|
-
}
|
148
|
-
|
149
110
|
/**
|
150
111
|
* Create rulesMeta object.
|
151
|
-
* @param {Map<string,
|
112
|
+
* @param {Map<string,RuleDefinition>} rules a map of rules from which to generate the object.
|
152
113
|
* @returns {Object} metadata for all enabled rules.
|
153
114
|
*/
|
154
115
|
function createRulesMeta(rules) {
|
@@ -173,7 +134,7 @@ const usedDeprecatedRulesCache = new WeakMap();
|
|
173
134
|
|
174
135
|
/**
|
175
136
|
* Create used deprecated rule list.
|
176
|
-
* @param {
|
137
|
+
* @param {ESLint} eslint The ESLint instance.
|
177
138
|
* @param {string} maybeFilePath The absolute path to a lint target file or `"<text>"`.
|
178
139
|
* @returns {DeprecatedRuleInfo[]} The used deprecated rule list.
|
179
140
|
*/
|
@@ -226,7 +187,7 @@ function getOrFindUsedDeprecatedRules(eslint, maybeFilePath) {
|
|
226
187
|
/**
|
227
188
|
* Processes the linting results generated by a CLIEngine linting report to
|
228
189
|
* match the ESLint class's API.
|
229
|
-
* @param {
|
190
|
+
* @param {ESLint} eslint The ESLint instance.
|
230
191
|
* @param {CLIEngineLintReport} report The CLIEngine linting report to process.
|
231
192
|
* @returns {LintResult[]} The processed linting results.
|
232
193
|
*/
|
@@ -382,7 +343,7 @@ function verifyText({
|
|
382
343
|
/**
|
383
344
|
* Checks whether a message's rule type should be fixed.
|
384
345
|
* @param {LintMessage} message The message to check.
|
385
|
-
* @param {
|
346
|
+
* @param {FlatConfigArray} config The config for the file that generated the message.
|
386
347
|
* @param {string[]} fixTypes An array of fix types to check.
|
387
348
|
* @returns {boolean} Whether the message should be fixed.
|
388
349
|
*/
|
@@ -410,7 +371,7 @@ function createExtraneousResultsError() {
|
|
410
371
|
* Creates a fixer function based on the provided fix, fixTypesSet, and config.
|
411
372
|
* @param {Function|boolean} fix The original fix option.
|
412
373
|
* @param {Set<string>} fixTypesSet A set of fix types to filter messages for fixing.
|
413
|
-
* @param {
|
374
|
+
* @param {FlatConfigArray} config The config for the file that generated the message.
|
414
375
|
* @returns {Function|boolean} The fixer function or the original fix value.
|
415
376
|
*/
|
416
377
|
function getFixerForFixTypes(fix, fixTypesSet, config) {
|
@@ -475,6 +436,9 @@ class ESLint {
|
|
475
436
|
ignoreEnabled: processedOptions.ignore,
|
476
437
|
ignorePatterns: processedOptions.ignorePatterns,
|
477
438
|
defaultConfigs,
|
439
|
+
hasUnstableNativeNodeJsTSConfigFlag: linter.hasFlag(
|
440
|
+
"unstable_native_nodejs_ts_config",
|
441
|
+
),
|
478
442
|
};
|
479
443
|
|
480
444
|
this.#configLoader = linter.hasFlag("unstable_config_lookup_from_file")
|
@@ -35,7 +35,7 @@ const { version } = require("../../package.json");
|
|
35
35
|
/** @typedef {import("../shared/types").LintMessage} LintMessage */
|
36
36
|
/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */
|
37
37
|
/** @typedef {import("../shared/types").Plugin} Plugin */
|
38
|
-
/** @typedef {import("../
|
38
|
+
/** @typedef {import("../types").Rule.RuleModule} Rule */
|
39
39
|
/** @typedef {import("../shared/types").LintResult} LintResult */
|
40
40
|
/** @typedef {import("../shared/types").ResultsMeta} ResultsMeta */
|
41
41
|
|
@@ -335,7 +335,7 @@ class ForLoopContext extends LoopContextBase {
|
|
335
335
|
this.updateSegments = null;
|
336
336
|
|
337
337
|
/**
|
338
|
-
* The end of the update
|
338
|
+
* The end of the update expression. This may change during the lifetime
|
339
339
|
* of the instance as we traverse the loop because some loops don't have
|
340
340
|
* an update expression.
|
341
341
|
* @type {Array<CodePathSegment>|null}
|
package/lib/linter/linter.js
CHANGED
@@ -81,7 +81,7 @@ const STEP_KIND_CALL = 2;
|
|
81
81
|
/** @typedef {import("../shared/types").ParserOptions} ParserOptions */
|
82
82
|
/** @typedef {import("../shared/types").LanguageOptions} LanguageOptions */
|
83
83
|
/** @typedef {import("../shared/types").Processor} Processor */
|
84
|
-
/** @typedef {import("../
|
84
|
+
/** @typedef {import("../types").Rule.RuleModule} Rule */
|
85
85
|
/** @typedef {import("../shared/types").Times} Times */
|
86
86
|
/** @typedef {import("@eslint/core").Language} Language */
|
87
87
|
/** @typedef {import("@eslint/core").RuleSeverity} RuleSeverity */
|
package/lib/linter/rules.js
CHANGED
@@ -16,7 +16,7 @@ const builtInRules = require("../rules");
|
|
16
16
|
// Typedefs
|
17
17
|
//------------------------------------------------------------------------------
|
18
18
|
|
19
|
-
/** @typedef {import("../
|
19
|
+
/** @typedef {import("../types").Rule.RuleModule} Rule */
|
20
20
|
|
21
21
|
//------------------------------------------------------------------------------
|
22
22
|
// Public Interface
|