eslint 8.39.0 → 8.40.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 -3
- package/lib/config/flat-config-schema.js +57 -35
- package/lib/eslint/flat-eslint.js +56 -16
- package/lib/linter/linter.js +6 -2
- package/lib/rules/accessor-pairs.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/lib/rules/max-classes-per-file.js +1 -1
- package/lib/rules/max-depth.js +1 -1
- package/lib/rules/max-len.js +2 -2
- 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 -2
- 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 +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 +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 +1 -1
- package/lib/rules/no-empty-function.js +2 -2
- package/lib/rules/no-empty-pattern.js +1 -1
- 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 +2 -2
- package/lib/rules/no-extra-semi.js +3 -3
- 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 +1 -1
- package/lib/rules/no-invalid-this.js +2 -2
- package/lib/rules/no-irregular-whitespace.js +2 -2
- 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 +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 +2 -2
- 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 +1 -1
- 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 +2 -2
- 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 +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 +2 -2
- package/lib/rules/no-return-await.js +3 -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 +1 -1
- package/lib/rules/no-unused-labels.js +2 -2
- package/lib/rules/no-unused-private-class-members.js +1 -1
- package/lib/rules/no-unused-vars.js +2 -2
- package/lib/rules/no-use-before-define.js +2 -2
- package/lib/rules/no-useless-backreference.js +2 -2
- 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 +2 -2
- package/lib/rules/no-useless-rename.js +2 -2
- package/lib/rules/no-useless-return.js +2 -2
- 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 +4 -4
- 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 +2 -2
- package/lib/rules/prefer-named-capture-group.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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/valid-jsdoc.js +2 -2
- package/lib/rules/valid-typeof.js +2 -2
- 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 +2 -2
- package/lib/shared/string-utils.js +39 -1
- 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 +5 -5
@@ -69,7 +69,7 @@ module.exports = {
|
|
69
69
|
docs: {
|
70
70
|
description: "Enforce consistent spacing before and after keywords",
|
71
71
|
recommended: false,
|
72
|
-
url: "https://eslint.org/docs/rules/keyword-spacing"
|
72
|
+
url: "https://eslint.org/docs/latest/rules/keyword-spacing"
|
73
73
|
},
|
74
74
|
|
75
75
|
fixable: "whitespace",
|
@@ -108,7 +108,7 @@ module.exports = {
|
|
108
108
|
},
|
109
109
|
|
110
110
|
create(context) {
|
111
|
-
const sourceCode = context.
|
111
|
+
const sourceCode = context.sourceCode;
|
112
112
|
|
113
113
|
const tokensToIgnore = new WeakSet();
|
114
114
|
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
18
18
|
docs: {
|
19
19
|
description: "Enforce position of line comments",
|
20
20
|
recommended: false,
|
21
|
-
url: "https://eslint.org/docs/rules/line-comment-position"
|
21
|
+
url: "https://eslint.org/docs/latest/rules/line-comment-position"
|
22
22
|
},
|
23
23
|
|
24
24
|
schema: [
|
@@ -78,7 +78,7 @@ module.exports = {
|
|
78
78
|
const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN;
|
79
79
|
const fallThroughRegExp = /^\s*falls?\s?through/u;
|
80
80
|
const customIgnoreRegExp = new RegExp(ignorePattern, "u");
|
81
|
-
const sourceCode = context.
|
81
|
+
const sourceCode = context.sourceCode;
|
82
82
|
|
83
83
|
//--------------------------------------------------------------------------
|
84
84
|
// Public
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Enforce consistent linebreak style",
|
25
25
|
recommended: false,
|
26
|
-
url: "https://eslint.org/docs/rules/linebreak-style"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/linebreak-style"
|
27
27
|
},
|
28
28
|
|
29
29
|
fixable: "whitespace",
|
@@ -40,7 +40,7 @@ module.exports = {
|
|
40
40
|
},
|
41
41
|
|
42
42
|
create(context) {
|
43
|
-
const sourceCode = context.
|
43
|
+
const sourceCode = context.sourceCode;
|
44
44
|
|
45
45
|
//--------------------------------------------------------------------------
|
46
46
|
// Helpers
|
@@ -57,7 +57,7 @@ module.exports = {
|
|
57
57
|
docs: {
|
58
58
|
description: "Require empty lines around comments",
|
59
59
|
recommended: false,
|
60
|
-
url: "https://eslint.org/docs/rules/lines-around-comment"
|
60
|
+
url: "https://eslint.org/docs/latest/rules/lines-around-comment"
|
61
61
|
},
|
62
62
|
|
63
63
|
fixable: "whitespace",
|
@@ -138,7 +138,7 @@ module.exports = {
|
|
138
138
|
|
139
139
|
options.beforeBlockComment = typeof options.beforeBlockComment !== "undefined" ? options.beforeBlockComment : true;
|
140
140
|
|
141
|
-
const sourceCode = context.
|
141
|
+
const sourceCode = context.sourceCode;
|
142
142
|
|
143
143
|
const lines = sourceCode.lines,
|
144
144
|
numLines = lines.length + 1,
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
docs: {
|
21
21
|
description: "Require or disallow newlines around directives",
|
22
22
|
recommended: false,
|
23
|
-
url: "https://eslint.org/docs/rules/lines-around-directive"
|
23
|
+
url: "https://eslint.org/docs/latest/rules/lines-around-directive"
|
24
24
|
},
|
25
25
|
|
26
26
|
schema: [{
|
@@ -54,7 +54,7 @@ module.exports = {
|
|
54
54
|
},
|
55
55
|
|
56
56
|
create(context) {
|
57
|
-
const sourceCode = context.
|
57
|
+
const sourceCode = context.sourceCode;
|
58
58
|
const config = context.options[0] || "always";
|
59
59
|
const expectLineBefore = typeof config === "string" ? config : config.before;
|
60
60
|
const expectLineAfter = typeof config === "string" ? config : config.after;
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
22
22
|
docs: {
|
23
23
|
description: "Require or disallow an empty line between class members",
|
24
24
|
recommended: false,
|
25
|
-
url: "https://eslint.org/docs/rules/lines-between-class-members"
|
25
|
+
url: "https://eslint.org/docs/latest/rules/lines-between-class-members"
|
26
26
|
},
|
27
27
|
|
28
28
|
fixable: "whitespace",
|
@@ -55,7 +55,7 @@ module.exports = {
|
|
55
55
|
options[0] = context.options[0] || "always";
|
56
56
|
options[1] = context.options[1] || { exceptAfterSingleLine: false };
|
57
57
|
|
58
|
-
const sourceCode = context.
|
58
|
+
const sourceCode = context.sourceCode;
|
59
59
|
|
60
60
|
/**
|
61
61
|
* Gets a pair of tokens that should be used to check lines between two class member nodes.
|
@@ -161,7 +161,7 @@ module.exports = {
|
|
161
161
|
docs: {
|
162
162
|
description: "Require or disallow logical assignment operator shorthand",
|
163
163
|
recommended: false,
|
164
|
-
url: "https://eslint.org/docs/rules/logical-assignment-operators"
|
164
|
+
url: "https://eslint.org/docs/latest/rules/logical-assignment-operators"
|
165
165
|
},
|
166
166
|
|
167
167
|
schema: {
|
@@ -205,7 +205,7 @@ module.exports = {
|
|
205
205
|
create(context) {
|
206
206
|
const mode = context.options[0] === "never" ? "never" : "always";
|
207
207
|
const checkIf = mode === "always" && context.options.length > 1 && context.options[1].enforceForIfStatements;
|
208
|
-
const sourceCode = context.
|
208
|
+
const sourceCode = context.sourceCode;
|
209
209
|
const isStrict = sourceCode.getScope(sourceCode.ast).isStrict;
|
210
210
|
|
211
211
|
/**
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
docs: {
|
22
22
|
description: "Enforce a maximum number of classes per file",
|
23
23
|
recommended: false,
|
24
|
-
url: "https://eslint.org/docs/rules/max-classes-per-file"
|
24
|
+
url: "https://eslint.org/docs/latest/rules/max-classes-per-file"
|
25
25
|
},
|
26
26
|
|
27
27
|
schema: [
|
package/lib/rules/max-depth.js
CHANGED
package/lib/rules/max-len.js
CHANGED
@@ -71,7 +71,7 @@ module.exports = {
|
|
71
71
|
docs: {
|
72
72
|
description: "Enforce a maximum line length",
|
73
73
|
recommended: false,
|
74
|
-
url: "https://eslint.org/docs/rules/max-len"
|
74
|
+
url: "https://eslint.org/docs/latest/rules/max-len"
|
75
75
|
},
|
76
76
|
|
77
77
|
schema: [
|
@@ -97,7 +97,7 @@ module.exports = {
|
|
97
97
|
*/
|
98
98
|
const URL_REGEXP = /[^:/?#]:\/\/[^?#]/u;
|
99
99
|
|
100
|
-
const sourceCode = context.
|
100
|
+
const sourceCode = context.sourceCode;
|
101
101
|
|
102
102
|
/**
|
103
103
|
* Computes the length of a line that may contain tabs. The width of each
|
@@ -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";
|
@@ -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) {
|