eslint 8.17.0 → 8.20.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 +4 -15
- package/lib/linter/linter.js +55 -4
- package/lib/linter/timing.js +2 -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 +1 -1
- package/lib/rules/comma-dangle.js +1 -1
- package/lib/rules/comma-spacing.js +36 -42
- 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 +3 -3
- package/lib/rules/init-declarations.js +1 -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/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 +1 -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 +1 -1
- 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 +1 -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.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 +1 -1
- package/lib/rules/no-loss-of-precision.js +1 -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-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-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 +77 -12
- 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 +5 -5
- package/lib/rules/no-use-before-define.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 +27 -41
- 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-jsdoc.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-jsdoc.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/shared/deprecation-warnings.js +1 -8
- package/package.json +5 -6
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
type: "problem",
|
25
25
|
|
26
26
|
docs: {
|
27
|
-
description: "
|
27
|
+
description: "Disallow use of optional chaining in contexts where the `undefined` value is not allowed",
|
28
28
|
recommended: true,
|
29
29
|
url: "https://eslint.org/docs/rules/no-unsafe-optional-chaining"
|
30
30
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "problem",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Disallow unused private class members",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/no-unused-private-class-members"
|
21
21
|
},
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
33
33
|
type: "problem",
|
34
34
|
|
35
35
|
docs: {
|
36
|
-
description: "
|
36
|
+
description: "Disallow unused variables",
|
37
37
|
recommended: true,
|
38
38
|
url: "https://eslint.org/docs/rules/no-unused-vars"
|
39
39
|
},
|
@@ -484,12 +484,12 @@ module.exports = {
|
|
484
484
|
}
|
485
485
|
|
486
486
|
/**
|
487
|
-
* Determine if an identifier is used either in for-in loops.
|
487
|
+
* Determine if an identifier is used either in for-in or for-of loops.
|
488
488
|
* @param {Reference} ref The reference to check.
|
489
489
|
* @returns {boolean} whether reference is used in the for-in loops
|
490
490
|
* @private
|
491
491
|
*/
|
492
|
-
function
|
492
|
+
function isForInOfRef(ref) {
|
493
493
|
let target = ref.identifier.parent;
|
494
494
|
|
495
495
|
|
@@ -498,7 +498,7 @@ module.exports = {
|
|
498
498
|
target = target.parent.parent;
|
499
499
|
}
|
500
500
|
|
501
|
-
if (target.type !== "ForInStatement") {
|
501
|
+
if (target.type !== "ForInStatement" && target.type !== "ForOfStatement") {
|
502
502
|
return false;
|
503
503
|
}
|
504
504
|
|
@@ -531,7 +531,7 @@ module.exports = {
|
|
531
531
|
let rhsNode = null;
|
532
532
|
|
533
533
|
return variable.references.some(ref => {
|
534
|
-
if (
|
534
|
+
if (isForInOfRef(ref)) {
|
535
535
|
return true;
|
536
536
|
}
|
537
537
|
|
@@ -226,7 +226,7 @@ module.exports = {
|
|
226
226
|
type: "problem",
|
227
227
|
|
228
228
|
docs: {
|
229
|
-
description: "
|
229
|
+
description: "Disallow the use of variables before they are defined",
|
230
230
|
recommended: false,
|
231
231
|
url: "https://eslint.org/docs/rules/no-use-before-define"
|
232
232
|
},
|
@@ -64,7 +64,7 @@ module.exports = {
|
|
64
64
|
type: "problem",
|
65
65
|
|
66
66
|
docs: {
|
67
|
-
description: "
|
67
|
+
description: "Disallow useless backreferences in regular expressions",
|
68
68
|
recommended: true,
|
69
69
|
url: "https://eslint.org/docs/rules/no-useless-backreference"
|
70
70
|
},
|
@@ -55,7 +55,7 @@ module.exports = {
|
|
55
55
|
type: "suggestion",
|
56
56
|
|
57
57
|
docs: {
|
58
|
-
description: "
|
58
|
+
description: "Disallow unnecessary calls to `.call()` and `.apply()`",
|
59
59
|
recommended: false,
|
60
60
|
url: "https://eslint.org/docs/rules/no-useless-call"
|
61
61
|
},
|
@@ -91,7 +91,7 @@ module.exports = {
|
|
91
91
|
type: "suggestion",
|
92
92
|
|
93
93
|
docs: {
|
94
|
-
description: "
|
94
|
+
description: "Disallow unnecessary computed property keys in objects and classes",
|
95
95
|
recommended: false,
|
96
96
|
url: "https://eslint.org/docs/rules/no-useless-computed-key"
|
97
97
|
},
|
@@ -70,7 +70,7 @@ module.exports = {
|
|
70
70
|
type: "suggestion",
|
71
71
|
|
72
72
|
docs: {
|
73
|
-
description: "
|
73
|
+
description: "Disallow unnecessary concatenation of literals or template literals",
|
74
74
|
recommended: false,
|
75
75
|
url: "https://eslint.org/docs/rules/no-useless-concat"
|
76
76
|
},
|
@@ -138,7 +138,7 @@ module.exports = {
|
|
138
138
|
type: "suggestion",
|
139
139
|
|
140
140
|
docs: {
|
141
|
-
description: "
|
141
|
+
description: "Disallow unnecessary constructors",
|
142
142
|
recommended: false,
|
143
143
|
url: "https://eslint.org/docs/rules/no-useless-constructor"
|
144
144
|
},
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
type: "suggestion",
|
22
22
|
|
23
23
|
docs: {
|
24
|
-
description: "
|
24
|
+
description: "Disallow renaming import, export, and destructured assignments to the same name",
|
25
25
|
recommended: false,
|
26
26
|
url: "https://eslint.org/docs/rules/no-useless-rename"
|
27
27
|
},
|
package/lib/rules/no-var.js
CHANGED
@@ -185,7 +185,7 @@ module.exports = {
|
|
185
185
|
type: "suggestion",
|
186
186
|
|
187
187
|
docs: {
|
188
|
-
description: "
|
188
|
+
description: "Require `let` or `const` instead of `var`",
|
189
189
|
recommended: false,
|
190
190
|
url: "https://eslint.org/docs/rules/no-var"
|
191
191
|
},
|
package/lib/rules/no-void.js
CHANGED
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "suggestion",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Disallow specified warning terms in comments",
|
24
24
|
recommended: false,
|
25
25
|
url: "https://eslint.org/docs/rules/no-warning-comments"
|
26
26
|
},
|
@@ -64,59 +64,45 @@ module.exports = {
|
|
64
64
|
*/
|
65
65
|
function convertToRegExp(term) {
|
66
66
|
const escaped = escapeRegExp(term);
|
67
|
-
const wordBoundary = "\\b";
|
68
|
-
const eitherOrWordBoundary = `|${wordBoundary}`;
|
69
|
-
let prefix;
|
70
67
|
|
71
68
|
/*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
*
|
69
|
+
* When matching at the start, ignore leading whitespace, and
|
70
|
+
* there's no need to worry about word boundaries.
|
71
|
+
*
|
72
|
+
* These expressions for the prefix and suffix are designed as follows:
|
73
|
+
* ^ handles any terms at the beginning of a comment.
|
74
|
+
* e.g. terms ["TODO"] matches `//TODO something`
|
75
|
+
* $ handles any terms at the end of a comment
|
76
|
+
* e.g. terms ["TODO"] matches `// something TODO`
|
77
|
+
* \s* handles optional leading spaces (for "start" location only)
|
78
|
+
* e.g. terms ["TODO"] matches `// TODO something`
|
79
|
+
* \b handles terms preceded/followed by word boundary
|
80
|
+
* e.g. terms: ["!FIX", "FIX!"] matches `// FIX!something` or `// something!FIX`
|
81
|
+
* terms: ["FIX"] matches `// FIX!` or `// !FIX`, but not `// fixed or affix`
|
80
82
|
*/
|
81
|
-
const
|
83
|
+
const wordBoundary = "\\b";
|
82
84
|
|
83
|
-
|
85
|
+
let prefix = "";
|
84
86
|
|
85
|
-
|
86
|
-
* When matching at the start, ignore leading whitespace, and
|
87
|
-
* there's no need to worry about word boundaries.
|
88
|
-
*/
|
87
|
+
if (location === "start") {
|
89
88
|
prefix = "^\\s*";
|
90
89
|
} else if (/^\w/u.test(term)) {
|
91
90
|
prefix = wordBoundary;
|
92
|
-
} else {
|
93
|
-
prefix = "";
|
94
91
|
}
|
95
92
|
|
96
|
-
|
97
|
-
|
98
|
-
/*
|
99
|
-
* For location "start" the regex should be
|
100
|
-
* ^\s*TERM\b. This checks the word boundary
|
101
|
-
* at the beginning of the comment.
|
102
|
-
*/
|
103
|
-
return new RegExp(prefix + escaped + suffix, "iu");
|
104
|
-
}
|
93
|
+
const suffix = /\w$/u.test(term) ? wordBoundary : "";
|
94
|
+
const flags = "iu"; // Case-insensitive with Unicode case folding.
|
105
95
|
|
106
96
|
/*
|
107
|
-
* For location "
|
108
|
-
*
|
109
|
-
*
|
97
|
+
* For location "start", the typical regex is:
|
98
|
+
* /^\s*ESCAPED_TERM\b/iu.
|
99
|
+
*
|
100
|
+
* For location "anywhere" the typical regex is
|
101
|
+
* /\bESCAPED_TERM\b/iu
|
102
|
+
*
|
103
|
+
* If it starts or ends with non-word character, the prefix and suffix empty, respectively.
|
110
104
|
*/
|
111
|
-
return new RegExp(
|
112
|
-
prefix +
|
113
|
-
escaped +
|
114
|
-
suffix +
|
115
|
-
eitherOrWordBoundary +
|
116
|
-
term +
|
117
|
-
wordBoundary,
|
118
|
-
"iu"
|
119
|
-
);
|
105
|
+
return new RegExp(`${prefix}${escaped}${suffix}`, flags);
|
120
106
|
}
|
121
107
|
|
122
108
|
const warningRegExps = warningTerms.map(convertToRegExp);
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "layout",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Disallow whitespace before properties",
|
24
24
|
recommended: false,
|
25
25
|
url: "https://eslint.org/docs/rules/no-whitespace-before-property"
|
26
26
|
},
|
package/lib/rules/no-with.js
CHANGED
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "layout",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Enforce the location of single-line statements",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/nonblock-statement-body-position"
|
22
22
|
},
|
@@ -150,7 +150,7 @@ module.exports = {
|
|
150
150
|
type: "layout",
|
151
151
|
|
152
152
|
docs: {
|
153
|
-
description: "
|
153
|
+
description: "Enforce consistent line breaks after opening and before closing braces",
|
154
154
|
recommended: false,
|
155
155
|
url: "https://eslint.org/docs/rules/object-curly-newline"
|
156
156
|
},
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "layout",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Enforce consistent spacing inside braces",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/object-curly-spacing"
|
22
22
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "layout",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Enforce placing object properties on separate lines",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/object-property-newline"
|
21
21
|
},
|
@@ -28,7 +28,7 @@ module.exports = {
|
|
28
28
|
type: "suggestion",
|
29
29
|
|
30
30
|
docs: {
|
31
|
-
description: "
|
31
|
+
description: "Require or disallow method and property shorthand syntax for object literals",
|
32
32
|
recommended: false,
|
33
33
|
url: "https://eslint.org/docs/rules/object-shorthand"
|
34
34
|
},
|
@@ -14,7 +14,7 @@ module.exports = {
|
|
14
14
|
type: "suggestion",
|
15
15
|
|
16
16
|
docs: {
|
17
|
-
description: "
|
17
|
+
description: "Require or disallow newlines around variable declarations",
|
18
18
|
recommended: false,
|
19
19
|
url: "https://eslint.org/docs/rules/one-var-declaration-per-line"
|
20
20
|
},
|
package/lib/rules/one-var.js
CHANGED
@@ -34,7 +34,7 @@ module.exports = {
|
|
34
34
|
type: "suggestion",
|
35
35
|
|
36
36
|
docs: {
|
37
|
-
description: "
|
37
|
+
description: "Enforce variables to be declared either together or separately in functions",
|
38
38
|
recommended: false,
|
39
39
|
url: "https://eslint.org/docs/rules/one-var"
|
40
40
|
},
|
@@ -63,7 +63,7 @@ module.exports = {
|
|
63
63
|
type: "suggestion",
|
64
64
|
|
65
65
|
docs: {
|
66
|
-
description: "
|
66
|
+
description: "Require or disallow assignment operator shorthand where possible",
|
67
67
|
recommended: false,
|
68
68
|
url: "https://eslint.org/docs/rules/operator-assignment"
|
69
69
|
},
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
type: "layout",
|
22
22
|
|
23
23
|
docs: {
|
24
|
-
description: "
|
24
|
+
description: "Enforce consistent linebreak style for operators",
|
25
25
|
recommended: false,
|
26
26
|
url: "https://eslint.org/docs/rules/operator-linebreak"
|
27
27
|
},
|
@@ -431,7 +431,7 @@ module.exports = {
|
|
431
431
|
type: "layout",
|
432
432
|
|
433
433
|
docs: {
|
434
|
-
description: "
|
434
|
+
description: "Require or disallow padding lines between statements",
|
435
435
|
recommended: false,
|
436
436
|
url: "https://eslint.org/docs/rules/padding-line-between-statements"
|
437
437
|
},
|
@@ -151,7 +151,7 @@ module.exports = {
|
|
151
151
|
type: "suggestion",
|
152
152
|
|
153
153
|
docs: {
|
154
|
-
description: "
|
154
|
+
description: "Require using arrow functions for callbacks",
|
155
155
|
recommended: false,
|
156
156
|
url: "https://eslint.org/docs/rules/prefer-arrow-callback"
|
157
157
|
},
|
@@ -332,7 +332,7 @@ module.exports = {
|
|
332
332
|
type: "suggestion",
|
333
333
|
|
334
334
|
docs: {
|
335
|
-
description: "
|
335
|
+
description: "Require `const` declarations for variables that are never reassigned after declared",
|
336
336
|
recommended: false,
|
337
337
|
url: "https://eslint.org/docs/rules/prefer-const"
|
338
338
|
},
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
26
26
|
type: "suggestion",
|
27
27
|
|
28
28
|
docs: {
|
29
|
-
description: "
|
29
|
+
description: "Require destructuring from arrays and/or objects",
|
30
30
|
recommended: false,
|
31
31
|
url: "https://eslint.org/docs/rules/prefer-destructuring"
|
32
32
|
},
|
@@ -90,7 +90,7 @@ module.exports = {
|
|
90
90
|
type: "suggestion",
|
91
91
|
|
92
92
|
docs: {
|
93
|
-
description: "
|
93
|
+
description: "Disallow the use of `Math.pow` in favor of the `**` operator",
|
94
94
|
recommended: false,
|
95
95
|
url: "https://eslint.org/docs/rules/prefer-exponentiation-operator"
|
96
96
|
},
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
33
33
|
type: "suggestion",
|
34
34
|
|
35
35
|
docs: {
|
36
|
-
description: "
|
36
|
+
description: "Enforce using named capture group in regular expression",
|
37
37
|
recommended: false,
|
38
38
|
url: "https://eslint.org/docs/rules/prefer-named-capture-group"
|
39
39
|
},
|
@@ -45,7 +45,7 @@ module.exports = {
|
|
45
45
|
type: "suggestion",
|
46
46
|
|
47
47
|
docs: {
|
48
|
-
description: "
|
48
|
+
description: "Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals",
|
49
49
|
recommended: false,
|
50
50
|
url: "https://eslint.org/docs/rules/prefer-numeric-literals"
|
51
51
|
},
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
50
50
|
type: "suggestion",
|
51
51
|
docs: {
|
52
52
|
description:
|
53
|
-
"
|
53
|
+
"Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`",
|
54
54
|
recommended: false,
|
55
55
|
url: "https://eslint.org/docs/rules/prefer-object-has-own"
|
56
56
|
},
|
@@ -247,7 +247,7 @@ module.exports = {
|
|
247
247
|
|
248
248
|
docs: {
|
249
249
|
description:
|
250
|
-
"
|
250
|
+
"Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.",
|
251
251
|
recommended: false,
|
252
252
|
url: "https://eslint.org/docs/rules/prefer-object-spread"
|
253
253
|
},
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "suggestion",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Require using Error objects as Promise rejection reasons",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/prefer-promise-reject-errors"
|
22
22
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require `Reflect` methods where applicable",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/prefer-reflect"
|
21
21
|
},
|
@@ -123,7 +123,7 @@ module.exports = {
|
|
123
123
|
type: "suggestion",
|
124
124
|
|
125
125
|
docs: {
|
126
|
-
description: "
|
126
|
+
description: "Disallow use of the `RegExp` constructor in favor of regular expression literals",
|
127
127
|
recommended: false,
|
128
128
|
url: "https://eslint.org/docs/rules/prefer-regex-literals"
|
129
129
|
},
|
@@ -65,7 +65,7 @@ module.exports = {
|
|
65
65
|
type: "suggestion",
|
66
66
|
|
67
67
|
docs: {
|
68
|
-
description: "
|
68
|
+
description: "Require rest parameters instead of `arguments`",
|
69
69
|
recommended: false,
|
70
70
|
url: "https://eslint.org/docs/rules/prefer-rest-params"
|
71
71
|
},
|
@@ -49,7 +49,7 @@ module.exports = {
|
|
49
49
|
type: "suggestion",
|
50
50
|
|
51
51
|
docs: {
|
52
|
-
description: "
|
52
|
+
description: "Require spread operators instead of `.apply()`",
|
53
53
|
recommended: false,
|
54
54
|
url: "https://eslint.org/docs/rules/prefer-spread"
|
55
55
|
},
|
@@ -128,7 +128,7 @@ module.exports = {
|
|
128
128
|
type: "suggestion",
|
129
129
|
|
130
130
|
docs: {
|
131
|
-
description: "
|
131
|
+
description: "Require template literals instead of string concatenation",
|
132
132
|
recommended: false,
|
133
133
|
url: "https://eslint.org/docs/rules/prefer-template"
|
134
134
|
},
|
package/lib/rules/quote-props.js
CHANGED
@@ -22,7 +22,7 @@ module.exports = {
|
|
22
22
|
type: "suggestion",
|
23
23
|
|
24
24
|
docs: {
|
25
|
-
description: "
|
25
|
+
description: "Require quotes around object literal property names",
|
26
26
|
recommended: false,
|
27
27
|
url: "https://eslint.org/docs/rules/quote-props"
|
28
28
|
},
|
package/lib/rules/quotes.js
CHANGED
@@ -80,7 +80,7 @@ module.exports = {
|
|
80
80
|
type: "layout",
|
81
81
|
|
82
82
|
docs: {
|
83
|
-
description: "
|
83
|
+
description: "Enforce the consistent use of either backticks, double, or single quotes",
|
84
84
|
recommended: false,
|
85
85
|
url: "https://eslint.org/docs/rules/quotes"
|
86
86
|
},
|
package/lib/rules/radix.js
CHANGED
@@ -80,7 +80,7 @@ module.exports = {
|
|
80
80
|
type: "suggestion",
|
81
81
|
|
82
82
|
docs: {
|
83
|
-
description: "
|
83
|
+
description: "Enforce the consistent use of the radix argument when using `parseInt()`",
|
84
84
|
recommended: false,
|
85
85
|
url: "https://eslint.org/docs/rules/radix"
|
86
86
|
},
|
@@ -171,7 +171,7 @@ module.exports = {
|
|
171
171
|
type: "problem",
|
172
172
|
|
173
173
|
docs: {
|
174
|
-
description: "
|
174
|
+
description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
175
175
|
recommended: false,
|
176
176
|
url: "https://eslint.org/docs/rules/require-atomic-updates"
|
177
177
|
},
|
@@ -34,7 +34,7 @@ module.exports = {
|
|
34
34
|
type: "suggestion",
|
35
35
|
|
36
36
|
docs: {
|
37
|
-
description: "
|
37
|
+
description: "Disallow async functions which have no `await` expression",
|
38
38
|
recommended: false,
|
39
39
|
url: "https://eslint.org/docs/rules/require-await"
|
40
40
|
},
|