eslint 8.38.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 +3 -7
- package/lib/config/flat-config-schema.js +57 -35
- package/lib/eslint/flat-eslint.js +56 -16
- package/lib/linter/linter.js +7 -35
- 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 +3 -3
- package/lib/rules/no-lonely-if.js +4 -5
- 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 +6 -8
- 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 -3
- 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 +3 -3
- package/lib/rules/vars-on-top.js +1 -1
- package/lib/rules/wrap-iife.js +2 -2
- package/lib/rules/wrap-regex.js +4 -5
- package/lib/rules/yield-star-spacing.js +2 -2
- package/lib/rules/yoda.js +3 -3
- package/lib/shared/string-utils.js +39 -1
- package/lib/source-code/source-code.js +47 -4
- package/lib/source-code/token-store/utils.js +21 -16
- 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 +6 -6
package/README.md
CHANGED
@@ -16,7 +16,8 @@
|
|
16
16
|
[Report Bugs](https://eslint.org/docs/latest/contribute/report-bugs) |
|
17
17
|
[Code of Conduct](https://eslint.org/conduct) |
|
18
18
|
[Twitter](https://twitter.com/geteslint) |
|
19
|
-
[Discord](https://eslint.org/chat)
|
19
|
+
[Discord](https://eslint.org/chat) |
|
20
|
+
[Mastodon](https://fosstodon.org/@eslint)
|
20
21
|
|
21
22
|
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:
|
22
23
|
|
@@ -248,11 +249,6 @@ Bryan Mishkin
|
|
248
249
|
<img src="https://github.com/fasttime.png?s=75" width="75" height="75"><br />
|
249
250
|
Francesco Trotta
|
250
251
|
</a>
|
251
|
-
</td><td align="center" valign="top" width="11%">
|
252
|
-
<a href="https://github.com/yeonjuan">
|
253
|
-
<img src="https://github.com/yeonjuan.png?s=75" width="75" height="75"><br />
|
254
|
-
YeonJuan
|
255
|
-
</a>
|
256
252
|
</td></tr></tbody></table>
|
257
253
|
|
258
254
|
### Website Team
|
@@ -286,7 +282,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
286
282
|
<!--sponsorsstart-->
|
287
283
|
<h3>Platinum Sponsors</h3>
|
288
284
|
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
|
289
|
-
<p><a href="https://
|
285
|
+
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
290
286
|
<p><a href="https://sentry.io"><img src="https://avatars.githubusercontent.com/u/1396951?v=4" alt="Sentry" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
291
287
|
<p><a href="https://paydaysay.com/"><img src="https://images.opencollective.com/payday-say-organization/9cd2467/logo.png" alt="PayDay Say" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
292
288
|
<!--sponsorsend-->
|
@@ -126,32 +126,65 @@ function normalizeRuleOptions(ruleOptions) {
|
|
126
126
|
// Assertions
|
127
127
|
//-----------------------------------------------------------------------------
|
128
128
|
|
129
|
+
/**
|
130
|
+
* The error type when a rule's options are configured with an invalid type.
|
131
|
+
*/
|
132
|
+
class InvalidRuleOptionsError extends Error {
|
133
|
+
|
134
|
+
/**
|
135
|
+
* @param {string} ruleId Rule name being configured.
|
136
|
+
* @param {any} value The invalid value.
|
137
|
+
*/
|
138
|
+
constructor(ruleId, value) {
|
139
|
+
super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`);
|
140
|
+
this.messageTemplate = "invalid-rule-options";
|
141
|
+
this.messageData = { ruleId, value };
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
129
145
|
/**
|
130
146
|
* Validates that a value is a valid rule options entry.
|
147
|
+
* @param {string} ruleId Rule name being configured.
|
131
148
|
* @param {any} value The value to check.
|
132
149
|
* @returns {void}
|
133
|
-
* @throws {
|
150
|
+
* @throws {InvalidRuleOptionsError} If the value isn't a valid rule options.
|
134
151
|
*/
|
135
|
-
function assertIsRuleOptions(value) {
|
136
|
-
|
152
|
+
function assertIsRuleOptions(ruleId, value) {
|
137
153
|
if (typeof value !== "string" && typeof value !== "number" && !Array.isArray(value)) {
|
138
|
-
throw new
|
154
|
+
throw new InvalidRuleOptionsError(ruleId, value);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* The error type when a rule's severity is invalid.
|
160
|
+
*/
|
161
|
+
class InvalidRuleSeverityError extends Error {
|
162
|
+
|
163
|
+
/**
|
164
|
+
* @param {string} ruleId Rule name being configured.
|
165
|
+
* @param {any} value The invalid value.
|
166
|
+
*/
|
167
|
+
constructor(ruleId, value) {
|
168
|
+
super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`);
|
169
|
+
this.messageTemplate = "invalid-rule-severity";
|
170
|
+
this.messageData = { ruleId, value };
|
139
171
|
}
|
140
172
|
}
|
141
173
|
|
142
174
|
/**
|
143
175
|
* Validates that a value is valid rule severity.
|
176
|
+
* @param {string} ruleId Rule name being configured.
|
144
177
|
* @param {any} value The value to check.
|
145
178
|
* @returns {void}
|
146
|
-
* @throws {
|
179
|
+
* @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity.
|
147
180
|
*/
|
148
|
-
function assertIsRuleSeverity(value) {
|
181
|
+
function assertIsRuleSeverity(ruleId, value) {
|
149
182
|
const severity = typeof value === "string"
|
150
183
|
? ruleSeverities.get(value.toLowerCase())
|
151
184
|
: ruleSeverities.get(value);
|
152
185
|
|
153
186
|
if (typeof severity === "undefined") {
|
154
|
-
throw new
|
187
|
+
throw new InvalidRuleSeverityError(ruleId, value);
|
155
188
|
}
|
156
189
|
}
|
157
190
|
|
@@ -357,39 +390,28 @@ const rulesSchema = {
|
|
357
390
|
validate(value) {
|
358
391
|
assertIsObject(value);
|
359
392
|
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
* guarantee that the rule definition is present at this point. Instead
|
368
|
-
* we wait and check the rule schema during the finalization step
|
369
|
-
* of calculating a config.
|
370
|
-
*/
|
371
|
-
for (const ruleId of Object.keys(value)) {
|
372
|
-
|
373
|
-
// avoid hairy edge case
|
374
|
-
if (ruleId === "__proto__") {
|
375
|
-
continue;
|
376
|
-
}
|
393
|
+
/*
|
394
|
+
* We are not checking the rule schema here because there is no
|
395
|
+
* guarantee that the rule definition is present at this point. Instead
|
396
|
+
* we wait and check the rule schema during the finalization step
|
397
|
+
* of calculating a config.
|
398
|
+
*/
|
399
|
+
for (const ruleId of Object.keys(value)) {
|
377
400
|
|
378
|
-
|
401
|
+
// avoid hairy edge case
|
402
|
+
if (ruleId === "__proto__") {
|
403
|
+
continue;
|
404
|
+
}
|
379
405
|
|
380
|
-
|
406
|
+
const ruleOptions = value[ruleId];
|
381
407
|
|
382
|
-
|
408
|
+
assertIsRuleOptions(ruleId, ruleOptions);
|
383
409
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
}
|
410
|
+
if (Array.isArray(ruleOptions)) {
|
411
|
+
assertIsRuleSeverity(ruleId, ruleOptions[0]);
|
412
|
+
} else {
|
413
|
+
assertIsRuleSeverity(ruleId, ruleOptions);
|
389
414
|
}
|
390
|
-
} catch (error) {
|
391
|
-
error.message = `Key "${lastRuleId}": ${error.message}`;
|
392
|
-
throw error;
|
393
415
|
}
|
394
416
|
}
|
395
417
|
};
|
@@ -320,6 +320,45 @@ async function loadFlatConfigFile(filePath) {
|
|
320
320
|
return config;
|
321
321
|
}
|
322
322
|
|
323
|
+
/**
|
324
|
+
* Determines which config file to use. This is determined by seeing if an
|
325
|
+
* override config file was passed, and if so, using it; otherwise, as long
|
326
|
+
* as override config file is not explicitly set to `false`, it will search
|
327
|
+
* upwards from the cwd for a file named `eslint.config.js`.
|
328
|
+
* @param {import("./eslint").ESLintOptions} options The ESLint instance options.
|
329
|
+
* @returns {{configFilePath:string,basePath:string,error:boolean}} Location information for
|
330
|
+
* the config file.
|
331
|
+
*/
|
332
|
+
async function locateConfigFileToUse({ configFile, cwd }) {
|
333
|
+
|
334
|
+
// determine where to load config file from
|
335
|
+
let configFilePath;
|
336
|
+
let basePath = cwd;
|
337
|
+
let error = false;
|
338
|
+
|
339
|
+
if (typeof configFile === "string") {
|
340
|
+
debug(`Override config file path is ${configFile}`);
|
341
|
+
configFilePath = path.resolve(cwd, configFile);
|
342
|
+
} else if (configFile !== false) {
|
343
|
+
debug("Searching for eslint.config.js");
|
344
|
+
configFilePath = await findFlatConfigFile(cwd);
|
345
|
+
|
346
|
+
if (configFilePath) {
|
347
|
+
basePath = path.resolve(path.dirname(configFilePath));
|
348
|
+
} else {
|
349
|
+
error = true;
|
350
|
+
}
|
351
|
+
|
352
|
+
}
|
353
|
+
|
354
|
+
return {
|
355
|
+
configFilePath,
|
356
|
+
basePath,
|
357
|
+
error
|
358
|
+
};
|
359
|
+
|
360
|
+
}
|
361
|
+
|
323
362
|
/**
|
324
363
|
* Calculates the config array for this run based on inputs.
|
325
364
|
* @param {FlatESLint} eslint The instance to create the config array for.
|
@@ -342,25 +381,13 @@ async function calculateConfigArray(eslint, {
|
|
342
381
|
return slots.configs;
|
343
382
|
}
|
344
383
|
|
345
|
-
|
346
|
-
let configFilePath;
|
347
|
-
let basePath = cwd;
|
384
|
+
const { configFilePath, basePath, error } = await locateConfigFileToUse({ configFile, cwd });
|
348
385
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
} else if (configFile !== false) {
|
353
|
-
debug("Searching for eslint.config.js");
|
354
|
-
configFilePath = await findFlatConfigFile(cwd);
|
355
|
-
|
356
|
-
if (!configFilePath) {
|
357
|
-
throw new Error("Could not find config file.");
|
358
|
-
}
|
359
|
-
|
360
|
-
basePath = path.resolve(path.dirname(configFilePath));
|
386
|
+
// config file is required to calculate config
|
387
|
+
if (error) {
|
388
|
+
throw new Error("Could not find config file.");
|
361
389
|
}
|
362
390
|
|
363
|
-
|
364
391
|
const configs = new FlatConfigArray(baseConfig || [], { basePath, shouldIgnore });
|
365
392
|
|
366
393
|
// load config file
|
@@ -1160,6 +1187,19 @@ class FlatESLint {
|
|
1160
1187
|
return configs.getConfig(absolutePath);
|
1161
1188
|
}
|
1162
1189
|
|
1190
|
+
/**
|
1191
|
+
* Finds the config file being used by this instance based on the options
|
1192
|
+
* passed to the constructor.
|
1193
|
+
* @returns {string|undefined} The path to the config file being used or
|
1194
|
+
* `undefined` if no config file is being used.
|
1195
|
+
*/
|
1196
|
+
async findConfigFile() {
|
1197
|
+
const options = privateMembers.get(this).options;
|
1198
|
+
const { configFilePath } = await locateConfigFileToUse(options);
|
1199
|
+
|
1200
|
+
return configFilePath;
|
1201
|
+
}
|
1202
|
+
|
1163
1203
|
/**
|
1164
1204
|
* Checks if a given path is ignored by ESLint.
|
1165
1205
|
* @param {string} filePath The path of the file to check.
|
package/lib/linter/linter.js
CHANGED
@@ -592,7 +592,7 @@ function findEslintEnv(text) {
|
|
592
592
|
* Convert "/path/to/<text>" to "<text>".
|
593
593
|
* `CLIEngine#executeOnText()` method gives "/path/to/<text>" if the filename
|
594
594
|
* was omitted because `configArray.extractConfig()` requires an absolute path.
|
595
|
-
* But the linter should pass `<text>` to `RuleContext#
|
595
|
+
* But the linter should pass `<text>` to `RuleContext#filename` in that
|
596
596
|
* case.
|
597
597
|
* Also, code blocks can have their virtual filename. If the parent filename was
|
598
598
|
* `<text>`, the virtual filename is `<text>/0_foo.js` or something like (i.e.,
|
@@ -857,38 +857,6 @@ function parse(text, languageOptions, filePath) {
|
|
857
857
|
}
|
858
858
|
}
|
859
859
|
|
860
|
-
/**
|
861
|
-
* Marks a variable as used in the current scope
|
862
|
-
* @param {SourceCode} sourceCode The source code for the currently linted file.
|
863
|
-
* @param {ASTNode} currentNode The node currently being traversed
|
864
|
-
* @param {LanguageOptions} languageOptions The options used to parse this text
|
865
|
-
* @param {string} name The name of the variable that should be marked as used.
|
866
|
-
* @returns {boolean} True if the variable was found and marked as used, false if not.
|
867
|
-
*/
|
868
|
-
function markVariableAsUsed(sourceCode, currentNode, languageOptions, name) {
|
869
|
-
const parserOptions = languageOptions.parserOptions;
|
870
|
-
const sourceType = languageOptions.sourceType;
|
871
|
-
const hasGlobalReturn =
|
872
|
-
(parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn) ||
|
873
|
-
sourceType === "commonjs";
|
874
|
-
const specialScope = hasGlobalReturn || sourceType === "module";
|
875
|
-
const currentScope = sourceCode.getScope(currentNode);
|
876
|
-
|
877
|
-
// Special Node.js scope means we need to start one level deeper
|
878
|
-
const initialScope = currentScope.type === "global" && specialScope ? currentScope.childScopes[0] : currentScope;
|
879
|
-
|
880
|
-
for (let scope = initialScope; scope; scope = scope.upper) {
|
881
|
-
const variable = scope.variables.find(scopeVar => scopeVar.name === name);
|
882
|
-
|
883
|
-
if (variable) {
|
884
|
-
variable.eslintUsed = true;
|
885
|
-
return true;
|
886
|
-
}
|
887
|
-
}
|
888
|
-
|
889
|
-
return false;
|
890
|
-
}
|
891
|
-
|
892
860
|
/**
|
893
861
|
* Runs a rule, and gets its listeners
|
894
862
|
* @param {Rule} rule A normalized rule with a `create` method
|
@@ -934,7 +902,7 @@ const BASE_TRAVERSAL_CONTEXT = Object.freeze(
|
|
934
902
|
(contextInfo, methodName) =>
|
935
903
|
Object.assign(contextInfo, {
|
936
904
|
[methodName](...args) {
|
937
|
-
return this.
|
905
|
+
return this.sourceCode[DEPRECATED_SOURCECODE_PASSTHROUGHS[methodName]](...args);
|
938
906
|
}
|
939
907
|
}),
|
940
908
|
{}
|
@@ -983,11 +951,15 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserName, languageO
|
|
983
951
|
getAncestors: () => sourceCode.getAncestors(currentNode),
|
984
952
|
getDeclaredVariables: node => sourceCode.getDeclaredVariables(node),
|
985
953
|
getCwd: () => cwd,
|
954
|
+
cwd,
|
986
955
|
getFilename: () => filename,
|
956
|
+
filename,
|
987
957
|
getPhysicalFilename: () => physicalFilename || filename,
|
958
|
+
physicalFilename: physicalFilename || filename,
|
988
959
|
getScope: () => sourceCode.getScope(currentNode),
|
989
960
|
getSourceCode: () => sourceCode,
|
990
|
-
|
961
|
+
sourceCode,
|
962
|
+
markVariableAsUsed: name => sourceCode.markVariableAsUsed(name, currentNode),
|
991
963
|
parserOptions: {
|
992
964
|
...languageOptions.parserOptions
|
993
965
|
},
|
@@ -142,7 +142,7 @@ module.exports = {
|
|
142
142
|
docs: {
|
143
143
|
description: "Enforce getter and setter pairs in objects and classes",
|
144
144
|
recommended: false,
|
145
|
-
url: "https://eslint.org/docs/rules/accessor-pairs"
|
145
|
+
url: "https://eslint.org/docs/latest/rules/accessor-pairs"
|
146
146
|
},
|
147
147
|
|
148
148
|
schema: [{
|
@@ -178,7 +178,7 @@ module.exports = {
|
|
178
178
|
const checkGetWithoutSet = config.getWithoutSet === true;
|
179
179
|
const checkSetWithoutGet = config.setWithoutGet !== false;
|
180
180
|
const enforceForClassMembers = config.enforceForClassMembers !== false;
|
181
|
-
const sourceCode = context.
|
181
|
+
const sourceCode = context.sourceCode;
|
182
182
|
|
183
183
|
/**
|
184
184
|
* Reports the given node.
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Enforce linebreaks after opening and before closing array brackets",
|
21
21
|
recommended: false,
|
22
|
-
url: "https://eslint.org/docs/rules/array-bracket-newline"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/array-bracket-newline"
|
23
23
|
},
|
24
24
|
|
25
25
|
fixable: "whitespace",
|
@@ -56,7 +56,7 @@ module.exports = {
|
|
56
56
|
},
|
57
57
|
|
58
58
|
create(context) {
|
59
|
-
const sourceCode = context.
|
59
|
+
const sourceCode = context.sourceCode;
|
60
60
|
|
61
61
|
|
62
62
|
//----------------------------------------------------------------------
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
18
18
|
docs: {
|
19
19
|
description: "Enforce consistent spacing inside array brackets",
|
20
20
|
recommended: false,
|
21
|
-
url: "https://eslint.org/docs/rules/array-bracket-spacing"
|
21
|
+
url: "https://eslint.org/docs/latest/rules/array-bracket-spacing"
|
22
22
|
},
|
23
23
|
|
24
24
|
fixable: "whitespace",
|
@@ -53,7 +53,7 @@ module.exports = {
|
|
53
53
|
},
|
54
54
|
create(context) {
|
55
55
|
const spaced = context.options[0] === "always",
|
56
|
-
sourceCode = context.
|
56
|
+
sourceCode = context.sourceCode;
|
57
57
|
|
58
58
|
/**
|
59
59
|
* Determines whether an option is set, relative to the spacing option.
|
@@ -141,7 +141,7 @@ module.exports = {
|
|
141
141
|
docs: {
|
142
142
|
description: "Enforce `return` statements in callbacks of array methods",
|
143
143
|
recommended: false,
|
144
|
-
url: "https://eslint.org/docs/rules/array-callback-return"
|
144
|
+
url: "https://eslint.org/docs/latest/rules/array-callback-return"
|
145
145
|
},
|
146
146
|
|
147
147
|
schema: [
|
@@ -172,7 +172,7 @@ module.exports = {
|
|
172
172
|
create(context) {
|
173
173
|
|
174
174
|
const options = context.options[0] || { allowImplicit: false, checkForEach: false };
|
175
|
-
const sourceCode = context.
|
175
|
+
const sourceCode = context.sourceCode;
|
176
176
|
|
177
177
|
let funcInfo = {
|
178
178
|
arrayMethodName: null,
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Enforce line breaks after each array element",
|
21
21
|
recommended: false,
|
22
|
-
url: "https://eslint.org/docs/rules/array-element-newline"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/array-element-newline"
|
23
23
|
},
|
24
24
|
|
25
25
|
fixable: "whitespace",
|
@@ -79,7 +79,7 @@ module.exports = {
|
|
79
79
|
},
|
80
80
|
|
81
81
|
create(context) {
|
82
|
-
const sourceCode = context.
|
82
|
+
const sourceCode = context.sourceCode;
|
83
83
|
|
84
84
|
//----------------------------------------------------------------------
|
85
85
|
// Helpers
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
22
22
|
docs: {
|
23
23
|
description: "Require braces around arrow function bodies",
|
24
24
|
recommended: false,
|
25
|
-
url: "https://eslint.org/docs/rules/arrow-body-style"
|
25
|
+
url: "https://eslint.org/docs/latest/rules/arrow-body-style"
|
26
26
|
},
|
27
27
|
|
28
28
|
schema: {
|
@@ -74,7 +74,7 @@ module.exports = {
|
|
74
74
|
const asNeeded = !options[0] || options[0] === "as-needed";
|
75
75
|
const never = options[0] === "never";
|
76
76
|
const requireReturnForObjectLiteral = options[1] && options[1].requireReturnForObjectLiteral;
|
77
|
-
const sourceCode = context.
|
77
|
+
const sourceCode = context.sourceCode;
|
78
78
|
let funcInfo = null;
|
79
79
|
|
80
80
|
/**
|
@@ -35,7 +35,7 @@ module.exports = {
|
|
35
35
|
docs: {
|
36
36
|
description: "Require parentheses around arrow function arguments",
|
37
37
|
recommended: false,
|
38
|
-
url: "https://eslint.org/docs/rules/arrow-parens"
|
38
|
+
url: "https://eslint.org/docs/latest/rules/arrow-parens"
|
39
39
|
},
|
40
40
|
|
41
41
|
fixable: "code",
|
@@ -69,7 +69,7 @@ module.exports = {
|
|
69
69
|
const asNeeded = context.options[0] === "as-needed";
|
70
70
|
const requireForBlockBody = asNeeded && context.options[1] && context.options[1].requireForBlockBody === true;
|
71
71
|
|
72
|
-
const sourceCode = context.
|
72
|
+
const sourceCode = context.sourceCode;
|
73
73
|
|
74
74
|
/**
|
75
75
|
* Finds opening paren of parameters for the given arrow function, if it exists.
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
22
22
|
docs: {
|
23
23
|
description: "Enforce consistent spacing before and after the arrow in arrow functions",
|
24
24
|
recommended: false,
|
25
|
-
url: "https://eslint.org/docs/rules/arrow-spacing"
|
25
|
+
url: "https://eslint.org/docs/latest/rules/arrow-spacing"
|
26
26
|
},
|
27
27
|
|
28
28
|
fixable: "whitespace",
|
@@ -61,7 +61,7 @@ module.exports = {
|
|
61
61
|
rule.before = rule.before !== false;
|
62
62
|
rule.after = rule.after !== false;
|
63
63
|
|
64
|
-
const sourceCode = context.
|
64
|
+
const sourceCode = context.sourceCode;
|
65
65
|
|
66
66
|
/**
|
67
67
|
* Get tokens of arrow(`=>`) and before/after arrow.
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
docs: {
|
17
17
|
description: "Enforce the use of variables within the scope they are defined",
|
18
18
|
recommended: false,
|
19
|
-
url: "https://eslint.org/docs/rules/block-scoped-var"
|
19
|
+
url: "https://eslint.org/docs/latest/rules/block-scoped-var"
|
20
20
|
},
|
21
21
|
|
22
22
|
schema: [],
|
@@ -28,7 +28,7 @@ module.exports = {
|
|
28
28
|
|
29
29
|
create(context) {
|
30
30
|
let stack = [];
|
31
|
-
const sourceCode = context.
|
31
|
+
const sourceCode = context.sourceCode;
|
32
32
|
|
33
33
|
/**
|
34
34
|
* Makes a block scope.
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Disallow or enforce spaces inside of blocks after opening block and before closing block",
|
21
21
|
recommended: false,
|
22
|
-
url: "https://eslint.org/docs/rules/block-spacing"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/block-spacing"
|
23
23
|
},
|
24
24
|
|
25
25
|
fixable: "whitespace",
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
37
37
|
create(context) {
|
38
38
|
const always = (context.options[0] !== "never"),
|
39
39
|
messageId = always ? "missing" : "extra",
|
40
|
-
sourceCode = context.
|
40
|
+
sourceCode = context.sourceCode;
|
41
41
|
|
42
42
|
/**
|
43
43
|
* Gets the open brace token from a given node.
|
package/lib/rules/brace-style.js
CHANGED
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
docs: {
|
20
20
|
description: "Enforce consistent brace style for blocks",
|
21
21
|
recommended: false,
|
22
|
-
url: "https://eslint.org/docs/rules/brace-style"
|
22
|
+
url: "https://eslint.org/docs/latest/rules/brace-style"
|
23
23
|
},
|
24
24
|
|
25
25
|
schema: [
|
@@ -53,7 +53,7 @@ module.exports = {
|
|
53
53
|
create(context) {
|
54
54
|
const style = context.options[0] || "1tbs",
|
55
55
|
params = context.options[1] || {},
|
56
|
-
sourceCode = context.
|
56
|
+
sourceCode = context.sourceCode;
|
57
57
|
|
58
58
|
//--------------------------------------------------------------------------
|
59
59
|
// Helpers
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
docs: {
|
22
22
|
description: "Require `return` statements after callbacks",
|
23
23
|
recommended: false,
|
24
|
-
url: "https://eslint.org/docs/rules/callback-return"
|
24
|
+
url: "https://eslint.org/docs/latest/rules/callback-return"
|
25
25
|
},
|
26
26
|
|
27
27
|
schema: [{
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
37
37
|
create(context) {
|
38
38
|
|
39
39
|
const callbacks = context.options[0] || ["callback", "cb", "next"],
|
40
|
-
sourceCode = context.
|
40
|
+
sourceCode = context.sourceCode;
|
41
41
|
|
42
42
|
//--------------------------------------------------------------------------
|
43
43
|
// Helpers
|
package/lib/rules/camelcase.js
CHANGED
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Enforce camelcase naming convention",
|
25
25
|
recommended: false,
|
26
|
-
url: "https://eslint.org/docs/rules/camelcase"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/camelcase"
|
27
27
|
},
|
28
28
|
|
29
29
|
schema: [
|
@@ -73,7 +73,7 @@ module.exports = {
|
|
73
73
|
const ignoreImports = options.ignoreImports;
|
74
74
|
const ignoreGlobals = options.ignoreGlobals;
|
75
75
|
const allow = options.allow || [];
|
76
|
-
const sourceCode = context.
|
76
|
+
const sourceCode = context.sourceCode;
|
77
77
|
|
78
78
|
//--------------------------------------------------------------------------
|
79
79
|
// Helpers
|
@@ -107,7 +107,7 @@ module.exports = {
|
|
107
107
|
docs: {
|
108
108
|
description: "Enforce or disallow capitalization of the first letter of a comment",
|
109
109
|
recommended: false,
|
110
|
-
url: "https://eslint.org/docs/rules/capitalized-comments"
|
110
|
+
url: "https://eslint.org/docs/latest/rules/capitalized-comments"
|
111
111
|
},
|
112
112
|
|
113
113
|
fixable: "code",
|
@@ -139,7 +139,7 @@ module.exports = {
|
|
139
139
|
|
140
140
|
const capitalize = context.options[0] || "always",
|
141
141
|
normalizedOptions = getAllNormalizedOptions(context.options[1]),
|
142
|
-
sourceCode = context.
|
142
|
+
sourceCode = context.sourceCode;
|
143
143
|
|
144
144
|
createRegExpForIgnorePatterns(normalizedOptions);
|
145
145
|
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
23
23
|
docs: {
|
24
24
|
description: "Enforce that class methods utilize `this`",
|
25
25
|
recommended: false,
|
26
|
-
url: "https://eslint.org/docs/rules/class-methods-use-this"
|
26
|
+
url: "https://eslint.org/docs/latest/rules/class-methods-use-this"
|
27
27
|
},
|
28
28
|
|
29
29
|
schema: [{
|
@@ -133,7 +133,7 @@ module.exports = {
|
|
133
133
|
if (isIncludedInstanceMethod(node.parent) && !methodUsesThis) {
|
134
134
|
context.report({
|
135
135
|
node,
|
136
|
-
loc: astUtils.getFunctionHeadLoc(node, context.
|
136
|
+
loc: astUtils.getFunctionHeadLoc(node, context.sourceCode),
|
137
137
|
messageId: "missingThis",
|
138
138
|
data: {
|
139
139
|
name: astUtils.getFunctionNameWithKind(node)
|
@@ -78,7 +78,7 @@ module.exports = {
|
|
78
78
|
docs: {
|
79
79
|
description: "Require or disallow trailing commas",
|
80
80
|
recommended: false,
|
81
|
-
url: "https://eslint.org/docs/rules/comma-dangle"
|
81
|
+
url: "https://eslint.org/docs/latest/rules/comma-dangle"
|
82
82
|
},
|
83
83
|
|
84
84
|
fixable: "code",
|
@@ -136,7 +136,7 @@ module.exports = {
|
|
136
136
|
create(context) {
|
137
137
|
const options = normalizeOptions(context.options[0], context.languageOptions.ecmaVersion);
|
138
138
|
|
139
|
-
const sourceCode = context.
|
139
|
+
const sourceCode = context.sourceCode;
|
140
140
|
|
141
141
|
/**
|
142
142
|
* Gets the last item of the given node.
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
18
18
|
docs: {
|
19
19
|
description: "Enforce consistent spacing before and after commas",
|
20
20
|
recommended: false,
|
21
|
-
url: "https://eslint.org/docs/rules/comma-spacing"
|
21
|
+
url: "https://eslint.org/docs/latest/rules/comma-spacing"
|
22
22
|
},
|
23
23
|
|
24
24
|
fixable: "whitespace",
|
@@ -48,7 +48,7 @@ module.exports = {
|
|
48
48
|
|
49
49
|
create(context) {
|
50
50
|
|
51
|
-
const sourceCode = context.
|
51
|
+
const sourceCode = context.sourceCode;
|
52
52
|
const tokensAndComments = sourceCode.tokensAndComments;
|
53
53
|
|
54
54
|
const options = {
|