eslint 8.39.0 → 8.47.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 +10 -4
- package/conf/globals.js +6 -1
- package/lib/cli-engine/cli-engine.js +30 -19
- package/lib/cli.js +2 -28
- package/lib/config/default-config.js +1 -1
- package/lib/config/flat-config-schema.js +127 -35
- package/lib/eslint/eslint-helpers.js +11 -10
- package/lib/eslint/eslint.js +1 -1
- package/lib/eslint/flat-eslint.js +119 -161
- package/lib/linter/apply-disable-directives.js +11 -1
- package/lib/linter/code-path-analysis/debug-helpers.js +1 -1
- package/lib/linter/config-comment-parser.js +9 -2
- package/lib/linter/linter.js +20 -11
- package/lib/linter/report-translator.js +22 -21
- package/lib/rule-tester/flat-rule-tester.js +1 -2
- package/lib/rule-tester/rule-tester.js +1 -2
- package/lib/rules/accessor-pairs.js +35 -43
- package/lib/rules/array-bracket-newline.js +2 -2
- package/lib/rules/array-bracket-spacing.js +2 -2
- package/lib/rules/array-callback-return.js +2 -2
- package/lib/rules/array-element-newline.js +12 -6
- package/lib/rules/arrow-body-style.js +2 -2
- package/lib/rules/arrow-parens.js +2 -2
- package/lib/rules/arrow-spacing.js +2 -2
- package/lib/rules/block-scoped-var.js +17 -7
- package/lib/rules/block-spacing.js +2 -2
- package/lib/rules/brace-style.js +2 -2
- package/lib/rules/callback-return.js +2 -2
- package/lib/rules/camelcase.js +2 -2
- package/lib/rules/capitalized-comments.js +2 -2
- package/lib/rules/class-methods-use-this.js +2 -2
- package/lib/rules/comma-dangle.js +2 -2
- package/lib/rules/comma-spacing.js +2 -2
- package/lib/rules/comma-style.js +2 -2
- package/lib/rules/complexity.js +1 -1
- package/lib/rules/computed-property-spacing.js +2 -2
- package/lib/rules/consistent-return.js +3 -3
- package/lib/rules/consistent-this.js +2 -2
- package/lib/rules/constructor-super.js +1 -1
- package/lib/rules/curly.js +2 -2
- package/lib/rules/default-case-last.js +1 -1
- package/lib/rules/default-case.js +2 -2
- package/lib/rules/default-param-last.js +1 -1
- package/lib/rules/dot-location.js +2 -2
- package/lib/rules/dot-notation.js +3 -4
- package/lib/rules/eol-last.js +2 -2
- package/lib/rules/eqeqeq.js +2 -2
- package/lib/rules/for-direction.js +1 -1
- package/lib/rules/func-call-spacing.js +2 -2
- package/lib/rules/func-name-matching.js +1 -1
- package/lib/rules/func-names.js +2 -2
- package/lib/rules/func-style.js +1 -1
- package/lib/rules/function-call-argument-newline.js +2 -2
- package/lib/rules/function-paren-newline.js +2 -2
- package/lib/rules/generator-star-spacing.js +2 -2
- package/lib/rules/getter-return.js +2 -2
- package/lib/rules/global-require.js +2 -2
- package/lib/rules/grouped-accessor-pairs.js +35 -44
- package/lib/rules/guard-for-in.js +1 -1
- package/lib/rules/handle-callback-err.js +2 -2
- package/lib/rules/id-blacklist.js +2 -2
- package/lib/rules/id-denylist.js +2 -2
- package/lib/rules/id-length.js +3 -36
- package/lib/rules/id-match.js +2 -2
- package/lib/rules/implicit-arrow-linebreak.js +2 -2
- package/lib/rules/indent-legacy.js +2 -2
- package/lib/rules/indent.js +84 -88
- package/lib/rules/init-declarations.js +1 -1
- package/lib/rules/jsx-quotes.js +1 -1
- package/lib/rules/key-spacing.js +4 -10
- package/lib/rules/keyword-spacing.js +2 -2
- package/lib/rules/line-comment-position.js +2 -2
- package/lib/rules/linebreak-style.js +2 -2
- package/lib/rules/lines-around-comment.js +2 -2
- package/lib/rules/lines-around-directive.js +2 -2
- package/lib/rules/lines-between-class-members.js +2 -2
- package/lib/rules/logical-assignment-operators.js +7 -5
- package/lib/rules/max-classes-per-file.js +1 -1
- package/lib/rules/max-depth.js +1 -1
- package/lib/rules/max-len.js +19 -15
- package/lib/rules/max-lines-per-function.js +2 -2
- package/lib/rules/max-lines.js +2 -2
- package/lib/rules/max-nested-callbacks.js +1 -1
- package/lib/rules/max-params.js +2 -2
- package/lib/rules/max-statements-per-line.js +2 -2
- package/lib/rules/max-statements.js +1 -1
- package/lib/rules/multiline-comment-style.js +2 -2
- package/lib/rules/multiline-ternary.js +2 -2
- package/lib/rules/new-cap.js +2 -2
- package/lib/rules/new-parens.js +2 -2
- package/lib/rules/newline-after-var.js +2 -4
- package/lib/rules/newline-before-return.js +2 -2
- package/lib/rules/newline-per-chained-call.js +2 -2
- package/lib/rules/no-alert.js +2 -2
- package/lib/rules/no-array-constructor.js +1 -1
- package/lib/rules/no-async-promise-executor.js +2 -2
- 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 +2 -2
- package/lib/rules/no-class-assign.js +2 -2
- package/lib/rules/no-compare-neg-zero.js +1 -1
- package/lib/rules/no-cond-assign.js +2 -2
- package/lib/rules/no-confusing-arrow.js +2 -2
- package/lib/rules/no-console.js +2 -2
- package/lib/rules/no-const-assign.js +2 -2
- package/lib/rules/no-constant-binary-expression.js +2 -2
- package/lib/rules/no-constant-condition.js +2 -2
- package/lib/rules/no-constructor-return.js +1 -1
- package/lib/rules/no-continue.js +1 -1
- package/lib/rules/no-control-regex.js +16 -3
- package/lib/rules/no-debugger.js +1 -1
- package/lib/rules/no-delete-var.js +1 -1
- package/lib/rules/no-div-regex.js +2 -2
- package/lib/rules/no-dupe-args.js +2 -2
- package/lib/rules/no-dupe-class-members.js +1 -1
- package/lib/rules/no-dupe-else-if.js +2 -2
- package/lib/rules/no-dupe-keys.js +1 -1
- package/lib/rules/no-duplicate-case.js +2 -2
- package/lib/rules/no-duplicate-imports.js +1 -1
- package/lib/rules/no-else-return.js +2 -2
- package/lib/rules/no-empty-character-class.js +34 -13
- package/lib/rules/no-empty-function.js +2 -2
- package/lib/rules/no-empty-pattern.js +39 -4
- package/lib/rules/no-empty-static-block.js +2 -2
- package/lib/rules/no-empty.js +2 -2
- package/lib/rules/no-eq-null.js +1 -1
- package/lib/rules/no-eval.js +2 -2
- package/lib/rules/no-ex-assign.js +2 -2
- package/lib/rules/no-extend-native.js +2 -2
- package/lib/rules/no-extra-bind.js +2 -2
- package/lib/rules/no-extra-boolean-cast.js +2 -2
- package/lib/rules/no-extra-label.js +2 -2
- package/lib/rules/no-extra-parens.js +48 -12
- package/lib/rules/no-extra-semi.js +31 -13
- package/lib/rules/no-fallthrough.js +3 -3
- package/lib/rules/no-floating-decimal.js +2 -2
- package/lib/rules/no-func-assign.js +2 -2
- package/lib/rules/no-global-assign.js +2 -2
- package/lib/rules/no-implicit-coercion.js +2 -2
- package/lib/rules/no-implicit-globals.js +2 -2
- package/lib/rules/no-implied-eval.js +2 -2
- package/lib/rules/no-import-assign.js +2 -2
- package/lib/rules/no-inline-comments.js +2 -2
- package/lib/rules/no-inner-declarations.js +1 -1
- package/lib/rules/no-invalid-regexp.js +23 -8
- package/lib/rules/no-invalid-this.js +2 -2
- package/lib/rules/no-irregular-whitespace.js +23 -6
- package/lib/rules/no-iterator.js +1 -1
- package/lib/rules/no-label-var.js +2 -2
- package/lib/rules/no-labels.js +1 -1
- package/lib/rules/no-lone-blocks.js +2 -2
- package/lib/rules/no-lonely-if.js +2 -2
- package/lib/rules/no-loop-func.js +3 -3
- package/lib/rules/no-loss-of-precision.js +15 -7
- package/lib/rules/no-magic-numbers.js +1 -1
- package/lib/rules/no-misleading-character-class.js +10 -4
- package/lib/rules/no-mixed-operators.js +2 -2
- package/lib/rules/no-mixed-requires.js +1 -1
- package/lib/rules/no-mixed-spaces-and-tabs.js +2 -2
- package/lib/rules/no-multi-assign.js +1 -1
- package/lib/rules/no-multi-spaces.js +2 -2
- package/lib/rules/no-multi-str.js +1 -1
- package/lib/rules/no-multiple-empty-lines.js +2 -2
- package/lib/rules/no-native-reassign.js +2 -2
- 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 +2 -2
- package/lib/rules/no-new-native-nonconstructor.js +2 -2
- package/lib/rules/no-new-object.js +2 -2
- package/lib/rules/no-new-require.js +1 -1
- package/lib/rules/no-new-symbol.js +2 -2
- package/lib/rules/no-new-wrappers.js +20 -8
- package/lib/rules/no-new.js +1 -1
- package/lib/rules/no-nonoctal-decimal-escape.js +2 -2
- package/lib/rules/no-obj-calls.js +2 -2
- package/lib/rules/no-octal-escape.js +1 -1
- package/lib/rules/no-octal.js +1 -1
- package/lib/rules/no-param-reassign.js +2 -2
- 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 +2 -2
- package/lib/rules/no-proto.js +1 -1
- package/lib/rules/no-prototype-builtins.js +1 -1
- package/lib/rules/no-redeclare.js +2 -2
- package/lib/rules/no-regex-spaces.js +20 -5
- package/lib/rules/no-restricted-exports.js +2 -2
- package/lib/rules/no-restricted-globals.js +2 -2
- package/lib/rules/no-restricted-imports.js +2 -2
- package/lib/rules/no-restricted-modules.js +8 -11
- 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 +2 -2
- package/lib/rules/no-return-await.js +8 -3
- package/lib/rules/no-script-url.js +1 -1
- package/lib/rules/no-self-assign.js +2 -2
- package/lib/rules/no-self-compare.js +2 -2
- package/lib/rules/no-sequences.js +2 -2
- package/lib/rules/no-setter-return.js +2 -2
- package/lib/rules/no-shadow-restricted-names.js +2 -2
- package/lib/rules/no-shadow.js +2 -2
- package/lib/rules/no-spaced-func.js +2 -2
- package/lib/rules/no-sparse-arrays.js +1 -1
- package/lib/rules/no-sync.js +1 -1
- package/lib/rules/no-tabs.js +2 -2
- 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 +2 -2
- package/lib/rules/no-undef-init.js +2 -2
- package/lib/rules/no-undef.js +2 -2
- package/lib/rules/no-undefined.js +2 -2
- package/lib/rules/no-underscore-dangle.js +2 -2
- package/lib/rules/no-unexpected-multiline.js +2 -2
- package/lib/rules/no-unmodified-loop-condition.js +2 -2
- package/lib/rules/no-unneeded-ternary.js +2 -2
- package/lib/rules/no-unreachable-loop.js +1 -1
- package/lib/rules/no-unreachable.js +2 -2
- package/lib/rules/no-unsafe-finally.js +1 -1
- package/lib/rules/no-unsafe-negation.js +2 -2
- package/lib/rules/no-unsafe-optional-chaining.js +1 -1
- package/lib/rules/no-unused-expressions.js +4 -6
- package/lib/rules/no-unused-labels.js +48 -15
- package/lib/rules/no-unused-private-class-members.js +1 -1
- package/lib/rules/no-unused-vars.js +4 -3
- package/lib/rules/no-use-before-define.js +2 -2
- package/lib/rules/no-useless-backreference.js +3 -3
- package/lib/rules/no-useless-call.js +2 -2
- package/lib/rules/no-useless-catch.js +1 -1
- package/lib/rules/no-useless-computed-key.js +2 -2
- package/lib/rules/no-useless-concat.js +2 -2
- package/lib/rules/no-useless-constructor.js +1 -1
- package/lib/rules/no-useless-escape.js +162 -83
- package/lib/rules/no-useless-rename.js +2 -2
- package/lib/rules/no-useless-return.js +37 -9
- package/lib/rules/no-var.js +2 -2
- package/lib/rules/no-void.js +1 -1
- package/lib/rules/no-warning-comments.js +2 -2
- package/lib/rules/no-whitespace-before-property.js +2 -2
- package/lib/rules/no-with.js +1 -1
- package/lib/rules/nonblock-statement-body-position.js +2 -2
- package/lib/rules/object-curly-newline.js +2 -2
- package/lib/rules/object-curly-spacing.js +4 -4
- package/lib/rules/object-property-newline.js +2 -2
- package/lib/rules/object-shorthand.js +2 -2
- package/lib/rules/one-var-declaration-per-line.js +1 -1
- package/lib/rules/one-var.js +2 -2
- package/lib/rules/operator-assignment.js +2 -2
- package/lib/rules/operator-linebreak.js +2 -2
- package/lib/rules/padded-blocks.js +2 -2
- package/lib/rules/padding-line-between-statements.js +8 -53
- package/lib/rules/prefer-arrow-callback.js +2 -2
- package/lib/rules/prefer-const.js +2 -2
- package/lib/rules/prefer-destructuring.js +2 -2
- package/lib/rules/prefer-exponentiation-operator.js +4 -3
- package/lib/rules/prefer-named-capture-group.js +10 -7
- package/lib/rules/prefer-numeric-literals.js +2 -2
- package/lib/rules/prefer-object-has-own.js +2 -2
- package/lib/rules/prefer-object-spread.js +2 -2
- package/lib/rules/prefer-promise-reject-errors.js +2 -2
- package/lib/rules/prefer-reflect.js +1 -1
- package/lib/rules/prefer-regex-literals.js +14 -17
- package/lib/rules/prefer-rest-params.js +2 -2
- package/lib/rules/prefer-spread.js +2 -2
- package/lib/rules/prefer-template.js +2 -2
- package/lib/rules/quote-props.js +2 -2
- package/lib/rules/quotes.js +16 -16
- package/lib/rules/radix.js +2 -2
- package/lib/rules/require-atomic-updates.js +2 -2
- package/lib/rules/require-await.js +2 -2
- package/lib/rules/require-jsdoc.js +2 -2
- package/lib/rules/require-unicode-regexp.js +5 -5
- package/lib/rules/require-yield.js +1 -1
- package/lib/rules/rest-spread-spacing.js +2 -2
- package/lib/rules/semi-spacing.js +2 -2
- package/lib/rules/semi-style.js +2 -2
- package/lib/rules/semi.js +30 -5
- package/lib/rules/sort-imports.js +2 -2
- package/lib/rules/sort-keys.js +2 -2
- package/lib/rules/sort-vars.js +2 -2
- package/lib/rules/space-before-blocks.js +2 -2
- package/lib/rules/space-before-function-paren.js +2 -2
- package/lib/rules/space-in-parens.js +2 -2
- package/lib/rules/space-infix-ops.js +2 -2
- package/lib/rules/space-unary-ops.js +2 -2
- package/lib/rules/spaced-comment.js +2 -2
- package/lib/rules/strict.js +1 -1
- package/lib/rules/switch-colon-spacing.js +2 -2
- package/lib/rules/symbol-description.js +2 -2
- package/lib/rules/template-curly-spacing.js +2 -2
- package/lib/rules/template-tag-spacing.js +2 -2
- package/lib/rules/unicode-bom.js +2 -2
- package/lib/rules/use-isnan.js +1 -1
- package/lib/rules/utils/ast-utils.js +55 -7
- package/lib/rules/utils/regular-expressions.js +2 -2
- package/lib/rules/valid-jsdoc.js +2 -2
- package/lib/rules/valid-typeof.js +9 -3
- package/lib/rules/vars-on-top.js +1 -1
- package/lib/rules/wrap-iife.js +2 -2
- package/lib/rules/wrap-regex.js +2 -2
- package/lib/rules/yield-star-spacing.js +2 -2
- package/lib/rules/yoda.js +4 -13
- package/lib/shared/string-utils.js +39 -1
- package/lib/shared/types.js +7 -3
- package/lib/unsupported-api.js +5 -2
- package/messages/eslintrc-incompat.js +98 -0
- package/messages/eslintrc-plugins.js +24 -0
- package/messages/invalid-rule-options.js +17 -0
- package/messages/invalid-rule-severity.js +13 -0
- package/messages/shared.js +18 -0
- package/package.json +15 -19
@@ -73,7 +73,7 @@ module.exports = {
|
|
73
73
|
docs: {
|
74
74
|
description: "Enforce a maximum number of lines of code in a function",
|
75
75
|
recommended: false,
|
76
|
-
url: "https://eslint.org/docs/rules/max-lines-per-function"
|
76
|
+
url: "https://eslint.org/docs/latest/rules/max-lines-per-function"
|
77
77
|
},
|
78
78
|
|
79
79
|
schema: [
|
@@ -85,7 +85,7 @@ module.exports = {
|
|
85
85
|
},
|
86
86
|
|
87
87
|
create(context) {
|
88
|
-
const sourceCode = context.
|
88
|
+
const sourceCode = context.sourceCode;
|
89
89
|
const lines = sourceCode.lines;
|
90
90
|
|
91
91
|
const option = context.options[0];
|
package/lib/rules/max-lines.js
CHANGED
@@ -36,7 +36,7 @@ module.exports = {
|
|
36
36
|
docs: {
|
37
37
|
description: "Enforce a maximum number of lines per file",
|
38
38
|
recommended: false,
|
39
|
-
url: "https://eslint.org/docs/rules/max-lines"
|
39
|
+
url: "https://eslint.org/docs/latest/rules/max-lines"
|
40
40
|
},
|
41
41
|
|
42
42
|
schema: [
|
@@ -87,7 +87,7 @@ module.exports = {
|
|
87
87
|
const skipComments = option && option.skipComments;
|
88
88
|
const skipBlankLines = option && option.skipBlankLines;
|
89
89
|
|
90
|
-
const sourceCode = context.
|
90
|
+
const sourceCode = context.sourceCode;
|
91
91
|
|
92
92
|
/**
|
93
93
|
* Returns whether or not a token is a comment node type
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Enforce a maximum depth that callbacks can be nested",
|
19
19
|
recommended: false,
|
20
|
-
url: "https://eslint.org/docs/rules/max-nested-callbacks"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/max-nested-callbacks"
|
21
21
|
},
|
22
22
|
|
23
23
|
schema: [
|
package/lib/rules/max-params.js
CHANGED
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
docs: {
|
25
25
|
description: "Enforce a maximum number of parameters in function definitions",
|
26
26
|
recommended: false,
|
27
|
-
url: "https://eslint.org/docs/rules/max-params"
|
27
|
+
url: "https://eslint.org/docs/latest/rules/max-params"
|
28
28
|
},
|
29
29
|
|
30
30
|
schema: [
|
@@ -57,7 +57,7 @@ module.exports = {
|
|
57
57
|
},
|
58
58
|
|
59
59
|
create(context) {
|
60
|
-
const sourceCode = context.
|
60
|
+
const sourceCode = context.sourceCode;
|
61
61
|
const option = context.options[0];
|
62
62
|
let numParams = 3;
|
63
63
|
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
22
22
|
docs: {
|
23
23
|
description: "Enforce a maximum number of statements allowed per line",
|
24
24
|
recommended: false,
|
25
|
-
url: "https://eslint.org/docs/rules/max-statements-per-line"
|
25
|
+
url: "https://eslint.org/docs/latest/rules/max-statements-per-line"
|
26
26
|
},
|
27
27
|
|
28
28
|
schema: [
|
@@ -45,7 +45,7 @@ module.exports = {
|
|
45
45
|
|
46
46
|
create(context) {
|
47
47
|
|
48
|
-
const sourceCode = context.
|
48
|
+
const sourceCode = context.sourceCode,
|
49
49
|
options = context.options[0] || {},
|
50
50
|
maxStatementsPerLine = typeof options.max !== "undefined" ? options.max : 1;
|
51
51
|
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
docs: {
|
25
25
|
description: "Enforce a maximum number of statements allowed in function blocks",
|
26
26
|
recommended: false,
|
27
|
-
url: "https://eslint.org/docs/rules/max-statements"
|
27
|
+
url: "https://eslint.org/docs/latest/rules/max-statements"
|
28
28
|
},
|
29
29
|
|
30
30
|
schema: [
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
18
18
|
docs: {
|
19
19
|
description: "Enforce a particular style for multiline comments",
|
20
20
|
recommended: false,
|
21
|
-
url: "https://eslint.org/docs/rules/multiline-comment-style"
|
21
|
+
url: "https://eslint.org/docs/latest/rules/multiline-comment-style"
|
22
22
|
},
|
23
23
|
|
24
24
|
fixable: "whitespace",
|
@@ -65,7 +65,7 @@ module.exports = {
|
|
65
65
|
},
|
66
66
|
|
67
67
|
create(context) {
|
68
|
-
const sourceCode = context.
|
68
|
+
const sourceCode = context.sourceCode;
|
69
69
|
const option = context.options[0] || "starred-block";
|
70
70
|
const params = context.options[1] || {};
|
71
71
|
const checkJSDoc = !!params.checkJSDoc;
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Enforce newlines between operands of ternary expressions",
|
21
21
|
recommended: false,
|
22
|
-
url: "https://eslint.org/docs/rules/multiline-ternary"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/multiline-ternary"
|
23
23
|
},
|
24
24
|
|
25
25
|
schema: [
|
@@ -39,7 +39,7 @@ module.exports = {
|
|
39
39
|
},
|
40
40
|
|
41
41
|
create(context) {
|
42
|
-
const sourceCode = context.
|
42
|
+
const sourceCode = context.sourceCode;
|
43
43
|
const option = context.options[0];
|
44
44
|
const multiline = option !== "never";
|
45
45
|
const allowSingleLine = option === "always-multiline";
|
package/lib/rules/new-cap.js
CHANGED
@@ -84,7 +84,7 @@ module.exports = {
|
|
84
84
|
docs: {
|
85
85
|
description: "Require constructor names to begin with a capital letter",
|
86
86
|
recommended: false,
|
87
|
-
url: "https://eslint.org/docs/rules/new-cap"
|
87
|
+
url: "https://eslint.org/docs/latest/rules/new-cap"
|
88
88
|
},
|
89
89
|
|
90
90
|
schema: [
|
@@ -147,7 +147,7 @@ module.exports = {
|
|
147
147
|
|
148
148
|
const listeners = {};
|
149
149
|
|
150
|
-
const sourceCode = context.
|
150
|
+
const sourceCode = context.sourceCode;
|
151
151
|
|
152
152
|
//--------------------------------------------------------------------------
|
153
153
|
// Helpers
|
package/lib/rules/new-parens.js
CHANGED
@@ -27,7 +27,7 @@ module.exports = {
|
|
27
27
|
docs: {
|
28
28
|
description: "Enforce or disallow parentheses when invoking a constructor with no arguments",
|
29
29
|
recommended: false,
|
30
|
-
url: "https://eslint.org/docs/rules/new-parens"
|
30
|
+
url: "https://eslint.org/docs/latest/rules/new-parens"
|
31
31
|
},
|
32
32
|
|
33
33
|
fixable: "code",
|
@@ -46,7 +46,7 @@ module.exports = {
|
|
46
46
|
const options = context.options;
|
47
47
|
const always = options[0] !== "never"; // Default is always
|
48
48
|
|
49
|
-
const sourceCode = context.
|
49
|
+
const sourceCode = context.sourceCode;
|
50
50
|
|
51
51
|
return {
|
52
52
|
NewExpression(node) {
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
docs: {
|
25
25
|
description: "Require or disallow an empty line after variable declarations",
|
26
26
|
recommended: false,
|
27
|
-
url: "https://eslint.org/docs/rules/newline-after-var"
|
27
|
+
url: "https://eslint.org/docs/latest/rules/newline-after-var"
|
28
28
|
},
|
29
29
|
schema: [
|
30
30
|
{
|
@@ -43,7 +43,7 @@ module.exports = {
|
|
43
43
|
},
|
44
44
|
|
45
45
|
create(context) {
|
46
|
-
const sourceCode = context.
|
46
|
+
const sourceCode = context.sourceCode;
|
47
47
|
|
48
48
|
// Default `mode` to "always".
|
49
49
|
const mode = context.options[0] === "never" ? "never" : "always";
|
@@ -212,7 +212,6 @@ module.exports = {
|
|
212
212
|
context.report({
|
213
213
|
node,
|
214
214
|
messageId: "unexpected",
|
215
|
-
data: { identifier: node.name },
|
216
215
|
fix(fixer) {
|
217
216
|
const linesBetween = sourceCode.getText().slice(lastToken.range[1], nextToken.range[0]).split(astUtils.LINEBREAK_MATCHER);
|
218
217
|
|
@@ -231,7 +230,6 @@ module.exports = {
|
|
231
230
|
context.report({
|
232
231
|
node,
|
233
232
|
messageId: "expected",
|
234
|
-
data: { identifier: node.name },
|
235
233
|
fix(fixer) {
|
236
234
|
if ((noNextLineToken ? getLastCommentLineOfBlock(nextLineNum) : lastToken.loc.end.line) === nextToken.loc.start.line) {
|
237
235
|
return fixer.insertTextBefore(nextToken, "\n\n");
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Require an empty line before `return` statements",
|
19
19
|
recommended: false,
|
20
|
-
url: "https://eslint.org/docs/rules/newline-before-return"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/newline-before-return"
|
21
21
|
},
|
22
22
|
|
23
23
|
fixable: "whitespace",
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
31
31
|
},
|
32
32
|
|
33
33
|
create(context) {
|
34
|
-
const sourceCode = context.
|
34
|
+
const sourceCode = context.sourceCode;
|
35
35
|
|
36
36
|
//--------------------------------------------------------------------------
|
37
37
|
// Helpers
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
docs: {
|
21
21
|
description: "Require a newline after each call in a method chain",
|
22
22
|
recommended: false,
|
23
|
-
url: "https://eslint.org/docs/rules/newline-per-chained-call"
|
23
|
+
url: "https://eslint.org/docs/latest/rules/newline-per-chained-call"
|
24
24
|
},
|
25
25
|
|
26
26
|
fixable: "whitespace",
|
@@ -47,7 +47,7 @@ module.exports = {
|
|
47
47
|
const options = context.options[0] || {},
|
48
48
|
ignoreChainWithDepth = options.ignoreChainWithDepth || 2;
|
49
49
|
|
50
|
-
const sourceCode = context.
|
50
|
+
const sourceCode = context.sourceCode;
|
51
51
|
|
52
52
|
/**
|
53
53
|
* Get the prefix of a given MemberExpression node.
|
package/lib/rules/no-alert.js
CHANGED
@@ -90,7 +90,7 @@ module.exports = {
|
|
90
90
|
docs: {
|
91
91
|
description: "Disallow the use of `alert`, `confirm`, and `prompt`",
|
92
92
|
recommended: false,
|
93
|
-
url: "https://eslint.org/docs/rules/no-alert"
|
93
|
+
url: "https://eslint.org/docs/latest/rules/no-alert"
|
94
94
|
},
|
95
95
|
|
96
96
|
schema: [],
|
@@ -101,7 +101,7 @@ module.exports = {
|
|
101
101
|
},
|
102
102
|
|
103
103
|
create(context) {
|
104
|
-
const sourceCode = context.
|
104
|
+
const sourceCode = context.sourceCode;
|
105
105
|
|
106
106
|
return {
|
107
107
|
CallExpression(node) {
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
docs: {
|
17
17
|
description: "Disallow using an async function as a Promise executor",
|
18
18
|
recommended: true,
|
19
|
-
url: "https://eslint.org/docs/rules/no-async-promise-executor"
|
19
|
+
url: "https://eslint.org/docs/latest/rules/no-async-promise-executor"
|
20
20
|
},
|
21
21
|
|
22
22
|
fixable: null,
|
@@ -30,7 +30,7 @@ module.exports = {
|
|
30
30
|
return {
|
31
31
|
"NewExpression[callee.name='Promise'][arguments.0.async=true]"(node) {
|
32
32
|
context.report({
|
33
|
-
node: context.
|
33
|
+
node: context.sourceCode.getFirstToken(node.arguments[0], token => token.value === "async"),
|
34
34
|
messageId: "async"
|
35
35
|
});
|
36
36
|
}
|
package/lib/rules/no-bitwise.js
CHANGED
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
docs: {
|
22
22
|
description: "Disallow use of the `Buffer()` constructor",
|
23
23
|
recommended: false,
|
24
|
-
url: "https://eslint.org/docs/rules/no-buffer-constructor"
|
24
|
+
url: "https://eslint.org/docs/latest/rules/no-buffer-constructor"
|
25
25
|
},
|
26
26
|
|
27
27
|
schema: [],
|
package/lib/rules/no-caller.js
CHANGED
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Disallow the use of `arguments.caller` or `arguments.callee`",
|
19
19
|
recommended: false,
|
20
|
-
url: "https://eslint.org/docs/rules/no-caller"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/no-caller"
|
21
21
|
},
|
22
22
|
|
23
23
|
schema: [],
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
docs: {
|
17
17
|
description: "Disallow lexical declarations in case clauses",
|
18
18
|
recommended: true,
|
19
|
-
url: "https://eslint.org/docs/rules/no-case-declarations"
|
19
|
+
url: "https://eslint.org/docs/latest/rules/no-case-declarations"
|
20
20
|
},
|
21
21
|
|
22
22
|
schema: [],
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
docs: {
|
25
25
|
description: "Disallow `catch` clause parameters from shadowing variables in the outer scope",
|
26
26
|
recommended: false,
|
27
|
-
url: "https://eslint.org/docs/rules/no-catch-shadow"
|
27
|
+
url: "https://eslint.org/docs/latest/rules/no-catch-shadow"
|
28
28
|
},
|
29
29
|
|
30
30
|
replacedBy: ["no-shadow"],
|
@@ -39,7 +39,7 @@ module.exports = {
|
|
39
39
|
|
40
40
|
create(context) {
|
41
41
|
|
42
|
-
const sourceCode = context.
|
42
|
+
const sourceCode = context.sourceCode;
|
43
43
|
|
44
44
|
//--------------------------------------------------------------------------
|
45
45
|
// Helpers
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Disallow reassigning class members",
|
21
21
|
recommended: true,
|
22
|
-
url: "https://eslint.org/docs/rules/no-class-assign"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/no-class-assign"
|
23
23
|
},
|
24
24
|
|
25
25
|
schema: [],
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
31
31
|
|
32
32
|
create(context) {
|
33
33
|
|
34
|
-
const sourceCode = context.
|
34
|
+
const sourceCode = context.sourceCode;
|
35
35
|
|
36
36
|
/**
|
37
37
|
* Finds and reports references that are non initializer and writable.
|
@@ -36,7 +36,7 @@ module.exports = {
|
|
36
36
|
docs: {
|
37
37
|
description: "Disallow assignment operators in conditional expressions",
|
38
38
|
recommended: true,
|
39
|
-
url: "https://eslint.org/docs/rules/no-cond-assign"
|
39
|
+
url: "https://eslint.org/docs/latest/rules/no-cond-assign"
|
40
40
|
},
|
41
41
|
|
42
42
|
schema: [
|
@@ -57,7 +57,7 @@ module.exports = {
|
|
57
57
|
|
58
58
|
const prohibitAssign = (context.options[0] || "except-parens");
|
59
59
|
|
60
|
-
const sourceCode = context.
|
60
|
+
const sourceCode = context.sourceCode;
|
61
61
|
|
62
62
|
/**
|
63
63
|
* Check whether an AST node is the test expression for a conditional statement.
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
33
33
|
docs: {
|
34
34
|
description: "Disallow arrow functions where they could be confused with comparisons",
|
35
35
|
recommended: false,
|
36
|
-
url: "https://eslint.org/docs/rules/no-confusing-arrow"
|
36
|
+
url: "https://eslint.org/docs/latest/rules/no-confusing-arrow"
|
37
37
|
},
|
38
38
|
|
39
39
|
fixable: "code",
|
@@ -56,7 +56,7 @@ module.exports = {
|
|
56
56
|
const config = context.options[0] || {};
|
57
57
|
const allowParens = config.allowParens || (config.allowParens === void 0);
|
58
58
|
const onlyOneSimpleParam = config.onlyOneSimpleParam;
|
59
|
-
const sourceCode = context.
|
59
|
+
const sourceCode = context.sourceCode;
|
60
60
|
|
61
61
|
|
62
62
|
/**
|
package/lib/rules/no-console.js
CHANGED
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Disallow the use of `console`",
|
25
25
|
recommended: false,
|
26
|
-
url: "https://eslint.org/docs/rules/no-console"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/no-console"
|
27
27
|
},
|
28
28
|
|
29
29
|
schema: [
|
@@ -51,7 +51,7 @@ module.exports = {
|
|
51
51
|
create(context) {
|
52
52
|
const options = context.options[0] || {};
|
53
53
|
const allowed = options.allow || [];
|
54
|
-
const sourceCode = context.
|
54
|
+
const sourceCode = context.sourceCode;
|
55
55
|
|
56
56
|
/**
|
57
57
|
* Checks whether the given reference is 'console' or not.
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Disallow reassigning `const` variables",
|
21
21
|
recommended: true,
|
22
|
-
url: "https://eslint.org/docs/rules/no-const-assign"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/no-const-assign"
|
23
23
|
},
|
24
24
|
|
25
25
|
schema: [],
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
31
31
|
|
32
32
|
create(context) {
|
33
33
|
|
34
|
-
const sourceCode = context.
|
34
|
+
const sourceCode = context.sourceCode;
|
35
35
|
|
36
36
|
/**
|
37
37
|
* Finds and reports references that are non initializer and writable.
|
@@ -441,7 +441,7 @@ module.exports = {
|
|
441
441
|
docs: {
|
442
442
|
description: "Disallow expressions where the operation doesn't affect the value",
|
443
443
|
recommended: false,
|
444
|
-
url: "https://eslint.org/docs/rules/no-constant-binary-expression"
|
444
|
+
url: "https://eslint.org/docs/latest/rules/no-constant-binary-expression"
|
445
445
|
},
|
446
446
|
schema: [],
|
447
447
|
messages: {
|
@@ -453,7 +453,7 @@ module.exports = {
|
|
453
453
|
},
|
454
454
|
|
455
455
|
create(context) {
|
456
|
-
const sourceCode = context.
|
456
|
+
const sourceCode = context.sourceCode;
|
457
457
|
|
458
458
|
return {
|
459
459
|
LogicalExpression(node) {
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Disallow constant expressions in conditions",
|
25
25
|
recommended: true,
|
26
|
-
url: "https://eslint.org/docs/rules/no-constant-condition"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/no-constant-condition"
|
27
27
|
},
|
28
28
|
|
29
29
|
schema: [
|
@@ -48,7 +48,7 @@ module.exports = {
|
|
48
48
|
const options = context.options[0] || {},
|
49
49
|
checkLoops = options.checkLoops !== false,
|
50
50
|
loopSetStack = [];
|
51
|
-
const sourceCode = context.
|
51
|
+
const sourceCode = context.sourceCode;
|
52
52
|
|
53
53
|
let loopsInCurrentScope = new Set();
|
54
54
|
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Disallow returning value from constructor",
|
19
19
|
recommended: false,
|
20
|
-
url: "https://eslint.org/docs/rules/no-constructor-return"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/no-constructor-return"
|
21
21
|
},
|
22
22
|
|
23
23
|
schema: {},
|
package/lib/rules/no-continue.js
CHANGED
@@ -14,6 +14,16 @@ const collector = new (class {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
onPatternEnter() {
|
17
|
+
|
18
|
+
/*
|
19
|
+
* `RegExpValidator` may parse the pattern twice in one `validatePattern`.
|
20
|
+
* So `this._controlChars` should be cleared here as well.
|
21
|
+
*
|
22
|
+
* For example, the `/(?<a>\x1f)/` regex will parse the pattern twice.
|
23
|
+
* This is based on the content described in Annex B.
|
24
|
+
* If the regex contains a `GroupName` and the `u` flag is not used, `ParseText` will be called twice.
|
25
|
+
* See https://tc39.es/ecma262/2023/multipage/additional-ecmascript-features-for-web-browsers.html#sec-parsepattern-annexb
|
26
|
+
*/
|
17
27
|
this._controlChars = [];
|
18
28
|
}
|
19
29
|
|
@@ -32,10 +42,13 @@ const collector = new (class {
|
|
32
42
|
|
33
43
|
collectControlChars(regexpStr, flags) {
|
34
44
|
const uFlag = typeof flags === "string" && flags.includes("u");
|
45
|
+
const vFlag = typeof flags === "string" && flags.includes("v");
|
46
|
+
|
47
|
+
this._controlChars = [];
|
48
|
+
this._source = regexpStr;
|
35
49
|
|
36
50
|
try {
|
37
|
-
this.
|
38
|
-
this._validator.validatePattern(regexpStr, void 0, void 0, uFlag); // Call onCharacter hook
|
51
|
+
this._validator.validatePattern(regexpStr, void 0, void 0, { unicode: uFlag, unicodeSets: vFlag }); // Call onCharacter hook
|
39
52
|
} catch {
|
40
53
|
|
41
54
|
// Ignore syntax errors in RegExp.
|
@@ -56,7 +69,7 @@ module.exports = {
|
|
56
69
|
docs: {
|
57
70
|
description: "Disallow control characters in regular expressions",
|
58
71
|
recommended: true,
|
59
|
-
url: "https://eslint.org/docs/rules/no-control-regex"
|
72
|
+
url: "https://eslint.org/docs/latest/rules/no-control-regex"
|
60
73
|
},
|
61
74
|
|
62
75
|
schema: [],
|
package/lib/rules/no-debugger.js
CHANGED
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Disallow equal signs explicitly at the beginning of regular expressions",
|
19
19
|
recommended: false,
|
20
|
-
url: "https://eslint.org/docs/rules/no-div-regex"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/no-div-regex"
|
21
21
|
},
|
22
22
|
|
23
23
|
fixable: "code",
|
@@ -30,7 +30,7 @@ module.exports = {
|
|
30
30
|
},
|
31
31
|
|
32
32
|
create(context) {
|
33
|
-
const sourceCode = context.
|
33
|
+
const sourceCode = context.sourceCode;
|
34
34
|
|
35
35
|
return {
|
36
36
|
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Disallow duplicate arguments in `function` definitions",
|
19
19
|
recommended: true,
|
20
|
-
url: "https://eslint.org/docs/rules/no-dupe-args"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/no-dupe-args"
|
21
21
|
},
|
22
22
|
|
23
23
|
schema: [],
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
29
29
|
|
30
30
|
create(context) {
|
31
31
|
|
32
|
-
const sourceCode = context.
|
32
|
+
const sourceCode = context.sourceCode;
|
33
33
|
|
34
34
|
//--------------------------------------------------------------------------
|
35
35
|
// Helpers
|
@@ -54,7 +54,7 @@ module.exports = {
|
|
54
54
|
docs: {
|
55
55
|
description: "Disallow duplicate conditions in if-else-if chains",
|
56
56
|
recommended: true,
|
57
|
-
url: "https://eslint.org/docs/rules/no-dupe-else-if"
|
57
|
+
url: "https://eslint.org/docs/latest/rules/no-dupe-else-if"
|
58
58
|
},
|
59
59
|
|
60
60
|
schema: [],
|
@@ -65,7 +65,7 @@ module.exports = {
|
|
65
65
|
},
|
66
66
|
|
67
67
|
create(context) {
|
68
|
-
const sourceCode = context.
|
68
|
+
const sourceCode = context.sourceCode;
|
69
69
|
|
70
70
|
/**
|
71
71
|
* Determines whether the two given nodes are considered to be equal. In particular, given that the nodes
|