eslint 8.0.0-beta.0 → 8.0.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 -4
- package/bin/eslint.js +1 -1
- package/conf/eslint-recommended.js +1 -1
- package/conf/{category-list.json → rule-type-list.json} +4 -7
- package/lib/cli-engine/cli-engine.js +11 -3
- package/lib/cli-engine/file-enumerator.js +4 -3
- package/lib/cli-engine/formatters/html.js +1 -1
- package/lib/cli-engine/hash.js +2 -2
- package/lib/cli-engine/xml-escape.js +1 -1
- package/lib/config/flat-config-array.js +2 -2
- package/lib/config/flat-config-schema.js +1 -1
- package/lib/config/rule-validator.js +25 -8
- package/lib/eslint/eslint.js +4 -0
- package/lib/init/autoconfig.js +17 -18
- package/lib/init/config-file.js +3 -3
- package/lib/init/config-initializer.js +11 -10
- package/lib/init/config-rule.js +15 -16
- package/lib/init/npm-utils.js +16 -15
- package/lib/init/source-code-utils.js +6 -5
- package/lib/linter/apply-disable-directives.js +80 -11
- package/lib/linter/code-path-analysis/code-path-analyzer.js +115 -36
- package/lib/linter/code-path-analysis/code-path-segment.js +0 -1
- package/lib/linter/code-path-analysis/code-path-state.js +4 -1
- package/lib/linter/code-path-analysis/code-path.js +14 -5
- package/lib/linter/code-path-analysis/debug-helpers.js +2 -2
- package/lib/linter/code-path-analysis/fork-context.js +0 -1
- package/lib/linter/code-path-analysis/id-generator.js +0 -1
- package/lib/linter/config-comment-parser.js +1 -1
- package/lib/linter/linter.js +51 -22
- package/lib/linter/node-event-generator.js +0 -1
- package/lib/linter/report-translator.js +12 -12
- package/lib/linter/rules.js +3 -0
- package/lib/linter/safe-emitter.js +2 -2
- package/lib/linter/source-code-fixer.js +2 -2
- package/lib/linter/timing.js +2 -2
- package/lib/rule-tester/rule-tester.js +12 -2
- package/lib/rules/accessor-pairs.js +0 -1
- package/lib/rules/array-bracket-newline.js +0 -1
- package/lib/rules/array-bracket-spacing.js +0 -1
- package/lib/rules/array-callback-return.js +0 -1
- package/lib/rules/array-element-newline.js +0 -1
- package/lib/rules/arrow-body-style.js +0 -1
- package/lib/rules/arrow-parens.js +0 -1
- package/lib/rules/arrow-spacing.js +0 -1
- package/lib/rules/block-scoped-var.js +0 -1
- package/lib/rules/block-spacing.js +0 -1
- package/lib/rules/brace-style.js +0 -1
- package/lib/rules/callback-return.js +1 -1
- package/lib/rules/camelcase.js +17 -19
- package/lib/rules/capitalized-comments.js +0 -1
- package/lib/rules/class-methods-use-this.js +51 -9
- package/lib/rules/comma-dangle.js +0 -1
- package/lib/rules/comma-spacing.js +0 -1
- package/lib/rules/comma-style.js +0 -1
- package/lib/rules/complexity.js +47 -56
- package/lib/rules/computed-property-spacing.js +0 -1
- package/lib/rules/consistent-return.js +0 -1
- package/lib/rules/consistent-this.js +1 -2
- package/lib/rules/constructor-super.js +0 -1
- package/lib/rules/curly.js +0 -1
- package/lib/rules/default-case-last.js +0 -1
- package/lib/rules/default-case.js +2 -3
- package/lib/rules/default-param-last.js +1 -2
- package/lib/rules/dot-location.js +0 -1
- package/lib/rules/dot-notation.js +0 -1
- package/lib/rules/eol-last.js +6 -2
- package/lib/rules/eqeqeq.js +1 -2
- package/lib/rules/for-direction.js +0 -1
- package/lib/rules/func-call-spacing.js +0 -1
- package/lib/rules/func-name-matching.js +9 -6
- package/lib/rules/func-names.js +0 -1
- package/lib/rules/func-style.js +0 -1
- package/lib/rules/function-call-argument-newline.js +0 -1
- package/lib/rules/function-paren-newline.js +1 -1
- package/lib/rules/generator-star-spacing.js +0 -1
- package/lib/rules/getter-return.js +0 -1
- package/lib/rules/global-require.js +1 -1
- package/lib/rules/grouped-accessor-pairs.js +0 -1
- package/lib/rules/guard-for-in.js +0 -1
- package/lib/rules/handle-callback-err.js +1 -1
- package/lib/rules/id-blacklist.js +1 -1
- package/lib/rules/id-denylist.js +0 -1
- package/lib/rules/id-length.js +0 -1
- package/lib/rules/id-match.js +0 -1
- package/lib/rules/implicit-arrow-linebreak.js +0 -1
- package/lib/rules/indent-legacy.js +1 -1
- package/lib/rules/indent.js +7 -10
- package/lib/rules/index.js +1 -1
- package/lib/rules/init-declarations.js +0 -1
- package/lib/rules/jsx-quotes.js +0 -1
- package/lib/rules/key-spacing.js +4 -5
- package/lib/rules/keyword-spacing.js +19 -3
- package/lib/rules/line-comment-position.js +0 -1
- package/lib/rules/linebreak-style.js +0 -1
- package/lib/rules/lines-around-comment.js +0 -1
- package/lib/rules/lines-around-directive.js +1 -2
- package/lib/rules/lines-between-class-members.js +50 -3
- package/lib/rules/max-classes-per-file.js +31 -8
- package/lib/rules/max-depth.js +0 -1
- package/lib/rules/max-len.js +1 -2
- package/lib/rules/max-lines-per-function.js +1 -2
- package/lib/rules/max-lines.js +0 -1
- package/lib/rules/max-nested-callbacks.js +0 -1
- package/lib/rules/max-params.js +0 -1
- package/lib/rules/max-statements-per-line.js +0 -1
- package/lib/rules/max-statements.js +0 -1
- package/lib/rules/multiline-comment-style.js +0 -1
- package/lib/rules/multiline-ternary.js +0 -1
- package/lib/rules/new-cap.js +2 -2
- package/lib/rules/new-parens.js +0 -1
- package/lib/rules/newline-after-var.js +4 -5
- package/lib/rules/newline-before-return.js +2 -3
- package/lib/rules/newline-per-chained-call.js +1 -2
- package/lib/rules/no-alert.js +0 -1
- package/lib/rules/no-array-constructor.js +0 -1
- package/lib/rules/no-async-promise-executor.js +0 -1
- package/lib/rules/no-await-in-loop.js +0 -1
- package/lib/rules/no-bitwise.js +5 -6
- package/lib/rules/no-buffer-constructor.js +1 -1
- package/lib/rules/no-caller.js +0 -1
- package/lib/rules/no-case-declarations.js +0 -1
- package/lib/rules/no-catch-shadow.js +0 -1
- package/lib/rules/no-class-assign.js +0 -1
- package/lib/rules/no-compare-neg-zero.js +0 -1
- package/lib/rules/no-cond-assign.js +0 -1
- package/lib/rules/no-confusing-arrow.js +0 -1
- package/lib/rules/no-console.js +0 -1
- package/lib/rules/no-const-assign.js +0 -1
- package/lib/rules/no-constant-condition.js +0 -1
- package/lib/rules/no-constructor-return.js +0 -1
- package/lib/rules/no-continue.js +0 -1
- package/lib/rules/no-control-regex.js +0 -1
- package/lib/rules/no-debugger.js +0 -1
- package/lib/rules/no-delete-var.js +0 -1
- package/lib/rules/no-div-regex.js +0 -1
- package/lib/rules/no-dupe-args.js +0 -1
- package/lib/rules/no-dupe-class-members.js +0 -1
- package/lib/rules/no-dupe-else-if.js +0 -1
- package/lib/rules/no-dupe-keys.js +0 -2
- package/lib/rules/no-duplicate-case.js +0 -1
- package/lib/rules/no-duplicate-imports.js +0 -1
- package/lib/rules/no-else-return.js +0 -1
- package/lib/rules/no-empty-character-class.js +0 -1
- package/lib/rules/no-empty-function.js +0 -1
- package/lib/rules/no-empty-pattern.js +0 -1
- package/lib/rules/no-empty.js +0 -1
- package/lib/rules/no-eq-null.js +0 -1
- package/lib/rules/no-eval.js +0 -1
- package/lib/rules/no-ex-assign.js +0 -1
- package/lib/rules/no-extend-native.js +0 -1
- package/lib/rules/no-extra-bind.js +0 -1
- package/lib/rules/no-extra-boolean-cast.js +1 -1
- package/lib/rules/no-extra-label.js +0 -1
- package/lib/rules/no-extra-parens.js +0 -1
- package/lib/rules/no-extra-semi.js +0 -1
- package/lib/rules/no-fallthrough.js +0 -1
- package/lib/rules/no-floating-decimal.js +0 -1
- package/lib/rules/no-func-assign.js +0 -1
- package/lib/rules/no-global-assign.js +0 -1
- package/lib/rules/no-implicit-coercion.js +0 -1
- package/lib/rules/no-implicit-globals.js +0 -1
- package/lib/rules/no-implied-eval.js +0 -1
- package/lib/rules/no-import-assign.js +0 -1
- package/lib/rules/no-inline-comments.js +0 -1
- package/lib/rules/no-inner-declarations.js +0 -1
- package/lib/rules/no-invalid-regexp.js +0 -1
- package/lib/rules/no-invalid-this.js +0 -1
- package/lib/rules/no-irregular-whitespace.js +0 -1
- package/lib/rules/no-iterator.js +0 -1
- package/lib/rules/no-label-var.js +0 -1
- package/lib/rules/no-labels.js +0 -1
- package/lib/rules/no-lone-blocks.js +0 -1
- package/lib/rules/no-lonely-if.js +0 -1
- package/lib/rules/no-loop-func.js +1 -2
- package/lib/rules/no-loss-of-precision.js +0 -1
- package/lib/rules/no-magic-numbers.js +0 -1
- package/lib/rules/no-misleading-character-class.js +0 -1
- package/lib/rules/no-mixed-operators.js +1 -2
- package/lib/rules/no-mixed-requires.js +1 -1
- package/lib/rules/no-mixed-spaces-and-tabs.js +0 -1
- package/lib/rules/no-multi-assign.js +0 -1
- package/lib/rules/no-multi-spaces.js +0 -1
- package/lib/rules/no-multi-str.js +0 -1
- package/lib/rules/no-multiple-empty-lines.js +0 -1
- package/lib/rules/no-native-reassign.js +0 -1
- package/lib/rules/no-negated-condition.js +0 -1
- package/lib/rules/no-negated-in-lhs.js +0 -1
- package/lib/rules/no-nested-ternary.js +0 -1
- package/lib/rules/no-new-func.js +34 -7
- package/lib/rules/no-new-object.js +0 -1
- package/lib/rules/no-new-require.js +1 -1
- package/lib/rules/no-new-symbol.js +0 -1
- package/lib/rules/no-new-wrappers.js +0 -1
- package/lib/rules/no-new.js +0 -1
- package/lib/rules/no-nonoctal-decimal-escape.js +0 -1
- package/lib/rules/no-obj-calls.js +0 -1
- package/lib/rules/no-octal-escape.js +0 -1
- package/lib/rules/no-octal.js +0 -1
- package/lib/rules/no-param-reassign.js +0 -1
- package/lib/rules/no-path-concat.js +1 -1
- package/lib/rules/no-plusplus.js +0 -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 +0 -1
- package/lib/rules/no-proto.js +0 -1
- package/lib/rules/no-prototype-builtins.js +0 -1
- package/lib/rules/no-redeclare.js +0 -1
- package/lib/rules/no-regex-spaces.js +0 -1
- package/lib/rules/no-restricted-exports.js +0 -1
- package/lib/rules/no-restricted-globals.js +1 -2
- package/lib/rules/no-restricted-imports.js +5 -6
- package/lib/rules/no-restricted-modules.js +3 -3
- package/lib/rules/no-restricted-properties.js +2 -3
- package/lib/rules/no-restricted-syntax.js +1 -2
- package/lib/rules/no-return-assign.js +0 -1
- package/lib/rules/no-return-await.js +0 -1
- package/lib/rules/no-script-url.js +1 -3
- package/lib/rules/no-self-assign.js +0 -1
- package/lib/rules/no-self-compare.js +0 -1
- package/lib/rules/no-sequences.js +0 -1
- package/lib/rules/no-setter-return.js +0 -1
- package/lib/rules/no-shadow-restricted-names.js +0 -1
- package/lib/rules/no-shadow.js +1 -2
- package/lib/rules/no-spaced-func.js +0 -1
- package/lib/rules/no-sparse-arrays.js +0 -1
- package/lib/rules/no-sync.js +1 -3
- package/lib/rules/no-tabs.js +0 -1
- package/lib/rules/no-template-curly-in-string.js +0 -1
- package/lib/rules/no-ternary.js +0 -1
- package/lib/rules/no-this-before-super.js +0 -1
- package/lib/rules/no-throw-literal.js +0 -1
- package/lib/rules/no-trailing-spaces.js +0 -1
- package/lib/rules/no-undef-init.js +9 -61
- package/lib/rules/no-undef.js +0 -1
- package/lib/rules/no-undefined.js +0 -1
- package/lib/rules/no-underscore-dangle.js +0 -1
- package/lib/rules/no-unexpected-multiline.js +0 -1
- package/lib/rules/no-unmodified-loop-condition.js +0 -1
- package/lib/rules/no-unneeded-ternary.js +0 -1
- package/lib/rules/no-unreachable-loop.js +0 -1
- package/lib/rules/no-unreachable.js +26 -25
- package/lib/rules/no-unsafe-finally.js +0 -1
- package/lib/rules/no-unsafe-negation.js +0 -1
- package/lib/rules/no-unsafe-optional-chaining.js +0 -1
- package/lib/rules/no-unused-expressions.js +4 -5
- package/lib/rules/no-unused-labels.js +0 -1
- package/lib/rules/no-unused-vars.js +26 -28
- package/lib/rules/no-use-before-define.js +0 -1
- package/lib/rules/no-useless-backreference.js +0 -1
- package/lib/rules/no-useless-call.js +0 -1
- package/lib/rules/no-useless-catch.js +0 -1
- package/lib/rules/no-useless-computed-key.js +1 -1
- package/lib/rules/no-useless-concat.js +0 -1
- package/lib/rules/no-useless-constructor.js +0 -1
- package/lib/rules/no-useless-escape.js +9 -9
- package/lib/rules/no-useless-rename.js +0 -1
- package/lib/rules/no-useless-return.js +0 -1
- package/lib/rules/no-var.js +0 -1
- package/lib/rules/no-void.js +0 -1
- package/lib/rules/no-warning-comments.js +0 -1
- package/lib/rules/no-whitespace-before-property.js +0 -1
- package/lib/rules/no-with.js +0 -1
- package/lib/rules/nonblock-statement-body-position.js +0 -1
- package/lib/rules/object-curly-newline.js +0 -1
- package/lib/rules/object-curly-spacing.js +0 -1
- package/lib/rules/object-property-newline.js +0 -1
- package/lib/rules/object-shorthand.js +3 -8
- package/lib/rules/one-var-declaration-per-line.js +0 -1
- package/lib/rules/one-var.js +1 -2
- package/lib/rules/operator-assignment.js +6 -7
- package/lib/rules/operator-linebreak.js +0 -1
- package/lib/rules/padded-blocks.js +1 -1
- package/lib/rules/padding-line-between-statements.js +0 -1
- package/lib/rules/prefer-arrow-callback.js +1 -1
- package/lib/rules/prefer-const.js +0 -1
- package/lib/rules/prefer-destructuring.js +1 -2
- package/lib/rules/prefer-exponentiation-operator.js +0 -1
- package/lib/rules/prefer-named-capture-group.js +0 -1
- package/lib/rules/prefer-numeric-literals.js +0 -1
- package/lib/rules/prefer-object-spread.js +0 -1
- package/lib/rules/prefer-promise-reject-errors.js +0 -1
- package/lib/rules/prefer-reflect.js +0 -1
- package/lib/rules/prefer-regex-literals.js +0 -1
- package/lib/rules/prefer-rest-params.js +0 -1
- package/lib/rules/prefer-spread.js +0 -1
- package/lib/rules/prefer-template.js +0 -1
- package/lib/rules/quote-props.js +8 -9
- package/lib/rules/quotes.js +0 -1
- package/lib/rules/radix.js +0 -1
- package/lib/rules/require-atomic-updates.js +24 -9
- package/lib/rules/require-await.js +0 -1
- package/lib/rules/require-jsdoc.js +1 -1
- package/lib/rules/require-unicode-regexp.js +0 -1
- package/lib/rules/require-yield.js +0 -1
- package/lib/rules/rest-spread-spacing.js +0 -1
- package/lib/rules/semi-spacing.js +0 -1
- package/lib/rules/semi-style.js +0 -1
- package/lib/rules/semi.js +66 -6
- package/lib/rules/sort-imports.js +0 -1
- package/lib/rules/sort-keys.js +0 -1
- package/lib/rules/sort-vars.js +0 -1
- package/lib/rules/space-before-blocks.js +14 -3
- package/lib/rules/space-before-function-paren.js +0 -1
- package/lib/rules/space-in-parens.js +0 -1
- package/lib/rules/space-infix-ops.js +0 -1
- package/lib/rules/space-unary-ops.js +0 -1
- package/lib/rules/spaced-comment.js +0 -1
- package/lib/rules/strict.js +0 -1
- package/lib/rules/switch-colon-spacing.js +1 -14
- package/lib/rules/symbol-description.js +0 -1
- package/lib/rules/template-curly-spacing.js +0 -1
- package/lib/rules/template-tag-spacing.js +0 -1
- package/lib/rules/unicode-bom.js +0 -1
- package/lib/rules/use-isnan.js +0 -1
- package/lib/rules/utils/ast-utils.js +29 -7
- package/lib/rules/utils/lazy-loading-rule-map.js +3 -3
- package/lib/rules/valid-jsdoc.js +1 -1
- package/lib/rules/valid-typeof.js +0 -1
- package/lib/rules/vars-on-top.js +1 -2
- package/lib/rules/wrap-iife.js +0 -1
- package/lib/rules/wrap-regex.js +0 -1
- package/lib/rules/yield-star-spacing.js +0 -1
- package/lib/rules/yoda.js +0 -1
- package/lib/shared/ajv.js +1 -1
- package/lib/shared/config-validator.js +10 -5
- package/lib/shared/logging.js +1 -1
- package/lib/shared/relative-module-resolver.js +1 -0
- package/lib/shared/runtime-info.js +3 -0
- package/lib/shared/traverser.js +2 -2
- package/lib/shared/types.js +2 -2
- package/lib/source-code/source-code.js +11 -5
- package/lib/source-code/token-store/cursor.js +1 -1
- package/package.json +5 -5
package/lib/rules/no-new-func.js
CHANGED
@@ -5,6 +5,18 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
//------------------------------------------------------------------------------
|
9
|
+
// Requirements
|
10
|
+
//------------------------------------------------------------------------------
|
11
|
+
|
12
|
+
const astUtils = require("./utils/ast-utils");
|
13
|
+
|
14
|
+
//------------------------------------------------------------------------------
|
15
|
+
// Helpers
|
16
|
+
//------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
const callMethods = new Set(["apply", "bind", "call"]);
|
19
|
+
|
8
20
|
//------------------------------------------------------------------------------
|
9
21
|
// Rule Definition
|
10
22
|
//------------------------------------------------------------------------------
|
@@ -15,7 +27,6 @@ module.exports = {
|
|
15
27
|
|
16
28
|
docs: {
|
17
29
|
description: "disallow `new` operators with the `Function` object",
|
18
|
-
category: "Best Practices",
|
19
30
|
recommended: false,
|
20
31
|
url: "https://eslint.org/docs/rules/no-new-func"
|
21
32
|
},
|
@@ -38,14 +49,30 @@ module.exports = {
|
|
38
49
|
variable.references.forEach(ref => {
|
39
50
|
const node = ref.identifier;
|
40
51
|
const { parent } = node;
|
52
|
+
let evalNode;
|
53
|
+
|
54
|
+
if (parent) {
|
55
|
+
if (node === parent.callee && (
|
56
|
+
parent.type === "NewExpression" ||
|
57
|
+
parent.type === "CallExpression"
|
58
|
+
)) {
|
59
|
+
evalNode = parent;
|
60
|
+
} else if (
|
61
|
+
parent.type === "MemberExpression" &&
|
62
|
+
node === parent.object &&
|
63
|
+
callMethods.has(astUtils.getStaticPropertyName(parent))
|
64
|
+
) {
|
65
|
+
const maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent;
|
66
|
+
|
67
|
+
if (maybeCallee.parent.type === "CallExpression" && maybeCallee.parent.callee === maybeCallee) {
|
68
|
+
evalNode = maybeCallee.parent;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
41
72
|
|
42
|
-
if (
|
43
|
-
parent &&
|
44
|
-
(parent.type === "NewExpression" || parent.type === "CallExpression") &&
|
45
|
-
node === parent.callee
|
46
|
-
) {
|
73
|
+
if (evalNode) {
|
47
74
|
context.report({
|
48
|
-
node:
|
75
|
+
node: evalNode,
|
49
76
|
messageId: "noFunctionConstructor"
|
50
77
|
});
|
51
78
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to disallow use of new operator with the `require` function
|
3
3
|
* @author Wil Moore III
|
4
|
+
* @deprecated in ESLint v7.0.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -19,7 +20,6 @@ module.exports = {
|
|
19
20
|
|
20
21
|
docs: {
|
21
22
|
description: "disallow `new` operators with calls to `require`",
|
22
|
-
category: "Node.js and CommonJS",
|
23
23
|
recommended: false,
|
24
24
|
url: "https://eslint.org/docs/rules/no-new-require"
|
25
25
|
},
|
package/lib/rules/no-new.js
CHANGED
package/lib/rules/no-octal.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Disallow string concatenation when using __dirname and __filename
|
3
3
|
* @author Nicholas C. Zakas
|
4
|
+
* @deprecated in ESLint v7.0.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -18,7 +19,6 @@ module.exports = {
|
|
18
19
|
|
19
20
|
docs: {
|
20
21
|
description: "disallow string concatenation with `__dirname` and `__filename`",
|
21
|
-
category: "Node.js and CommonJS",
|
22
22
|
recommended: false,
|
23
23
|
url: "https://eslint.org/docs/rules/no-path-concat"
|
24
24
|
},
|
package/lib/rules/no-plusplus.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Disallow the use of process.env()
|
3
3
|
* @author Vignesh Anand
|
4
|
+
* @deprecated in ESLint v7.0.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -18,7 +19,6 @@ module.exports = {
|
|
18
19
|
|
19
20
|
docs: {
|
20
21
|
description: "disallow the use of `process.env`",
|
21
|
-
category: "Node.js and CommonJS",
|
22
22
|
recommended: false,
|
23
23
|
url: "https://eslint.org/docs/rules/no-process-env"
|
24
24
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Disallow the use of process.exit()
|
3
3
|
* @author Nicholas C. Zakas
|
4
|
+
* @deprecated in ESLint v7.0.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -18,7 +19,6 @@ module.exports = {
|
|
18
19
|
|
19
20
|
docs: {
|
20
21
|
description: "disallow the use of `process.exit()`",
|
21
|
-
category: "Node.js and CommonJS",
|
22
22
|
recommended: false,
|
23
23
|
url: "https://eslint.org/docs/rules/no-process-exit"
|
24
24
|
},
|
package/lib/rules/no-proto.js
CHANGED
@@ -14,7 +14,6 @@ module.exports = {
|
|
14
14
|
|
15
15
|
docs: {
|
16
16
|
description: "disallow specified global variables",
|
17
|
-
category: "Variables",
|
18
17
|
recommended: false,
|
19
18
|
url: "https://eslint.org/docs/rules/no-restricted-globals"
|
20
19
|
},
|
@@ -43,7 +42,7 @@ module.exports = {
|
|
43
42
|
|
44
43
|
messages: {
|
45
44
|
defaultMessage: "Unexpected use of '{{name}}'.",
|
46
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
45
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
47
46
|
customMessage: "Unexpected use of '{{name}}'. {{customMessage}}"
|
48
47
|
}
|
49
48
|
},
|
@@ -79,26 +79,25 @@ module.exports = {
|
|
79
79
|
|
80
80
|
docs: {
|
81
81
|
description: "disallow specified modules when loaded by `import`",
|
82
|
-
category: "ECMAScript 6",
|
83
82
|
recommended: false,
|
84
83
|
url: "https://eslint.org/docs/rules/no-restricted-imports"
|
85
84
|
},
|
86
85
|
|
87
86
|
messages: {
|
88
87
|
path: "'{{importSource}}' import is restricted from being used.",
|
89
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
88
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
90
89
|
pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}",
|
91
90
|
|
92
91
|
patterns: "'{{importSource}}' import is restricted from being used by a pattern.",
|
93
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
92
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
94
93
|
patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}",
|
95
94
|
|
96
95
|
everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.",
|
97
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
96
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
98
97
|
everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}",
|
99
98
|
|
100
99
|
importName: "'{{importName}}' import from '{{importSource}}' is restricted.",
|
101
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
100
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
102
101
|
importNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}"
|
103
102
|
},
|
104
103
|
|
@@ -147,7 +146,7 @@ module.exports = {
|
|
147
146
|
? [{ matcher: ignore().add(restrictedPatterns) }]
|
148
147
|
: restrictedPatterns.map(({ group, message }) => ({ matcher: ignore().add(group), customMessage: message }));
|
149
148
|
|
150
|
-
// if no imports are restricted we don
|
149
|
+
// if no imports are restricted we don't need to check
|
151
150
|
if (Object.keys(restrictedPaths).length === 0 && restrictedPatternGroups.length === 0) {
|
152
151
|
return {};
|
153
152
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Restrict usage of specified node modules.
|
3
3
|
* @author Christian Schulz
|
4
|
+
* @deprecated in ESLint v7.0.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -48,7 +49,6 @@ module.exports = {
|
|
48
49
|
|
49
50
|
docs: {
|
50
51
|
description: "disallow specified modules when loaded by `require`",
|
51
|
-
category: "Node.js and CommonJS",
|
52
52
|
recommended: false,
|
53
53
|
url: "https://eslint.org/docs/rules/no-restricted-modules"
|
54
54
|
},
|
@@ -73,7 +73,7 @@ module.exports = {
|
|
73
73
|
|
74
74
|
messages: {
|
75
75
|
defaultMessage: "'{{name}}' module is restricted from being used.",
|
76
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
76
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
77
77
|
customMessage: "'{{name}}' module is restricted from being used. {{customMessage}}",
|
78
78
|
patternMessage: "'{{name}}' module is restricted from being used by a pattern."
|
79
79
|
}
|
@@ -97,7 +97,7 @@ module.exports = {
|
|
97
97
|
return memo;
|
98
98
|
}, {});
|
99
99
|
|
100
|
-
// if no imports are restricted we don
|
100
|
+
// if no imports are restricted we don't need to check
|
101
101
|
if (Object.keys(restrictedPaths).length === 0 && restrictedPatterns.length === 0) {
|
102
102
|
return {};
|
103
103
|
}
|
@@ -17,7 +17,6 @@ module.exports = {
|
|
17
17
|
|
18
18
|
docs: {
|
19
19
|
description: "disallow certain properties on certain objects",
|
20
|
-
category: "Best Practices",
|
21
20
|
recommended: false,
|
22
21
|
url: "https://eslint.org/docs/rules/no-restricted-properties"
|
23
22
|
},
|
@@ -64,9 +63,9 @@ module.exports = {
|
|
64
63
|
},
|
65
64
|
|
66
65
|
messages: {
|
67
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
66
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
68
67
|
restrictedObjectProperty: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}",
|
69
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
68
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
70
69
|
restrictedProperty: "'{{propertyName}}' is restricted from being used.{{message}}"
|
71
70
|
}
|
72
71
|
},
|
@@ -14,7 +14,6 @@ module.exports = {
|
|
14
14
|
|
15
15
|
docs: {
|
16
16
|
description: "disallow specified syntax",
|
17
|
-
category: "Stylistic Issues",
|
18
17
|
recommended: false,
|
19
18
|
url: "https://eslint.org/docs/rules/no-restricted-syntax"
|
20
19
|
},
|
@@ -42,7 +41,7 @@ module.exports = {
|
|
42
41
|
},
|
43
42
|
|
44
43
|
messages: {
|
45
|
-
// eslint-disable-next-line eslint-plugin/report-message-format
|
44
|
+
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
46
45
|
restrictedSyntax: "{{message}}"
|
47
46
|
}
|
48
47
|
},
|
@@ -2,8 +2,7 @@
|
|
2
2
|
* @fileoverview Rule to flag when using javascript: urls
|
3
3
|
* @author Ilya Volodin
|
4
4
|
*/
|
5
|
-
/*
|
6
|
-
/* eslint no-script-url: 0 */
|
5
|
+
/* eslint no-script-url: 0 -- Code is checking to report such URLs */
|
7
6
|
|
8
7
|
"use strict";
|
9
8
|
|
@@ -19,7 +18,6 @@ module.exports = {
|
|
19
18
|
|
20
19
|
docs: {
|
21
20
|
description: "disallow `javascript:` urls",
|
22
|
-
category: "Best Practices",
|
23
21
|
recommended: false,
|
24
22
|
url: "https://eslint.org/docs/rules/no-script-url"
|
25
23
|
},
|
package/lib/rules/no-shadow.js
CHANGED
@@ -21,7 +21,6 @@ module.exports = {
|
|
21
21
|
|
22
22
|
docs: {
|
23
23
|
description: "disallow variable declarations from shadowing variables declared in the outer scope",
|
24
|
-
category: "Variables",
|
25
24
|
recommended: false,
|
26
25
|
url: "https://eslint.org/docs/rules/no-shadow"
|
27
26
|
},
|
@@ -59,7 +58,7 @@ module.exports = {
|
|
59
58
|
|
60
59
|
/**
|
61
60
|
* Check if variable name is allowed.
|
62
|
-
* @param
|
61
|
+
* @param {ASTNode} variable The variable to check.
|
63
62
|
* @returns {boolean} Whether or not the variable name is allowed.
|
64
63
|
*/
|
65
64
|
function isAllowed(variable) {
|
package/lib/rules/no-sync.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to check for properties whose identifier ends with the string Sync
|
3
3
|
* @author Matt DuVall<http://mattduvall.com/>
|
4
|
+
* @deprecated in ESLint v7.0.0
|
4
5
|
*/
|
5
6
|
|
6
|
-
/* jshint node:true */
|
7
|
-
|
8
7
|
"use strict";
|
9
8
|
|
10
9
|
//------------------------------------------------------------------------------
|
@@ -21,7 +20,6 @@ module.exports = {
|
|
21
20
|
|
22
21
|
docs: {
|
23
22
|
description: "disallow synchronous methods",
|
24
|
-
category: "Node.js and CommonJS",
|
25
23
|
recommended: false,
|
26
24
|
url: "https://eslint.org/docs/rules/no-sync"
|
27
25
|
},
|
package/lib/rules/no-tabs.js
CHANGED
package/lib/rules/no-ternary.js
CHANGED