eslint 8.16.0 → 8.19.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 +2 -7
- package/bin/eslint.js +1 -1
- package/lib/eslint/eslint.js +3 -3
- package/lib/linter/linter.js +5 -1
- 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 +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 +2 -2
- 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 +46 -14
- 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 +2 -2
- 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 +4 -4
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +16 -3
- 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-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/lib/shared/types.js +1 -1
- package/package.json +3 -2
@@ -43,7 +43,7 @@ module.exports = {
|
|
43
43
|
type: "problem",
|
44
44
|
|
45
45
|
docs: {
|
46
|
-
description: "
|
46
|
+
description: "Disallow calling global object properties as functions",
|
47
47
|
recommended: true,
|
48
48
|
url: "https://eslint.org/docs/rules/no-obj-calls"
|
49
49
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Disallow octal escape sequences in string literals",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/no-octal-escape"
|
21
21
|
},
|
package/lib/rules/no-octal.js
CHANGED
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Disallow octal literals",
|
19
19
|
recommended: true,
|
20
20
|
url: "https://eslint.org/docs/rules/no-octal"
|
21
21
|
},
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
schema: [],
|
24
24
|
|
25
25
|
messages: {
|
26
|
-
|
26
|
+
noOctal: "Octal literals should not be used."
|
27
27
|
}
|
28
28
|
},
|
29
29
|
|
@@ -35,7 +35,7 @@ module.exports = {
|
|
35
35
|
if (typeof node.value === "number" && /^0[0-9]/u.test(node.raw)) {
|
36
36
|
context.report({
|
37
37
|
node,
|
38
|
-
messageId: "
|
38
|
+
messageId: "noOctal"
|
39
39
|
});
|
40
40
|
}
|
41
41
|
}
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "suggestion",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Disallow reassigning `function` parameters",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/no-param-reassign"
|
22
22
|
},
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
type: "suggestion",
|
20
20
|
|
21
21
|
docs: {
|
22
|
-
description: "
|
22
|
+
description: "Disallow string concatenation with `__dirname` and `__filename`",
|
23
23
|
recommended: false,
|
24
24
|
url: "https://eslint.org/docs/rules/no-path-concat"
|
25
25
|
},
|
package/lib/rules/no-plusplus.js
CHANGED
@@ -51,7 +51,7 @@ module.exports = {
|
|
51
51
|
type: "suggestion",
|
52
52
|
|
53
53
|
docs: {
|
54
|
-
description: "
|
54
|
+
description: "Disallow the unary operators `++` and `--`",
|
55
55
|
recommended: false,
|
56
56
|
url: "https://eslint.org/docs/rules/no-plusplus"
|
57
57
|
},
|
@@ -69,7 +69,7 @@ module.exports = {
|
|
69
69
|
type: "problem",
|
70
70
|
|
71
71
|
docs: {
|
72
|
-
description: "
|
72
|
+
description: "Disallow returning values from Promise executor functions",
|
73
73
|
recommended: false,
|
74
74
|
url: "https://eslint.org/docs/rules/no-promise-executor-return"
|
75
75
|
},
|
package/lib/rules/no-proto.js
CHANGED
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
type: "suggestion",
|
22
22
|
|
23
23
|
docs: {
|
24
|
-
description: "
|
24
|
+
description: "Disallow the use of the `__proto__` property",
|
25
25
|
recommended: false,
|
26
26
|
url: "https://eslint.org/docs/rules/no-proto"
|
27
27
|
},
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "problem",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Disallow calling some `Object.prototype` methods directly on objects",
|
24
24
|
recommended: true,
|
25
25
|
url: "https://eslint.org/docs/rules/no-prototype-builtins"
|
26
26
|
},
|
@@ -39,7 +39,7 @@ module.exports = {
|
|
39
39
|
type: "suggestion",
|
40
40
|
|
41
41
|
docs: {
|
42
|
-
description: "
|
42
|
+
description: "Disallow multiple spaces in regular expressions",
|
43
43
|
recommended: true,
|
44
44
|
url: "https://eslint.org/docs/rules/no-regex-spaces"
|
45
45
|
},
|
@@ -58,6 +58,14 @@ const arrayOfStringsOrObjectPatterns = {
|
|
58
58
|
items: {
|
59
59
|
type: "object",
|
60
60
|
properties: {
|
61
|
+
importNames: {
|
62
|
+
type: "array",
|
63
|
+
items: {
|
64
|
+
type: "string"
|
65
|
+
},
|
66
|
+
minItems: 1,
|
67
|
+
uniqueItems: true
|
68
|
+
},
|
61
69
|
group: {
|
62
70
|
type: "array",
|
63
71
|
items: {
|
@@ -88,7 +96,7 @@ module.exports = {
|
|
88
96
|
type: "suggestion",
|
89
97
|
|
90
98
|
docs: {
|
91
|
-
description: "
|
99
|
+
description: "Disallow specified modules when loaded by `import`",
|
92
100
|
recommended: false,
|
93
101
|
url: "https://eslint.org/docs/rules/no-restricted-imports"
|
94
102
|
},
|
@@ -102,6 +110,14 @@ module.exports = {
|
|
102
110
|
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
103
111
|
patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}",
|
104
112
|
|
113
|
+
patternAndImportName: "'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern.",
|
114
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
115
|
+
patternAndImportNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}",
|
116
|
+
|
117
|
+
patternAndEverything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern.",
|
118
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
119
|
+
patternAndEverythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}",
|
120
|
+
|
105
121
|
everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.",
|
106
122
|
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
107
123
|
everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}",
|
@@ -159,9 +175,10 @@ module.exports = {
|
|
159
175
|
}
|
160
176
|
|
161
177
|
// relative paths are supported for this rule
|
162
|
-
const restrictedPatternGroups = restrictedPatterns.map(({ group, message, caseSensitive }) => ({
|
178
|
+
const restrictedPatternGroups = restrictedPatterns.map(({ group, message, caseSensitive, importNames }) => ({
|
163
179
|
matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group),
|
164
|
-
customMessage: message
|
180
|
+
customMessage: message,
|
181
|
+
importNames
|
165
182
|
}));
|
166
183
|
|
167
184
|
// if no imports are restricted we don't need to check
|
@@ -234,20 +251,68 @@ module.exports = {
|
|
234
251
|
/**
|
235
252
|
* Report a restricted path specifically for patterns.
|
236
253
|
* @param {node} node representing the restricted path reference
|
237
|
-
* @param {Object} group contains
|
254
|
+
* @param {Object} group contains an Ignore instance for paths, the customMessage to show on failure,
|
255
|
+
* and any restricted import names that have been specified in the config
|
256
|
+
* @param {Map<string,Object[]>} importNames Map of import names that are being imported
|
238
257
|
* @returns {void}
|
239
258
|
* @private
|
240
259
|
*/
|
241
|
-
function reportPathForPatterns(node, group) {
|
260
|
+
function reportPathForPatterns(node, group, importNames) {
|
242
261
|
const importSource = node.source.value.trim();
|
243
262
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
263
|
+
const customMessage = group.customMessage;
|
264
|
+
const restrictedImportNames = group.importNames;
|
265
|
+
|
266
|
+
/*
|
267
|
+
* If we are not restricting to any specific import names and just the pattern itself,
|
268
|
+
* report the error and move on
|
269
|
+
*/
|
270
|
+
if (!restrictedImportNames) {
|
271
|
+
context.report({
|
272
|
+
node,
|
273
|
+
messageId: customMessage ? "patternWithCustomMessage" : "patterns",
|
274
|
+
data: {
|
275
|
+
importSource,
|
276
|
+
customMessage
|
277
|
+
}
|
278
|
+
});
|
279
|
+
return;
|
280
|
+
}
|
281
|
+
|
282
|
+
if (importNames.has("*")) {
|
283
|
+
const specifierData = importNames.get("*")[0];
|
284
|
+
|
285
|
+
context.report({
|
286
|
+
node,
|
287
|
+
messageId: customMessage ? "patternAndEverythingWithCustomMessage" : "patternAndEverything",
|
288
|
+
loc: specifierData.loc,
|
289
|
+
data: {
|
290
|
+
importSource,
|
291
|
+
importNames: restrictedImportNames,
|
292
|
+
customMessage
|
293
|
+
}
|
294
|
+
});
|
295
|
+
}
|
296
|
+
|
297
|
+
restrictedImportNames.forEach(importName => {
|
298
|
+
if (!importNames.has(importName)) {
|
299
|
+
return;
|
250
300
|
}
|
301
|
+
|
302
|
+
const specifiers = importNames.get(importName);
|
303
|
+
|
304
|
+
specifiers.forEach(specifier => {
|
305
|
+
context.report({
|
306
|
+
node,
|
307
|
+
messageId: customMessage ? "patternAndImportNameWithCustomMessage" : "patternAndImportName",
|
308
|
+
loc: specifier.loc,
|
309
|
+
data: {
|
310
|
+
importSource,
|
311
|
+
customMessage,
|
312
|
+
importName
|
313
|
+
}
|
314
|
+
});
|
315
|
+
});
|
251
316
|
});
|
252
317
|
}
|
253
318
|
|
@@ -304,7 +369,7 @@ module.exports = {
|
|
304
369
|
checkRestrictedPathAndReport(importSource, importNames, node);
|
305
370
|
restrictedPatternGroups.forEach(group => {
|
306
371
|
if (isRestrictedPattern(importSource, group)) {
|
307
|
-
reportPathForPatterns(node, group);
|
372
|
+
reportPathForPatterns(node, group, importNames);
|
308
373
|
}
|
309
374
|
});
|
310
375
|
}
|
@@ -49,7 +49,7 @@ module.exports = {
|
|
49
49
|
type: "suggestion",
|
50
50
|
|
51
51
|
docs: {
|
52
|
-
description: "
|
52
|
+
description: "Disallow specified modules when loaded by `require`",
|
53
53
|
recommended: false,
|
54
54
|
url: "https://eslint.org/docs/rules/no-restricted-modules"
|
55
55
|
},
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
type: "suggestion",
|
18
18
|
|
19
19
|
docs: {
|
20
|
-
description: "
|
20
|
+
description: "Disallow certain properties on certain objects",
|
21
21
|
recommended: false,
|
22
22
|
url: "https://eslint.org/docs/rules/no-restricted-properties"
|
23
23
|
},
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
26
26
|
type: "suggestion",
|
27
27
|
|
28
28
|
docs: {
|
29
|
-
description: "
|
29
|
+
description: "Disallow assignment operators in `return` statements",
|
30
30
|
recommended: false,
|
31
31
|
url: "https://eslint.org/docs/rules/no-return-assign"
|
32
32
|
},
|
@@ -130,7 +130,7 @@ module.exports = {
|
|
130
130
|
type: "problem",
|
131
131
|
|
132
132
|
docs: {
|
133
|
-
description: "
|
133
|
+
description: "Disallow assignments where both sides are exactly the same",
|
134
134
|
recommended: true,
|
135
135
|
url: "https://eslint.org/docs/rules/no-self-assign"
|
136
136
|
},
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "problem",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Disallow comparisons where both sides are exactly the same",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/no-self-compare"
|
22
22
|
},
|
@@ -142,7 +142,7 @@ module.exports = {
|
|
142
142
|
type: "problem",
|
143
143
|
|
144
144
|
docs: {
|
145
|
-
description: "
|
145
|
+
description: "Disallow returning values from setters",
|
146
146
|
recommended: true,
|
147
147
|
url: "https://eslint.org/docs/rules/no-setter-return"
|
148
148
|
},
|
@@ -27,7 +27,7 @@ module.exports = {
|
|
27
27
|
type: "suggestion",
|
28
28
|
|
29
29
|
docs: {
|
30
|
-
description: "
|
30
|
+
description: "Disallow identifiers from shadowing restricted names",
|
31
31
|
recommended: true,
|
32
32
|
url: "https://eslint.org/docs/rules/no-shadow-restricted-names"
|
33
33
|
},
|
package/lib/rules/no-shadow.js
CHANGED
@@ -30,7 +30,7 @@ module.exports = {
|
|
30
30
|
type: "suggestion",
|
31
31
|
|
32
32
|
docs: {
|
33
|
-
description: "
|
33
|
+
description: "Disallow variable declarations from shadowing variables declared in the outer scope",
|
34
34
|
recommended: false,
|
35
35
|
url: "https://eslint.org/docs/rules/no-shadow"
|
36
36
|
},
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "layout",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Disallow spacing between function identifiers and their applications (deprecated)",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/no-spaced-func"
|
22
22
|
},
|
package/lib/rules/no-sync.js
CHANGED
package/lib/rules/no-tabs.js
CHANGED
@@ -14,7 +14,7 @@ module.exports = {
|
|
14
14
|
type: "problem",
|
15
15
|
|
16
16
|
docs: {
|
17
|
-
description: "
|
17
|
+
description: "Disallow template literal placeholder syntax in regular strings",
|
18
18
|
recommended: false,
|
19
19
|
url: "https://eslint.org/docs/rules/no-template-curly-in-string"
|
20
20
|
},
|
package/lib/rules/no-ternary.js
CHANGED
@@ -40,7 +40,7 @@ module.exports = {
|
|
40
40
|
type: "problem",
|
41
41
|
|
42
42
|
docs: {
|
43
|
-
description: "
|
43
|
+
description: "Disallow `this`/`super` before calling `super()` in constructors",
|
44
44
|
recommended: true,
|
45
45
|
url: "https://eslint.org/docs/rules/no-this-before-super"
|
46
46
|
},
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
type: "suggestion",
|
18
18
|
|
19
19
|
docs: {
|
20
|
-
description: "
|
20
|
+
description: "Disallow throwing literals as exceptions",
|
21
21
|
recommended: false,
|
22
22
|
url: "https://eslint.org/docs/rules/no-throw-literal"
|
23
23
|
},
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "layout",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Disallow trailing whitespace at the end of lines",
|
24
24
|
recommended: false,
|
25
25
|
url: "https://eslint.org/docs/rules/no-trailing-spaces"
|
26
26
|
},
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
type: "suggestion",
|
18
18
|
|
19
19
|
docs: {
|
20
|
-
description: "
|
20
|
+
description: "Disallow initializing variables to `undefined`",
|
21
21
|
recommended: false,
|
22
22
|
url: "https://eslint.org/docs/rules/no-undef-init"
|
23
23
|
},
|
package/lib/rules/no-undef.js
CHANGED
@@ -29,7 +29,7 @@ module.exports = {
|
|
29
29
|
type: "problem",
|
30
30
|
|
31
31
|
docs: {
|
32
|
-
description: "
|
32
|
+
description: "Disallow the use of undeclared variables unless mentioned in `/*global */` comments",
|
33
33
|
recommended: true,
|
34
34
|
url: "https://eslint.org/docs/rules/no-undef"
|
35
35
|
},
|
@@ -14,7 +14,7 @@ module.exports = {
|
|
14
14
|
type: "suggestion",
|
15
15
|
|
16
16
|
docs: {
|
17
|
-
description: "
|
17
|
+
description: "Disallow the use of `undefined` as an identifier",
|
18
18
|
recommended: false,
|
19
19
|
url: "https://eslint.org/docs/rules/no-undefined"
|
20
20
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Disallow dangling underscores in identifiers",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/no-underscore-dangle"
|
21
21
|
},
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "problem",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Disallow confusing multiline expressions",
|
24
24
|
recommended: true,
|
25
25
|
url: "https://eslint.org/docs/rules/no-unexpected-multiline"
|
26
26
|
},
|
@@ -162,7 +162,7 @@ module.exports = {
|
|
162
162
|
type: "problem",
|
163
163
|
|
164
164
|
docs: {
|
165
|
-
description: "
|
165
|
+
description: "Disallow unmodified loop conditions",
|
166
166
|
recommended: false,
|
167
167
|
url: "https://eslint.org/docs/rules/no-unmodified-loop-condition"
|
168
168
|
},
|
@@ -29,7 +29,7 @@ module.exports = {
|
|
29
29
|
type: "suggestion",
|
30
30
|
|
31
31
|
docs: {
|
32
|
-
description: "
|
32
|
+
description: "Disallow ternary operators when simpler alternatives exist",
|
33
33
|
recommended: false,
|
34
34
|
url: "https://eslint.org/docs/rules/no-unneeded-ternary"
|
35
35
|
},
|
@@ -59,7 +59,7 @@ module.exports = {
|
|
59
59
|
type: "problem",
|
60
60
|
|
61
61
|
docs: {
|
62
|
-
description: "
|
62
|
+
description: "Disallow loops with a body that allows only one iteration",
|
63
63
|
recommended: false,
|
64
64
|
url: "https://eslint.org/docs/rules/no-unreachable-loop"
|
65
65
|
},
|
@@ -111,7 +111,7 @@ module.exports = {
|
|
111
111
|
type: "problem",
|
112
112
|
|
113
113
|
docs: {
|
114
|
-
description: "
|
114
|
+
description: "Disallow unreachable code after `return`, `throw`, `continue`, and `break` statements",
|
115
115
|
recommended: true,
|
116
116
|
url: "https://eslint.org/docs/rules/no-unreachable"
|
117
117
|
},
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
type: "problem",
|
25
25
|
|
26
26
|
docs: {
|
27
|
-
description: "
|
27
|
+
description: "Disallow control flow statements in `finally` blocks",
|
28
28
|
recommended: true,
|
29
29
|
url: "https://eslint.org/docs/rules/no-unsafe-finally"
|
30
30
|
},
|
@@ -52,7 +52,7 @@ module.exports = {
|
|
52
52
|
type: "problem",
|
53
53
|
|
54
54
|
docs: {
|
55
|
-
description: "
|
55
|
+
description: "Disallow negating the left operand of relational operators",
|
56
56
|
recommended: true,
|
57
57
|
url: "https://eslint.org/docs/rules/no-unsafe-negation"
|
58
58
|
},
|