eslint 8.39.0 → 8.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/conf/globals.js +6 -1
- package/lib/cli-engine/cli-engine.js +30 -19
- package/lib/cli.js +2 -28
- package/lib/config/default-config.js +1 -1
- package/lib/config/flat-config-schema.js +127 -35
- package/lib/eslint/eslint-helpers.js +11 -10
- package/lib/eslint/eslint.js +1 -1
- package/lib/eslint/flat-eslint.js +119 -161
- package/lib/linter/apply-disable-directives.js +11 -1
- package/lib/linter/code-path-analysis/debug-helpers.js +1 -1
- package/lib/linter/config-comment-parser.js +9 -2
- package/lib/linter/linter.js +20 -11
- package/lib/linter/report-translator.js +22 -21
- package/lib/rule-tester/flat-rule-tester.js +1 -2
- package/lib/rule-tester/rule-tester.js +1 -2
- package/lib/rules/accessor-pairs.js +35 -43
- package/lib/rules/array-bracket-newline.js +2 -2
- package/lib/rules/array-bracket-spacing.js +2 -2
- package/lib/rules/array-callback-return.js +2 -2
- package/lib/rules/array-element-newline.js +12 -6
- package/lib/rules/arrow-body-style.js +2 -2
- package/lib/rules/arrow-parens.js +2 -2
- package/lib/rules/arrow-spacing.js +2 -2
- package/lib/rules/block-scoped-var.js +17 -7
- package/lib/rules/block-spacing.js +2 -2
- package/lib/rules/brace-style.js +2 -2
- package/lib/rules/callback-return.js +2 -2
- package/lib/rules/camelcase.js +2 -2
- package/lib/rules/capitalized-comments.js +2 -2
- package/lib/rules/class-methods-use-this.js +2 -2
- package/lib/rules/comma-dangle.js +2 -2
- package/lib/rules/comma-spacing.js +2 -2
- package/lib/rules/comma-style.js +2 -2
- package/lib/rules/complexity.js +1 -1
- package/lib/rules/computed-property-spacing.js +2 -2
- package/lib/rules/consistent-return.js +3 -3
- package/lib/rules/consistent-this.js +2 -2
- package/lib/rules/constructor-super.js +1 -1
- package/lib/rules/curly.js +2 -2
- package/lib/rules/default-case-last.js +1 -1
- package/lib/rules/default-case.js +2 -2
- package/lib/rules/default-param-last.js +1 -1
- package/lib/rules/dot-location.js +2 -2
- package/lib/rules/dot-notation.js +3 -4
- package/lib/rules/eol-last.js +2 -2
- package/lib/rules/eqeqeq.js +2 -2
- package/lib/rules/for-direction.js +1 -1
- package/lib/rules/func-call-spacing.js +2 -2
- package/lib/rules/func-name-matching.js +1 -1
- package/lib/rules/func-names.js +2 -2
- package/lib/rules/func-style.js +1 -1
- package/lib/rules/function-call-argument-newline.js +2 -2
- package/lib/rules/function-paren-newline.js +2 -2
- package/lib/rules/generator-star-spacing.js +2 -2
- package/lib/rules/getter-return.js +2 -2
- package/lib/rules/global-require.js +2 -2
- package/lib/rules/grouped-accessor-pairs.js +35 -44
- package/lib/rules/guard-for-in.js +1 -1
- package/lib/rules/handle-callback-err.js +2 -2
- package/lib/rules/id-blacklist.js +2 -2
- package/lib/rules/id-denylist.js +2 -2
- package/lib/rules/id-length.js +3 -36
- package/lib/rules/id-match.js +2 -2
- package/lib/rules/implicit-arrow-linebreak.js +2 -2
- package/lib/rules/indent-legacy.js +2 -2
- package/lib/rules/indent.js +84 -88
- package/lib/rules/init-declarations.js +1 -1
- package/lib/rules/jsx-quotes.js +1 -1
- package/lib/rules/key-spacing.js +4 -10
- package/lib/rules/keyword-spacing.js +2 -2
- package/lib/rules/line-comment-position.js +2 -2
- package/lib/rules/linebreak-style.js +2 -2
- package/lib/rules/lines-around-comment.js +2 -2
- package/lib/rules/lines-around-directive.js +2 -2
- package/lib/rules/lines-between-class-members.js +2 -2
- package/lib/rules/logical-assignment-operators.js +7 -5
- package/lib/rules/max-classes-per-file.js +1 -1
- package/lib/rules/max-depth.js +1 -1
- package/lib/rules/max-len.js +19 -15
- package/lib/rules/max-lines-per-function.js +2 -2
- package/lib/rules/max-lines.js +2 -2
- package/lib/rules/max-nested-callbacks.js +1 -1
- package/lib/rules/max-params.js +2 -2
- package/lib/rules/max-statements-per-line.js +2 -2
- package/lib/rules/max-statements.js +1 -1
- package/lib/rules/multiline-comment-style.js +2 -2
- package/lib/rules/multiline-ternary.js +2 -2
- package/lib/rules/new-cap.js +2 -2
- package/lib/rules/new-parens.js +2 -2
- package/lib/rules/newline-after-var.js +2 -4
- package/lib/rules/newline-before-return.js +2 -2
- package/lib/rules/newline-per-chained-call.js +2 -2
- package/lib/rules/no-alert.js +2 -2
- package/lib/rules/no-array-constructor.js +1 -1
- package/lib/rules/no-async-promise-executor.js +2 -2
- package/lib/rules/no-await-in-loop.js +1 -1
- package/lib/rules/no-bitwise.js +1 -1
- package/lib/rules/no-buffer-constructor.js +1 -1
- package/lib/rules/no-caller.js +1 -1
- package/lib/rules/no-case-declarations.js +1 -1
- package/lib/rules/no-catch-shadow.js +2 -2
- package/lib/rules/no-class-assign.js +2 -2
- package/lib/rules/no-compare-neg-zero.js +1 -1
- package/lib/rules/no-cond-assign.js +2 -2
- package/lib/rules/no-confusing-arrow.js +2 -2
- package/lib/rules/no-console.js +2 -2
- package/lib/rules/no-const-assign.js +2 -2
- package/lib/rules/no-constant-binary-expression.js +2 -2
- package/lib/rules/no-constant-condition.js +2 -2
- package/lib/rules/no-constructor-return.js +1 -1
- package/lib/rules/no-continue.js +1 -1
- package/lib/rules/no-control-regex.js +16 -3
- package/lib/rules/no-debugger.js +1 -1
- package/lib/rules/no-delete-var.js +1 -1
- package/lib/rules/no-div-regex.js +2 -2
- package/lib/rules/no-dupe-args.js +2 -2
- package/lib/rules/no-dupe-class-members.js +1 -1
- package/lib/rules/no-dupe-else-if.js +2 -2
- package/lib/rules/no-dupe-keys.js +1 -1
- package/lib/rules/no-duplicate-case.js +2 -2
- package/lib/rules/no-duplicate-imports.js +1 -1
- package/lib/rules/no-else-return.js +2 -2
- package/lib/rules/no-empty-character-class.js +34 -13
- package/lib/rules/no-empty-function.js +2 -2
- package/lib/rules/no-empty-pattern.js +39 -4
- package/lib/rules/no-empty-static-block.js +2 -2
- package/lib/rules/no-empty.js +2 -2
- package/lib/rules/no-eq-null.js +1 -1
- package/lib/rules/no-eval.js +2 -2
- package/lib/rules/no-ex-assign.js +2 -2
- package/lib/rules/no-extend-native.js +2 -2
- package/lib/rules/no-extra-bind.js +2 -2
- package/lib/rules/no-extra-boolean-cast.js +2 -2
- package/lib/rules/no-extra-label.js +2 -2
- package/lib/rules/no-extra-parens.js +48 -12
- package/lib/rules/no-extra-semi.js +31 -13
- package/lib/rules/no-fallthrough.js +3 -3
- package/lib/rules/no-floating-decimal.js +2 -2
- package/lib/rules/no-func-assign.js +2 -2
- package/lib/rules/no-global-assign.js +2 -2
- package/lib/rules/no-implicit-coercion.js +2 -2
- package/lib/rules/no-implicit-globals.js +2 -2
- package/lib/rules/no-implied-eval.js +2 -2
- package/lib/rules/no-import-assign.js +2 -2
- package/lib/rules/no-inline-comments.js +2 -2
- package/lib/rules/no-inner-declarations.js +1 -1
- package/lib/rules/no-invalid-regexp.js +23 -8
- package/lib/rules/no-invalid-this.js +2 -2
- package/lib/rules/no-irregular-whitespace.js +23 -6
- package/lib/rules/no-iterator.js +1 -1
- package/lib/rules/no-label-var.js +2 -2
- package/lib/rules/no-labels.js +1 -1
- package/lib/rules/no-lone-blocks.js +2 -2
- package/lib/rules/no-lonely-if.js +2 -2
- package/lib/rules/no-loop-func.js +3 -3
- package/lib/rules/no-loss-of-precision.js +15 -7
- package/lib/rules/no-magic-numbers.js +1 -1
- package/lib/rules/no-misleading-character-class.js +10 -4
- package/lib/rules/no-mixed-operators.js +2 -2
- package/lib/rules/no-mixed-requires.js +1 -1
- package/lib/rules/no-mixed-spaces-and-tabs.js +2 -2
- package/lib/rules/no-multi-assign.js +1 -1
- package/lib/rules/no-multi-spaces.js +2 -2
- package/lib/rules/no-multi-str.js +1 -1
- package/lib/rules/no-multiple-empty-lines.js +2 -2
- package/lib/rules/no-native-reassign.js +2 -2
- package/lib/rules/no-negated-condition.js +1 -1
- package/lib/rules/no-negated-in-lhs.js +1 -1
- package/lib/rules/no-nested-ternary.js +1 -1
- package/lib/rules/no-new-func.js +2 -2
- package/lib/rules/no-new-native-nonconstructor.js +2 -2
- package/lib/rules/no-new-object.js +2 -2
- package/lib/rules/no-new-require.js +1 -1
- package/lib/rules/no-new-symbol.js +2 -2
- package/lib/rules/no-new-wrappers.js +20 -8
- package/lib/rules/no-new.js +1 -1
- package/lib/rules/no-nonoctal-decimal-escape.js +2 -2
- package/lib/rules/no-obj-calls.js +2 -2
- package/lib/rules/no-octal-escape.js +1 -1
- package/lib/rules/no-octal.js +1 -1
- package/lib/rules/no-param-reassign.js +2 -2
- package/lib/rules/no-path-concat.js +1 -1
- package/lib/rules/no-plusplus.js +1 -1
- package/lib/rules/no-process-env.js +1 -1
- package/lib/rules/no-process-exit.js +1 -1
- package/lib/rules/no-promise-executor-return.js +2 -2
- package/lib/rules/no-proto.js +1 -1
- package/lib/rules/no-prototype-builtins.js +1 -1
- package/lib/rules/no-redeclare.js +2 -2
- package/lib/rules/no-regex-spaces.js +20 -5
- package/lib/rules/no-restricted-exports.js +2 -2
- package/lib/rules/no-restricted-globals.js +2 -2
- package/lib/rules/no-restricted-imports.js +2 -2
- package/lib/rules/no-restricted-modules.js +8 -11
- package/lib/rules/no-restricted-properties.js +1 -1
- package/lib/rules/no-restricted-syntax.js +1 -1
- package/lib/rules/no-return-assign.js +2 -2
- package/lib/rules/no-return-await.js +8 -3
- package/lib/rules/no-script-url.js +1 -1
- package/lib/rules/no-self-assign.js +2 -2
- package/lib/rules/no-self-compare.js +2 -2
- package/lib/rules/no-sequences.js +2 -2
- package/lib/rules/no-setter-return.js +2 -2
- package/lib/rules/no-shadow-restricted-names.js +2 -2
- package/lib/rules/no-shadow.js +2 -2
- package/lib/rules/no-spaced-func.js +2 -2
- package/lib/rules/no-sparse-arrays.js +1 -1
- package/lib/rules/no-sync.js +1 -1
- package/lib/rules/no-tabs.js +2 -2
- package/lib/rules/no-template-curly-in-string.js +1 -1
- package/lib/rules/no-ternary.js +1 -1
- package/lib/rules/no-this-before-super.js +1 -1
- package/lib/rules/no-throw-literal.js +1 -1
- package/lib/rules/no-trailing-spaces.js +2 -2
- package/lib/rules/no-undef-init.js +2 -2
- package/lib/rules/no-undef.js +2 -2
- package/lib/rules/no-undefined.js +2 -2
- package/lib/rules/no-underscore-dangle.js +2 -2
- package/lib/rules/no-unexpected-multiline.js +2 -2
- package/lib/rules/no-unmodified-loop-condition.js +2 -2
- package/lib/rules/no-unneeded-ternary.js +2 -2
- package/lib/rules/no-unreachable-loop.js +1 -1
- package/lib/rules/no-unreachable.js +2 -2
- package/lib/rules/no-unsafe-finally.js +1 -1
- package/lib/rules/no-unsafe-negation.js +2 -2
- package/lib/rules/no-unsafe-optional-chaining.js +1 -1
- package/lib/rules/no-unused-expressions.js +4 -6
- package/lib/rules/no-unused-labels.js +48 -15
- package/lib/rules/no-unused-private-class-members.js +1 -1
- package/lib/rules/no-unused-vars.js +4 -3
- package/lib/rules/no-use-before-define.js +2 -2
- package/lib/rules/no-useless-backreference.js +3 -3
- package/lib/rules/no-useless-call.js +2 -2
- package/lib/rules/no-useless-catch.js +1 -1
- package/lib/rules/no-useless-computed-key.js +2 -2
- package/lib/rules/no-useless-concat.js +2 -2
- package/lib/rules/no-useless-constructor.js +1 -1
- package/lib/rules/no-useless-escape.js +162 -83
- package/lib/rules/no-useless-rename.js +2 -2
- package/lib/rules/no-useless-return.js +37 -9
- package/lib/rules/no-var.js +2 -2
- package/lib/rules/no-void.js +1 -1
- package/lib/rules/no-warning-comments.js +2 -2
- package/lib/rules/no-whitespace-before-property.js +2 -2
- package/lib/rules/no-with.js +1 -1
- package/lib/rules/nonblock-statement-body-position.js +2 -2
- package/lib/rules/object-curly-newline.js +2 -2
- package/lib/rules/object-curly-spacing.js +4 -4
- package/lib/rules/object-property-newline.js +2 -2
- package/lib/rules/object-shorthand.js +2 -2
- package/lib/rules/one-var-declaration-per-line.js +1 -1
- package/lib/rules/one-var.js +2 -2
- package/lib/rules/operator-assignment.js +2 -2
- package/lib/rules/operator-linebreak.js +2 -2
- package/lib/rules/padded-blocks.js +2 -2
- package/lib/rules/padding-line-between-statements.js +8 -53
- package/lib/rules/prefer-arrow-callback.js +2 -2
- package/lib/rules/prefer-const.js +2 -2
- package/lib/rules/prefer-destructuring.js +2 -2
- package/lib/rules/prefer-exponentiation-operator.js +4 -3
- package/lib/rules/prefer-named-capture-group.js +10 -7
- package/lib/rules/prefer-numeric-literals.js +2 -2
- package/lib/rules/prefer-object-has-own.js +2 -2
- package/lib/rules/prefer-object-spread.js +2 -2
- package/lib/rules/prefer-promise-reject-errors.js +2 -2
- package/lib/rules/prefer-reflect.js +1 -1
- package/lib/rules/prefer-regex-literals.js +14 -17
- package/lib/rules/prefer-rest-params.js +2 -2
- package/lib/rules/prefer-spread.js +2 -2
- package/lib/rules/prefer-template.js +2 -2
- package/lib/rules/quote-props.js +2 -2
- package/lib/rules/quotes.js +16 -16
- package/lib/rules/radix.js +2 -2
- package/lib/rules/require-atomic-updates.js +2 -2
- package/lib/rules/require-await.js +2 -2
- package/lib/rules/require-jsdoc.js +2 -2
- package/lib/rules/require-unicode-regexp.js +5 -5
- package/lib/rules/require-yield.js +1 -1
- package/lib/rules/rest-spread-spacing.js +2 -2
- package/lib/rules/semi-spacing.js +2 -2
- package/lib/rules/semi-style.js +2 -2
- package/lib/rules/semi.js +30 -5
- package/lib/rules/sort-imports.js +2 -2
- package/lib/rules/sort-keys.js +2 -2
- package/lib/rules/sort-vars.js +2 -2
- package/lib/rules/space-before-blocks.js +2 -2
- package/lib/rules/space-before-function-paren.js +2 -2
- package/lib/rules/space-in-parens.js +2 -2
- package/lib/rules/space-infix-ops.js +2 -2
- package/lib/rules/space-unary-ops.js +2 -2
- package/lib/rules/spaced-comment.js +2 -2
- package/lib/rules/strict.js +1 -1
- package/lib/rules/switch-colon-spacing.js +2 -2
- package/lib/rules/symbol-description.js +2 -2
- package/lib/rules/template-curly-spacing.js +2 -2
- package/lib/rules/template-tag-spacing.js +2 -2
- package/lib/rules/unicode-bom.js +2 -2
- package/lib/rules/use-isnan.js +1 -1
- package/lib/rules/utils/ast-utils.js +55 -7
- package/lib/rules/utils/regular-expressions.js +2 -2
- package/lib/rules/valid-jsdoc.js +2 -2
- package/lib/rules/valid-typeof.js +9 -3
- package/lib/rules/vars-on-top.js +1 -1
- package/lib/rules/wrap-iife.js +2 -2
- package/lib/rules/wrap-regex.js +2 -2
- package/lib/rules/yield-star-spacing.js +2 -2
- package/lib/rules/yoda.js +4 -13
- package/lib/shared/string-utils.js +39 -1
- package/lib/shared/types.js +7 -3
- package/lib/unsupported-api.js +5 -2
- package/messages/eslintrc-incompat.js +98 -0
- package/messages/eslintrc-plugins.js +24 -0
- package/messages/invalid-rule-options.js +17 -0
- package/messages/invalid-rule-severity.js +13 -0
- package/messages/shared.js +18 -0
- package/package.json +15 -19
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Enforce consistent linebreak style for operators",
|
25
25
|
recommended: false,
|
26
|
-
url: "https://eslint.org/docs/rules/operator-linebreak"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/operator-linebreak"
|
27
27
|
},
|
28
28
|
|
29
29
|
schema: [
|
@@ -69,7 +69,7 @@ module.exports = {
|
|
69
69
|
styleOverrides[":"] = "before";
|
70
70
|
}
|
71
71
|
|
72
|
-
const sourceCode = context.
|
72
|
+
const sourceCode = context.sourceCode;
|
73
73
|
|
74
74
|
//--------------------------------------------------------------------------
|
75
75
|
// Helpers
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Require or disallow padding within blocks",
|
25
25
|
recommended: false,
|
26
|
-
url: "https://eslint.org/docs/rules/padded-blocks"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/padded-blocks"
|
27
27
|
},
|
28
28
|
|
29
29
|
fixable: "whitespace",
|
@@ -96,7 +96,7 @@ module.exports = {
|
|
96
96
|
options.allowSingleLineBlocks = exceptOptions.allowSingleLineBlocks === true;
|
97
97
|
}
|
98
98
|
|
99
|
-
const sourceCode = context.
|
99
|
+
const sourceCode = context.sourceCode;
|
100
100
|
|
101
101
|
/**
|
102
102
|
* Gets the open brace token from a given node.
|
@@ -130,49 +130,6 @@ function isBlockLikeStatement(sourceCode, node) {
|
|
130
130
|
);
|
131
131
|
}
|
132
132
|
|
133
|
-
/**
|
134
|
-
* Check whether the given node is a directive or not.
|
135
|
-
* @param {ASTNode} node The node to check.
|
136
|
-
* @param {SourceCode} sourceCode The source code object to get tokens.
|
137
|
-
* @returns {boolean} `true` if the node is a directive.
|
138
|
-
*/
|
139
|
-
function isDirective(node, sourceCode) {
|
140
|
-
return (
|
141
|
-
node.type === "ExpressionStatement" &&
|
142
|
-
(
|
143
|
-
node.parent.type === "Program" ||
|
144
|
-
(
|
145
|
-
node.parent.type === "BlockStatement" &&
|
146
|
-
astUtils.isFunction(node.parent.parent)
|
147
|
-
)
|
148
|
-
) &&
|
149
|
-
node.expression.type === "Literal" &&
|
150
|
-
typeof node.expression.value === "string" &&
|
151
|
-
!astUtils.isParenthesised(sourceCode, node.expression)
|
152
|
-
);
|
153
|
-
}
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Check whether the given node is a part of directive prologue or not.
|
157
|
-
* @param {ASTNode} node The node to check.
|
158
|
-
* @param {SourceCode} sourceCode The source code object to get tokens.
|
159
|
-
* @returns {boolean} `true` if the node is a part of directive prologue.
|
160
|
-
*/
|
161
|
-
function isDirectivePrologue(node, sourceCode) {
|
162
|
-
if (isDirective(node, sourceCode)) {
|
163
|
-
for (const sibling of node.parent.body) {
|
164
|
-
if (sibling === node) {
|
165
|
-
break;
|
166
|
-
}
|
167
|
-
if (!isDirective(sibling, sourceCode)) {
|
168
|
-
return false;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
return true;
|
172
|
-
}
|
173
|
-
return false;
|
174
|
-
}
|
175
|
-
|
176
133
|
/**
|
177
134
|
* Gets the actual last token.
|
178
135
|
*
|
@@ -253,7 +210,7 @@ function verifyForNever(context, _, nextNode, paddingLines) {
|
|
253
210
|
const nextToken = paddingLines[0][1];
|
254
211
|
const start = prevToken.range[1];
|
255
212
|
const end = nextToken.range[0];
|
256
|
-
const text = context.
|
213
|
+
const text = context.sourceCode.text
|
257
214
|
.slice(start, end)
|
258
215
|
.replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines);
|
259
216
|
|
@@ -284,7 +241,7 @@ function verifyForAlways(context, prevNode, nextNode, paddingLines) {
|
|
284
241
|
node: nextNode,
|
285
242
|
messageId: "expectedBlankLine",
|
286
243
|
fix(fixer) {
|
287
|
-
const sourceCode = context.
|
244
|
+
const sourceCode = context.sourceCode;
|
288
245
|
let prevToken = getActualLastToken(sourceCode, prevNode);
|
289
246
|
const nextToken = sourceCode.getFirstTokenBetween(
|
290
247
|
prevToken,
|
@@ -366,12 +323,10 @@ const StatementTypes = {
|
|
366
323
|
CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init))
|
367
324
|
},
|
368
325
|
directive: {
|
369
|
-
test:
|
326
|
+
test: astUtils.isDirective
|
370
327
|
},
|
371
328
|
expression: {
|
372
|
-
test: (node
|
373
|
-
node.type === "ExpressionStatement" &&
|
374
|
-
!isDirectivePrologue(node, sourceCode)
|
329
|
+
test: node => node.type === "ExpressionStatement" && !astUtils.isDirective(node)
|
375
330
|
},
|
376
331
|
iife: {
|
377
332
|
test: isIIFEStatement
|
@@ -382,10 +337,10 @@ const StatementTypes = {
|
|
382
337
|
isBlockLikeStatement(sourceCode, node)
|
383
338
|
},
|
384
339
|
"multiline-expression": {
|
385
|
-
test:
|
340
|
+
test: node =>
|
386
341
|
node.loc.start.line !== node.loc.end.line &&
|
387
342
|
node.type === "ExpressionStatement" &&
|
388
|
-
!
|
343
|
+
!astUtils.isDirective(node)
|
389
344
|
},
|
390
345
|
|
391
346
|
"multiline-const": newMultilineKeywordTester("const"),
|
@@ -433,7 +388,7 @@ module.exports = {
|
|
433
388
|
docs: {
|
434
389
|
description: "Require or disallow padding lines between statements",
|
435
390
|
recommended: false,
|
436
|
-
url: "https://eslint.org/docs/rules/padding-line-between-statements"
|
391
|
+
url: "https://eslint.org/docs/latest/rules/padding-line-between-statements"
|
437
392
|
},
|
438
393
|
|
439
394
|
fixable: "whitespace",
|
@@ -475,7 +430,7 @@ module.exports = {
|
|
475
430
|
},
|
476
431
|
|
477
432
|
create(context) {
|
478
|
-
const sourceCode = context.
|
433
|
+
const sourceCode = context.sourceCode;
|
479
434
|
const configureList = context.options || [];
|
480
435
|
let scopeInfo = null;
|
481
436
|
|
@@ -153,7 +153,7 @@ module.exports = {
|
|
153
153
|
docs: {
|
154
154
|
description: "Require using arrow functions for callbacks",
|
155
155
|
recommended: false,
|
156
|
-
url: "https://eslint.org/docs/rules/prefer-arrow-callback"
|
156
|
+
url: "https://eslint.org/docs/latest/rules/prefer-arrow-callback"
|
157
157
|
},
|
158
158
|
|
159
159
|
schema: [
|
@@ -185,7 +185,7 @@ module.exports = {
|
|
185
185
|
|
186
186
|
const allowUnboundThis = options.allowUnboundThis !== false; // default to true
|
187
187
|
const allowNamedFunctions = options.allowNamedFunctions;
|
188
|
-
const sourceCode = context.
|
188
|
+
const sourceCode = context.sourceCode;
|
189
189
|
|
190
190
|
/*
|
191
191
|
* {Array<{this: boolean, super: boolean, meta: boolean}>}
|
@@ -334,7 +334,7 @@ module.exports = {
|
|
334
334
|
docs: {
|
335
335
|
description: "Require `const` declarations for variables that are never reassigned after declared",
|
336
336
|
recommended: false,
|
337
|
-
url: "https://eslint.org/docs/rules/prefer-const"
|
337
|
+
url: "https://eslint.org/docs/latest/rules/prefer-const"
|
338
338
|
},
|
339
339
|
|
340
340
|
fixable: "code",
|
@@ -356,7 +356,7 @@ module.exports = {
|
|
356
356
|
|
357
357
|
create(context) {
|
358
358
|
const options = context.options[0] || {};
|
359
|
-
const sourceCode = context.
|
359
|
+
const sourceCode = context.sourceCode;
|
360
360
|
const shouldMatchAnyDestructuredVariable = options.destructuring !== "all";
|
361
361
|
const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true;
|
362
362
|
const variables = [];
|
@@ -28,7 +28,7 @@ module.exports = {
|
|
28
28
|
docs: {
|
29
29
|
description: "Require destructuring from arrays and/or objects",
|
30
30
|
recommended: false,
|
31
|
-
url: "https://eslint.org/docs/rules/prefer-destructuring"
|
31
|
+
url: "https://eslint.org/docs/latest/rules/prefer-destructuring"
|
32
32
|
},
|
33
33
|
|
34
34
|
fixable: "code",
|
@@ -190,7 +190,7 @@ module.exports = {
|
|
190
190
|
*/
|
191
191
|
function fixIntoObjectDestructuring(fixer, node) {
|
192
192
|
const rightNode = node.init;
|
193
|
-
const sourceCode = context.
|
193
|
+
const sourceCode = context.sourceCode;
|
194
194
|
|
195
195
|
// Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved.
|
196
196
|
if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) {
|
@@ -55,11 +55,12 @@ function doesExponentNeedParens(exponent) {
|
|
55
55
|
function doesExponentiationExpressionNeedParens(node, sourceCode) {
|
56
56
|
const parent = node.parent.type === "ChainExpression" ? node.parent.parent : node.parent;
|
57
57
|
|
58
|
+
const parentPrecedence = astUtils.getPrecedence(parent);
|
58
59
|
const needsParens = (
|
59
60
|
parent.type === "ClassDeclaration" ||
|
60
61
|
(
|
61
62
|
parent.type.endsWith("Expression") &&
|
62
|
-
|
63
|
+
(parentPrecedence === -1 || parentPrecedence >= PRECEDENCE_OF_EXPONENTIATION_EXPR) &&
|
63
64
|
!(parent.type === "BinaryExpression" && parent.operator === "**" && parent.right === node) &&
|
64
65
|
!((parent.type === "CallExpression" || parent.type === "NewExpression") && parent.arguments.includes(node)) &&
|
65
66
|
!(parent.type === "MemberExpression" && parent.computed && parent.property === node) &&
|
@@ -92,7 +93,7 @@ module.exports = {
|
|
92
93
|
docs: {
|
93
94
|
description: "Disallow the use of `Math.pow` in favor of the `**` operator",
|
94
95
|
recommended: false,
|
95
|
-
url: "https://eslint.org/docs/rules/prefer-exponentiation-operator"
|
96
|
+
url: "https://eslint.org/docs/latest/rules/prefer-exponentiation-operator"
|
96
97
|
},
|
97
98
|
|
98
99
|
schema: [],
|
@@ -104,7 +105,7 @@ module.exports = {
|
|
104
105
|
},
|
105
106
|
|
106
107
|
create(context) {
|
107
|
-
const sourceCode = context.
|
108
|
+
const sourceCode = context.sourceCode;
|
108
109
|
|
109
110
|
/**
|
110
111
|
* Reports the given node.
|
@@ -90,7 +90,7 @@ module.exports = {
|
|
90
90
|
docs: {
|
91
91
|
description: "Enforce using named capture group in regular expression",
|
92
92
|
recommended: false,
|
93
|
-
url: "https://eslint.org/docs/rules/prefer-named-capture-group"
|
93
|
+
url: "https://eslint.org/docs/latest/rules/prefer-named-capture-group"
|
94
94
|
},
|
95
95
|
|
96
96
|
hasSuggestions: true,
|
@@ -105,21 +105,24 @@ module.exports = {
|
|
105
105
|
},
|
106
106
|
|
107
107
|
create(context) {
|
108
|
-
const sourceCode = context.
|
108
|
+
const sourceCode = context.sourceCode;
|
109
109
|
|
110
110
|
/**
|
111
111
|
* Function to check regular expression.
|
112
112
|
* @param {string} pattern The regular expression pattern to be checked.
|
113
113
|
* @param {ASTNode} node AST node which contains the regular expression or a call/new expression.
|
114
114
|
* @param {ASTNode} regexNode AST node which contains the regular expression.
|
115
|
-
* @param {
|
115
|
+
* @param {string|null} flags The regular expression flags to be checked.
|
116
116
|
* @returns {void}
|
117
117
|
*/
|
118
|
-
function checkRegex(pattern, node, regexNode,
|
118
|
+
function checkRegex(pattern, node, regexNode, flags) {
|
119
119
|
let ast;
|
120
120
|
|
121
121
|
try {
|
122
|
-
ast = parser.parsePattern(pattern, 0, pattern.length,
|
122
|
+
ast = parser.parsePattern(pattern, 0, pattern.length, {
|
123
|
+
unicode: Boolean(flags && flags.includes("u")),
|
124
|
+
unicodeSets: Boolean(flags && flags.includes("v"))
|
125
|
+
});
|
123
126
|
} catch {
|
124
127
|
|
125
128
|
// ignore regex syntax errors
|
@@ -148,7 +151,7 @@ module.exports = {
|
|
148
151
|
return {
|
149
152
|
Literal(node) {
|
150
153
|
if (node.regex) {
|
151
|
-
checkRegex(node.regex.pattern, node, node, node.regex.flags
|
154
|
+
checkRegex(node.regex.pattern, node, node, node.regex.flags);
|
152
155
|
}
|
153
156
|
},
|
154
157
|
Program(node) {
|
@@ -166,7 +169,7 @@ module.exports = {
|
|
166
169
|
const flags = getStringIfConstant(refNode.arguments[1]);
|
167
170
|
|
168
171
|
if (regex) {
|
169
|
-
checkRegex(regex, refNode, refNode.arguments[0], flags
|
172
|
+
checkRegex(regex, refNode, refNode.arguments[0], flags);
|
170
173
|
}
|
171
174
|
}
|
172
175
|
}
|
@@ -47,7 +47,7 @@ module.exports = {
|
|
47
47
|
docs: {
|
48
48
|
description: "Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals",
|
49
49
|
recommended: false,
|
50
|
-
url: "https://eslint.org/docs/rules/prefer-numeric-literals"
|
50
|
+
url: "https://eslint.org/docs/latest/rules/prefer-numeric-literals"
|
51
51
|
},
|
52
52
|
|
53
53
|
schema: [],
|
@@ -60,7 +60,7 @@ module.exports = {
|
|
60
60
|
},
|
61
61
|
|
62
62
|
create(context) {
|
63
|
-
const sourceCode = context.
|
63
|
+
const sourceCode = context.sourceCode;
|
64
64
|
|
65
65
|
//----------------------------------------------------------------------
|
66
66
|
// Public
|
@@ -52,7 +52,7 @@ module.exports = {
|
|
52
52
|
description:
|
53
53
|
"Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`",
|
54
54
|
recommended: false,
|
55
|
-
url: "https://eslint.org/docs/rules/prefer-object-has-own"
|
55
|
+
url: "https://eslint.org/docs/latest/rules/prefer-object-has-own"
|
56
56
|
},
|
57
57
|
schema: [],
|
58
58
|
messages: {
|
@@ -62,7 +62,7 @@ module.exports = {
|
|
62
62
|
},
|
63
63
|
create(context) {
|
64
64
|
|
65
|
-
const sourceCode = context.
|
65
|
+
const sourceCode = context.sourceCode;
|
66
66
|
|
67
67
|
return {
|
68
68
|
CallExpression(node) {
|
@@ -248,7 +248,7 @@ module.exports = {
|
|
248
248
|
description:
|
249
249
|
"Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead",
|
250
250
|
recommended: false,
|
251
|
-
url: "https://eslint.org/docs/rules/prefer-object-spread"
|
251
|
+
url: "https://eslint.org/docs/latest/rules/prefer-object-spread"
|
252
252
|
},
|
253
253
|
|
254
254
|
schema: [],
|
@@ -261,7 +261,7 @@ module.exports = {
|
|
261
261
|
},
|
262
262
|
|
263
263
|
create(context) {
|
264
|
-
const sourceCode = context.
|
264
|
+
const sourceCode = context.sourceCode;
|
265
265
|
|
266
266
|
return {
|
267
267
|
Program(node) {
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
18
18
|
docs: {
|
19
19
|
description: "Require using Error objects as Promise rejection reasons",
|
20
20
|
recommended: false,
|
21
|
-
url: "https://eslint.org/docs/rules/prefer-promise-reject-errors"
|
21
|
+
url: "https://eslint.org/docs/latest/rules/prefer-promise-reject-errors"
|
22
22
|
},
|
23
23
|
|
24
24
|
fixable: null,
|
@@ -41,7 +41,7 @@ module.exports = {
|
|
41
41
|
create(context) {
|
42
42
|
|
43
43
|
const ALLOW_EMPTY_REJECT = context.options.length && context.options[0].allowEmptyReject;
|
44
|
-
const sourceCode = context.
|
44
|
+
const sourceCode = context.sourceCode;
|
45
45
|
|
46
46
|
//----------------------------------------------------------------------
|
47
47
|
// Helpers
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
docs: {
|
18
18
|
description: "Require `Reflect` methods where applicable",
|
19
19
|
recommended: false,
|
20
|
-
url: "https://eslint.org/docs/rules/prefer-reflect"
|
20
|
+
url: "https://eslint.org/docs/latest/rules/prefer-reflect"
|
21
21
|
},
|
22
22
|
|
23
23
|
deprecated: true,
|
@@ -37,15 +37,6 @@ function isRegexLiteral(node) {
|
|
37
37
|
return node.type === "Literal" && Object.prototype.hasOwnProperty.call(node, "regex");
|
38
38
|
}
|
39
39
|
|
40
|
-
/**
|
41
|
-
* Determines whether the given node is a template literal without expressions.
|
42
|
-
* @param {ASTNode} node Node to check.
|
43
|
-
* @returns {boolean} True if the node is a template literal without expressions.
|
44
|
-
*/
|
45
|
-
function isStaticTemplateLiteral(node) {
|
46
|
-
return node.type === "TemplateLiteral" && node.expressions.length === 0;
|
47
|
-
}
|
48
|
-
|
49
40
|
const validPrecedingTokens = new Set([
|
50
41
|
"(",
|
51
42
|
";",
|
@@ -124,7 +115,7 @@ module.exports = {
|
|
124
115
|
docs: {
|
125
116
|
description: "Disallow use of the `RegExp` constructor in favor of regular expression literals",
|
126
117
|
recommended: false,
|
127
|
-
url: "https://eslint.org/docs/rules/prefer-regex-literals"
|
118
|
+
url: "https://eslint.org/docs/latest/rules/prefer-regex-literals"
|
128
119
|
},
|
129
120
|
|
130
121
|
hasSuggestions: true,
|
@@ -154,7 +145,7 @@ module.exports = {
|
|
154
145
|
|
155
146
|
create(context) {
|
156
147
|
const [{ disallowRedundantWrapping = false } = {}] = context.options;
|
157
|
-
const sourceCode = context.
|
148
|
+
const sourceCode = context.sourceCode;
|
158
149
|
|
159
150
|
/**
|
160
151
|
* Determines whether the given identifier node is a reference to a global variable.
|
@@ -178,7 +169,7 @@ module.exports = {
|
|
178
169
|
return node.type === "TaggedTemplateExpression" &&
|
179
170
|
astUtils.isSpecificMemberAccess(node.tag, "String", "raw") &&
|
180
171
|
isGlobalReference(astUtils.skipChainExpression(node.tag).object) &&
|
181
|
-
isStaticTemplateLiteral(node.quasi);
|
172
|
+
astUtils.isStaticTemplateLiteral(node.quasi);
|
182
173
|
}
|
183
174
|
|
184
175
|
/**
|
@@ -191,7 +182,7 @@ module.exports = {
|
|
191
182
|
return node.value;
|
192
183
|
}
|
193
184
|
|
194
|
-
if (isStaticTemplateLiteral(node)) {
|
185
|
+
if (astUtils.isStaticTemplateLiteral(node)) {
|
195
186
|
return node.quasis[0].value.cooked;
|
196
187
|
}
|
197
188
|
|
@@ -209,7 +200,7 @@ module.exports = {
|
|
209
200
|
*/
|
210
201
|
function isStaticString(node) {
|
211
202
|
return isStringLiteral(node) ||
|
212
|
-
isStaticTemplateLiteral(node) ||
|
203
|
+
astUtils.isStaticTemplateLiteral(node) ||
|
213
204
|
isStringRawTaggedStaticTemplateLiteral(node);
|
214
205
|
}
|
215
206
|
|
@@ -250,7 +241,7 @@ module.exports = {
|
|
250
241
|
/**
|
251
242
|
* Returns a ecmaVersion compatible for regexpp.
|
252
243
|
* @param {number} ecmaVersion The ecmaVersion to convert.
|
253
|
-
* @returns {import("regexpp/ecma-versions").EcmaVersion} The resulting ecmaVersion compatible for regexpp.
|
244
|
+
* @returns {import("@eslint-community/regexpp/ecma-versions").EcmaVersion} The resulting ecmaVersion compatible for regexpp.
|
254
245
|
*/
|
255
246
|
function getRegexppEcmaVersion(ecmaVersion) {
|
256
247
|
if (ecmaVersion <= 5) {
|
@@ -306,7 +297,10 @@ module.exports = {
|
|
306
297
|
const validator = new RegExpValidator({ ecmaVersion: regexppEcmaVersion });
|
307
298
|
|
308
299
|
try {
|
309
|
-
validator.validatePattern(pattern, 0, pattern.length,
|
300
|
+
validator.validatePattern(pattern, 0, pattern.length, {
|
301
|
+
unicode: flags ? flags.includes("u") : false,
|
302
|
+
unicodeSets: flags ? flags.includes("v") : false
|
303
|
+
});
|
310
304
|
if (flags) {
|
311
305
|
validator.validateFlags(flags);
|
312
306
|
}
|
@@ -470,7 +464,10 @@ module.exports = {
|
|
470
464
|
if (regexContent && !noFix) {
|
471
465
|
let charIncrease = 0;
|
472
466
|
|
473
|
-
const ast = new RegExpParser({ ecmaVersion: regexppEcmaVersion }).parsePattern(regexContent, 0, regexContent.length,
|
467
|
+
const ast = new RegExpParser({ ecmaVersion: regexppEcmaVersion }).parsePattern(regexContent, 0, regexContent.length, {
|
468
|
+
unicode: flags ? flags.includes("u") : false,
|
469
|
+
unicodeSets: flags ? flags.includes("v") : false
|
470
|
+
});
|
474
471
|
|
475
472
|
visitRegExpAST(ast, {
|
476
473
|
onCharacterEnter(characterNode) {
|
@@ -67,7 +67,7 @@ module.exports = {
|
|
67
67
|
docs: {
|
68
68
|
description: "Require rest parameters instead of `arguments`",
|
69
69
|
recommended: false,
|
70
|
-
url: "https://eslint.org/docs/rules/prefer-rest-params"
|
70
|
+
url: "https://eslint.org/docs/latest/rules/prefer-rest-params"
|
71
71
|
},
|
72
72
|
|
73
73
|
schema: [],
|
@@ -79,7 +79,7 @@ module.exports = {
|
|
79
79
|
|
80
80
|
create(context) {
|
81
81
|
|
82
|
-
const sourceCode = context.
|
82
|
+
const sourceCode = context.sourceCode;
|
83
83
|
|
84
84
|
/**
|
85
85
|
* Reports a given reference.
|
@@ -51,7 +51,7 @@ module.exports = {
|
|
51
51
|
docs: {
|
52
52
|
description: "Require spread operators instead of `.apply()`",
|
53
53
|
recommended: false,
|
54
|
-
url: "https://eslint.org/docs/rules/prefer-spread"
|
54
|
+
url: "https://eslint.org/docs/latest/rules/prefer-spread"
|
55
55
|
},
|
56
56
|
|
57
57
|
schema: [],
|
@@ -63,7 +63,7 @@ module.exports = {
|
|
63
63
|
},
|
64
64
|
|
65
65
|
create(context) {
|
66
|
-
const sourceCode = context.
|
66
|
+
const sourceCode = context.sourceCode;
|
67
67
|
|
68
68
|
return {
|
69
69
|
CallExpression(node) {
|
@@ -130,7 +130,7 @@ module.exports = {
|
|
130
130
|
docs: {
|
131
131
|
description: "Require template literals instead of string concatenation",
|
132
132
|
recommended: false,
|
133
|
-
url: "https://eslint.org/docs/rules/prefer-template"
|
133
|
+
url: "https://eslint.org/docs/latest/rules/prefer-template"
|
134
134
|
},
|
135
135
|
|
136
136
|
schema: [],
|
@@ -142,7 +142,7 @@ module.exports = {
|
|
142
142
|
},
|
143
143
|
|
144
144
|
create(context) {
|
145
|
-
const sourceCode = context.
|
145
|
+
const sourceCode = context.sourceCode;
|
146
146
|
let done = Object.create(null);
|
147
147
|
|
148
148
|
/**
|
package/lib/rules/quote-props.js
CHANGED
@@ -24,7 +24,7 @@ module.exports = {
|
|
24
24
|
docs: {
|
25
25
|
description: "Require quotes around object literal property names",
|
26
26
|
recommended: false,
|
27
|
-
url: "https://eslint.org/docs/rules/quote-props"
|
27
|
+
url: "https://eslint.org/docs/latest/rules/quote-props"
|
28
28
|
},
|
29
29
|
|
30
30
|
schema: {
|
@@ -86,7 +86,7 @@ module.exports = {
|
|
86
86
|
CHECK_UNNECESSARY = !context.options[1] || context.options[1].unnecessary !== false,
|
87
87
|
NUMBERS = context.options[1] && context.options[1].numbers,
|
88
88
|
|
89
|
-
sourceCode = context.
|
89
|
+
sourceCode = context.sourceCode;
|
90
90
|
|
91
91
|
|
92
92
|
/**
|
package/lib/rules/quotes.js
CHANGED
@@ -82,7 +82,7 @@ module.exports = {
|
|
82
82
|
docs: {
|
83
83
|
description: "Enforce the consistent use of either backticks, double, or single quotes",
|
84
84
|
recommended: false,
|
85
|
-
url: "https://eslint.org/docs/rules/quotes"
|
85
|
+
url: "https://eslint.org/docs/latest/rules/quotes"
|
86
86
|
},
|
87
87
|
|
88
88
|
fixable: "code",
|
@@ -123,7 +123,7 @@ module.exports = {
|
|
123
123
|
settings = QUOTE_SETTINGS[quoteOption || "double"],
|
124
124
|
options = context.options[1],
|
125
125
|
allowTemplateLiterals = options && options.allowTemplateLiterals === true,
|
126
|
-
sourceCode = context.
|
126
|
+
sourceCode = context.sourceCode;
|
127
127
|
let avoidEscape = options && options.avoidEscape === true;
|
128
128
|
|
129
129
|
// deprecated
|
@@ -157,7 +157,8 @@ module.exports = {
|
|
157
157
|
|
158
158
|
/**
|
159
159
|
* Checks whether or not a given node is a directive.
|
160
|
-
* The directive is a `ExpressionStatement` which has only a string literal
|
160
|
+
* The directive is a `ExpressionStatement` which has only a string literal not surrounded by
|
161
|
+
* parentheses.
|
161
162
|
* @param {ASTNode} node A node to check.
|
162
163
|
* @returns {boolean} Whether or not the node is a directive.
|
163
164
|
* @private
|
@@ -166,23 +167,23 @@ module.exports = {
|
|
166
167
|
return (
|
167
168
|
node.type === "ExpressionStatement" &&
|
168
169
|
node.expression.type === "Literal" &&
|
169
|
-
typeof node.expression.value === "string"
|
170
|
+
typeof node.expression.value === "string" &&
|
171
|
+
!astUtils.isParenthesised(sourceCode, node.expression)
|
170
172
|
);
|
171
173
|
}
|
172
174
|
|
173
175
|
/**
|
174
|
-
* Checks whether
|
175
|
-
*
|
176
|
+
* Checks whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue.
|
177
|
+
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive}
|
176
178
|
* @param {ASTNode} node A node to check.
|
177
|
-
* @returns {boolean} Whether
|
179
|
+
* @returns {boolean} Whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue.
|
178
180
|
* @private
|
179
181
|
*/
|
180
|
-
function
|
181
|
-
|
182
|
-
|
183
|
-
if (block.type !== "Program" && (block.type !== "BlockStatement" || !astUtils.isFunction(block.parent))) {
|
182
|
+
function isExpressionInOrJustAfterDirectivePrologue(node) {
|
183
|
+
if (!astUtils.isTopLevelExpressionStatement(node.parent)) {
|
184
184
|
return false;
|
185
185
|
}
|
186
|
+
const block = node.parent.parent;
|
186
187
|
|
187
188
|
// Check the node is at a prologue.
|
188
189
|
for (let i = 0; i < block.body.length; ++i) {
|
@@ -212,7 +213,7 @@ module.exports = {
|
|
212
213
|
|
213
214
|
// Directive Prologues.
|
214
215
|
case "ExpressionStatement":
|
215
|
-
return
|
216
|
+
return !astUtils.isParenthesised(sourceCode, node) && isExpressionInOrJustAfterDirectivePrologue(node);
|
216
217
|
|
217
218
|
// LiteralPropertyName.
|
218
219
|
case "Property":
|
@@ -328,12 +329,11 @@ module.exports = {
|
|
328
329
|
description: settings.description
|
329
330
|
},
|
330
331
|
fix(fixer) {
|
331
|
-
if (
|
332
|
+
if (astUtils.isTopLevelExpressionStatement(node.parent) && !astUtils.isParenthesised(sourceCode, node)) {
|
332
333
|
|
333
334
|
/*
|
334
|
-
* TemplateLiterals
|
335
|
-
*
|
336
|
-
* the behavior of the code.
|
335
|
+
* TemplateLiterals aren't actually directives, but fixing them might turn
|
336
|
+
* them into directives and change the behavior of the code.
|
337
337
|
*/
|
338
338
|
return null;
|
339
339
|
}
|
package/lib/rules/radix.js
CHANGED
@@ -82,7 +82,7 @@ module.exports = {
|
|
82
82
|
docs: {
|
83
83
|
description: "Enforce the consistent use of the radix argument when using `parseInt()`",
|
84
84
|
recommended: false,
|
85
|
-
url: "https://eslint.org/docs/rules/radix"
|
85
|
+
url: "https://eslint.org/docs/latest/rules/radix"
|
86
86
|
},
|
87
87
|
|
88
88
|
hasSuggestions: true,
|
@@ -104,7 +104,7 @@ module.exports = {
|
|
104
104
|
|
105
105
|
create(context) {
|
106
106
|
const mode = context.options[0] || MODE_ALWAYS;
|
107
|
-
const sourceCode = context.
|
107
|
+
const sourceCode = context.sourceCode;
|
108
108
|
|
109
109
|
/**
|
110
110
|
* Checks the arguments of a given CallExpression node and reports it if it
|