eslint 8.18.0 → 8.21.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 -9
- package/lib/config/default-config.js +16 -7
- package/lib/config/flat-config-array.js +41 -2
- package/lib/config/flat-config-helpers.js +9 -1
- package/lib/eslint/eslint-helpers.js +621 -0
- package/lib/eslint/flat-eslint.js +1164 -0
- package/lib/eslint/index.js +3 -1
- package/lib/linter/linter.js +72 -4
- package/lib/rule-tester/flat-rule-tester.js +41 -38
- package/lib/rule-tester/rule-tester.js +42 -0
- package/lib/rules/accessor-pairs.js +1 -1
- package/lib/rules/array-bracket-newline.js +1 -1
- package/lib/rules/array-bracket-spacing.js +1 -1
- package/lib/rules/array-callback-return.js +1 -1
- package/lib/rules/array-element-newline.js +1 -1
- package/lib/rules/arrow-body-style.js +1 -1
- package/lib/rules/arrow-parens.js +1 -1
- package/lib/rules/arrow-spacing.js +1 -1
- package/lib/rules/block-scoped-var.js +1 -1
- package/lib/rules/block-spacing.js +1 -1
- package/lib/rules/brace-style.js +1 -1
- package/lib/rules/callback-return.js +1 -1
- package/lib/rules/camelcase.js +1 -1
- package/lib/rules/capitalized-comments.js +1 -1
- package/lib/rules/class-methods-use-this.js +1 -1
- package/lib/rules/comma-dangle.js +1 -1
- package/lib/rules/comma-spacing.js +36 -42
- package/lib/rules/comma-style.js +1 -1
- package/lib/rules/complexity.js +1 -1
- package/lib/rules/computed-property-spacing.js +1 -1
- package/lib/rules/consistent-return.js +1 -1
- package/lib/rules/consistent-this.js +1 -1
- package/lib/rules/constructor-super.js +1 -1
- package/lib/rules/curly.js +1 -1
- package/lib/rules/default-case-last.js +1 -1
- package/lib/rules/default-case.js +1 -1
- package/lib/rules/default-param-last.js +1 -1
- package/lib/rules/dot-location.js +1 -1
- package/lib/rules/dot-notation.js +1 -1
- package/lib/rules/eol-last.js +1 -1
- package/lib/rules/eqeqeq.js +1 -1
- package/lib/rules/for-direction.js +1 -1
- package/lib/rules/func-call-spacing.js +1 -1
- package/lib/rules/func-name-matching.js +1 -1
- package/lib/rules/func-names.js +1 -1
- package/lib/rules/func-style.js +1 -1
- package/lib/rules/function-call-argument-newline.js +1 -1
- package/lib/rules/function-paren-newline.js +1 -1
- package/lib/rules/generator-star-spacing.js +1 -1
- package/lib/rules/getter-return.js +1 -1
- package/lib/rules/global-require.js +1 -1
- package/lib/rules/grouped-accessor-pairs.js +1 -1
- package/lib/rules/guard-for-in.js +1 -1
- package/lib/rules/handle-callback-err.js +1 -1
- package/lib/rules/id-blacklist.js +1 -1
- package/lib/rules/id-denylist.js +1 -1
- package/lib/rules/id-length.js +1 -1
- package/lib/rules/id-match.js +1 -1
- package/lib/rules/implicit-arrow-linebreak.js +1 -1
- package/lib/rules/indent-legacy.js +1 -1
- package/lib/rules/indent.js +3 -3
- package/lib/rules/init-declarations.js +1 -1
- package/lib/rules/jsx-quotes.js +1 -1
- package/lib/rules/key-spacing.js +5 -2
- package/lib/rules/keyword-spacing.js +1 -1
- package/lib/rules/line-comment-position.js +1 -1
- package/lib/rules/linebreak-style.js +1 -1
- package/lib/rules/lines-around-comment.js +12 -5
- package/lib/rules/lines-around-directive.js +1 -1
- package/lib/rules/lines-between-class-members.js +1 -1
- package/lib/rules/max-classes-per-file.js +1 -1
- package/lib/rules/max-depth.js +1 -1
- package/lib/rules/max-len.js +1 -1
- package/lib/rules/max-lines-per-function.js +1 -1
- package/lib/rules/max-lines.js +1 -1
- package/lib/rules/max-nested-callbacks.js +1 -1
- package/lib/rules/max-params.js +1 -1
- package/lib/rules/max-statements-per-line.js +1 -1
- package/lib/rules/max-statements.js +1 -1
- package/lib/rules/multiline-comment-style.js +1 -1
- package/lib/rules/multiline-ternary.js +1 -1
- package/lib/rules/new-cap.js +1 -1
- package/lib/rules/new-parens.js +1 -1
- package/lib/rules/newline-after-var.js +1 -1
- package/lib/rules/newline-before-return.js +1 -1
- package/lib/rules/newline-per-chained-call.js +1 -1
- package/lib/rules/no-alert.js +1 -1
- package/lib/rules/no-array-constructor.js +1 -1
- package/lib/rules/no-async-promise-executor.js +1 -1
- package/lib/rules/no-await-in-loop.js +1 -1
- package/lib/rules/no-bitwise.js +1 -1
- package/lib/rules/no-buffer-constructor.js +1 -1
- package/lib/rules/no-caller.js +1 -1
- package/lib/rules/no-case-declarations.js +1 -1
- package/lib/rules/no-catch-shadow.js +1 -1
- package/lib/rules/no-class-assign.js +1 -1
- package/lib/rules/no-compare-neg-zero.js +1 -1
- package/lib/rules/no-cond-assign.js +1 -1
- package/lib/rules/no-confusing-arrow.js +1 -1
- package/lib/rules/no-console.js +1 -1
- package/lib/rules/no-const-assign.js +1 -1
- package/lib/rules/no-constant-binary-expression.js +1 -1
- package/lib/rules/no-constant-condition.js +1 -1
- package/lib/rules/no-constructor-return.js +1 -1
- package/lib/rules/no-continue.js +1 -1
- package/lib/rules/no-control-regex.js +1 -1
- package/lib/rules/no-debugger.js +1 -1
- package/lib/rules/no-delete-var.js +1 -1
- package/lib/rules/no-div-regex.js +1 -1
- package/lib/rules/no-dupe-args.js +1 -1
- package/lib/rules/no-dupe-class-members.js +1 -1
- package/lib/rules/no-dupe-else-if.js +1 -1
- package/lib/rules/no-dupe-keys.js +1 -1
- package/lib/rules/no-duplicate-case.js +1 -1
- package/lib/rules/no-duplicate-imports.js +1 -1
- package/lib/rules/no-else-return.js +1 -1
- package/lib/rules/no-empty-character-class.js +1 -1
- package/lib/rules/no-empty-function.js +1 -1
- package/lib/rules/no-empty-pattern.js +1 -1
- package/lib/rules/no-empty.js +1 -1
- package/lib/rules/no-eq-null.js +1 -1
- package/lib/rules/no-eval.js +1 -1
- package/lib/rules/no-ex-assign.js +1 -1
- package/lib/rules/no-extend-native.js +1 -1
- package/lib/rules/no-extra-bind.js +1 -1
- package/lib/rules/no-extra-boolean-cast.js +1 -1
- package/lib/rules/no-extra-label.js +1 -1
- package/lib/rules/no-extra-parens.js +1 -1
- package/lib/rules/no-extra-semi.js +1 -1
- package/lib/rules/no-fallthrough.js +1 -1
- package/lib/rules/no-floating-decimal.js +1 -1
- package/lib/rules/no-func-assign.js +1 -1
- package/lib/rules/no-global-assign.js +1 -1
- package/lib/rules/no-implicit-coercion.js +1 -1
- package/lib/rules/no-implicit-globals.js +1 -1
- package/lib/rules/no-implied-eval.js +1 -1
- package/lib/rules/no-import-assign.js +1 -1
- package/lib/rules/no-inline-comments.js +1 -1
- package/lib/rules/no-inner-declarations.js +1 -1
- package/lib/rules/no-invalid-regexp.js +1 -1
- package/lib/rules/no-invalid-this.js +1 -1
- package/lib/rules/no-irregular-whitespace.js +1 -1
- package/lib/rules/no-iterator.js +1 -1
- package/lib/rules/no-label-var.js +1 -1
- package/lib/rules/no-labels.js +1 -1
- package/lib/rules/no-lone-blocks.js +1 -1
- package/lib/rules/no-lonely-if.js +1 -1
- package/lib/rules/no-loop-func.js +1 -1
- package/lib/rules/no-loss-of-precision.js +1 -1
- package/lib/rules/no-magic-numbers.js +1 -1
- package/lib/rules/no-misleading-character-class.js +1 -1
- package/lib/rules/no-mixed-operators.js +1 -1
- package/lib/rules/no-mixed-requires.js +1 -1
- package/lib/rules/no-mixed-spaces-and-tabs.js +1 -1
- package/lib/rules/no-multi-assign.js +1 -1
- package/lib/rules/no-multi-spaces.js +1 -1
- package/lib/rules/no-multi-str.js +1 -1
- package/lib/rules/no-multiple-empty-lines.js +1 -1
- package/lib/rules/no-native-reassign.js +1 -1
- package/lib/rules/no-negated-condition.js +1 -1
- package/lib/rules/no-negated-in-lhs.js +1 -1
- package/lib/rules/no-nested-ternary.js +1 -1
- package/lib/rules/no-new-func.js +1 -1
- package/lib/rules/no-new-object.js +1 -1
- package/lib/rules/no-new-require.js +1 -1
- package/lib/rules/no-new-symbol.js +1 -1
- package/lib/rules/no-new-wrappers.js +1 -1
- package/lib/rules/no-new.js +1 -1
- package/lib/rules/no-nonoctal-decimal-escape.js +1 -1
- package/lib/rules/no-obj-calls.js +1 -1
- package/lib/rules/no-octal-escape.js +1 -1
- package/lib/rules/no-octal.js +1 -1
- package/lib/rules/no-param-reassign.js +1 -1
- package/lib/rules/no-path-concat.js +1 -1
- package/lib/rules/no-plusplus.js +1 -1
- package/lib/rules/no-process-env.js +1 -1
- package/lib/rules/no-process-exit.js +1 -1
- package/lib/rules/no-promise-executor-return.js +1 -1
- package/lib/rules/no-proto.js +1 -1
- package/lib/rules/no-prototype-builtins.js +1 -1
- package/lib/rules/no-redeclare.js +1 -1
- package/lib/rules/no-regex-spaces.js +1 -1
- package/lib/rules/no-restricted-exports.js +1 -1
- package/lib/rules/no-restricted-globals.js +1 -1
- package/lib/rules/no-restricted-imports.js +77 -12
- package/lib/rules/no-restricted-modules.js +1 -1
- package/lib/rules/no-restricted-properties.js +1 -1
- package/lib/rules/no-restricted-syntax.js +1 -1
- package/lib/rules/no-return-assign.js +1 -1
- package/lib/rules/no-return-await.js +1 -1
- package/lib/rules/no-script-url.js +1 -1
- package/lib/rules/no-self-assign.js +1 -1
- package/lib/rules/no-self-compare.js +1 -1
- package/lib/rules/no-sequences.js +1 -1
- package/lib/rules/no-setter-return.js +1 -1
- package/lib/rules/no-shadow-restricted-names.js +1 -1
- package/lib/rules/no-shadow.js +1 -1
- package/lib/rules/no-spaced-func.js +1 -1
- package/lib/rules/no-sparse-arrays.js +1 -1
- package/lib/rules/no-sync.js +1 -1
- package/lib/rules/no-tabs.js +1 -1
- package/lib/rules/no-template-curly-in-string.js +1 -1
- package/lib/rules/no-ternary.js +1 -1
- package/lib/rules/no-this-before-super.js +1 -1
- package/lib/rules/no-throw-literal.js +1 -1
- package/lib/rules/no-trailing-spaces.js +1 -1
- package/lib/rules/no-undef-init.js +1 -1
- package/lib/rules/no-undef.js +1 -1
- package/lib/rules/no-undefined.js +1 -1
- package/lib/rules/no-underscore-dangle.js +1 -1
- package/lib/rules/no-unexpected-multiline.js +1 -1
- package/lib/rules/no-unmodified-loop-condition.js +1 -1
- package/lib/rules/no-unneeded-ternary.js +1 -1
- package/lib/rules/no-unreachable-loop.js +1 -1
- package/lib/rules/no-unreachable.js +1 -1
- package/lib/rules/no-unsafe-finally.js +1 -1
- package/lib/rules/no-unsafe-negation.js +1 -1
- package/lib/rules/no-unsafe-optional-chaining.js +1 -1
- package/lib/rules/no-unused-expressions.js +1 -1
- package/lib/rules/no-unused-labels.js +1 -1
- package/lib/rules/no-unused-private-class-members.js +1 -1
- package/lib/rules/no-unused-vars.js +1 -1
- package/lib/rules/no-use-before-define.js +1 -1
- package/lib/rules/no-useless-backreference.js +1 -1
- package/lib/rules/no-useless-call.js +1 -1
- package/lib/rules/no-useless-catch.js +1 -1
- package/lib/rules/no-useless-computed-key.js +1 -1
- package/lib/rules/no-useless-concat.js +1 -1
- package/lib/rules/no-useless-constructor.js +1 -1
- package/lib/rules/no-useless-escape.js +1 -1
- package/lib/rules/no-useless-rename.js +1 -1
- package/lib/rules/no-useless-return.js +1 -1
- package/lib/rules/no-var.js +1 -1
- package/lib/rules/no-void.js +1 -1
- package/lib/rules/no-warning-comments.js +27 -41
- package/lib/rules/no-whitespace-before-property.js +1 -1
- package/lib/rules/no-with.js +1 -1
- package/lib/rules/nonblock-statement-body-position.js +1 -1
- package/lib/rules/object-curly-newline.js +1 -1
- package/lib/rules/object-curly-spacing.js +1 -1
- package/lib/rules/object-property-newline.js +1 -1
- package/lib/rules/object-shorthand.js +1 -1
- package/lib/rules/one-var-declaration-per-line.js +1 -1
- package/lib/rules/one-var.js +1 -1
- package/lib/rules/operator-assignment.js +1 -1
- package/lib/rules/operator-linebreak.js +1 -1
- package/lib/rules/padded-blocks.js +1 -1
- package/lib/rules/padding-line-between-statements.js +1 -1
- package/lib/rules/prefer-arrow-callback.js +1 -1
- package/lib/rules/prefer-const.js +1 -1
- package/lib/rules/prefer-destructuring.js +1 -1
- package/lib/rules/prefer-exponentiation-operator.js +1 -1
- package/lib/rules/prefer-named-capture-group.js +1 -1
- package/lib/rules/prefer-numeric-literals.js +1 -1
- package/lib/rules/prefer-object-has-own.js +1 -1
- package/lib/rules/prefer-object-spread.js +1 -1
- package/lib/rules/prefer-promise-reject-errors.js +1 -1
- package/lib/rules/prefer-reflect.js +1 -1
- package/lib/rules/prefer-regex-literals.js +1 -1
- package/lib/rules/prefer-rest-params.js +1 -1
- package/lib/rules/prefer-spread.js +1 -1
- package/lib/rules/prefer-template.js +1 -1
- package/lib/rules/quote-props.js +1 -1
- package/lib/rules/quotes.js +1 -1
- package/lib/rules/radix.js +1 -1
- package/lib/rules/require-atomic-updates.js +1 -1
- package/lib/rules/require-await.js +1 -1
- package/lib/rules/require-jsdoc.js +1 -1
- package/lib/rules/require-unicode-regexp.js +1 -1
- package/lib/rules/require-yield.js +1 -1
- package/lib/rules/rest-spread-spacing.js +1 -1
- package/lib/rules/semi-spacing.js +1 -1
- package/lib/rules/semi-style.js +1 -1
- package/lib/rules/semi.js +1 -1
- package/lib/rules/sort-imports.js +1 -1
- package/lib/rules/sort-keys.js +44 -1
- package/lib/rules/sort-vars.js +1 -1
- package/lib/rules/space-before-blocks.js +1 -1
- package/lib/rules/space-before-function-paren.js +1 -1
- package/lib/rules/space-in-parens.js +1 -1
- package/lib/rules/space-infix-ops.js +1 -1
- package/lib/rules/space-unary-ops.js +1 -1
- package/lib/rules/spaced-comment.js +1 -1
- package/lib/rules/strict.js +1 -1
- package/lib/rules/switch-colon-spacing.js +1 -1
- package/lib/rules/symbol-description.js +1 -1
- package/lib/rules/template-curly-spacing.js +1 -1
- package/lib/rules/template-tag-spacing.js +1 -1
- package/lib/rules/unicode-bom.js +1 -1
- package/lib/rules/use-isnan.js +1 -1
- package/lib/rules/valid-jsdoc.js +1 -1
- package/lib/rules/valid-typeof.js +1 -1
- package/lib/rules/vars-on-top.js +1 -1
- package/lib/rules/wrap-iife.js +1 -1
- package/lib/rules/wrap-regex.js +1 -1
- package/lib/rules/yield-star-spacing.js +1 -1
- package/lib/rules/yoda.js +1 -1
- package/lib/unsupported-api.js +4 -0
- package/package.json +13 -10
@@ -45,7 +45,7 @@ module.exports = {
|
|
45
45
|
type: "suggestion",
|
46
46
|
|
47
47
|
docs: {
|
48
|
-
description: "
|
48
|
+
description: "Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals",
|
49
49
|
recommended: false,
|
50
50
|
url: "https://eslint.org/docs/rules/prefer-numeric-literals"
|
51
51
|
},
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
50
50
|
type: "suggestion",
|
51
51
|
docs: {
|
52
52
|
description:
|
53
|
-
"
|
53
|
+
"Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`",
|
54
54
|
recommended: false,
|
55
55
|
url: "https://eslint.org/docs/rules/prefer-object-has-own"
|
56
56
|
},
|
@@ -247,7 +247,7 @@ module.exports = {
|
|
247
247
|
|
248
248
|
docs: {
|
249
249
|
description:
|
250
|
-
"
|
250
|
+
"Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.",
|
251
251
|
recommended: false,
|
252
252
|
url: "https://eslint.org/docs/rules/prefer-object-spread"
|
253
253
|
},
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "suggestion",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Require using Error objects as Promise rejection reasons",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/prefer-promise-reject-errors"
|
22
22
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require `Reflect` methods where applicable",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/prefer-reflect"
|
21
21
|
},
|
@@ -123,7 +123,7 @@ module.exports = {
|
|
123
123
|
type: "suggestion",
|
124
124
|
|
125
125
|
docs: {
|
126
|
-
description: "
|
126
|
+
description: "Disallow use of the `RegExp` constructor in favor of regular expression literals",
|
127
127
|
recommended: false,
|
128
128
|
url: "https://eslint.org/docs/rules/prefer-regex-literals"
|
129
129
|
},
|
@@ -65,7 +65,7 @@ module.exports = {
|
|
65
65
|
type: "suggestion",
|
66
66
|
|
67
67
|
docs: {
|
68
|
-
description: "
|
68
|
+
description: "Require rest parameters instead of `arguments`",
|
69
69
|
recommended: false,
|
70
70
|
url: "https://eslint.org/docs/rules/prefer-rest-params"
|
71
71
|
},
|
@@ -49,7 +49,7 @@ module.exports = {
|
|
49
49
|
type: "suggestion",
|
50
50
|
|
51
51
|
docs: {
|
52
|
-
description: "
|
52
|
+
description: "Require spread operators instead of `.apply()`",
|
53
53
|
recommended: false,
|
54
54
|
url: "https://eslint.org/docs/rules/prefer-spread"
|
55
55
|
},
|
@@ -128,7 +128,7 @@ module.exports = {
|
|
128
128
|
type: "suggestion",
|
129
129
|
|
130
130
|
docs: {
|
131
|
-
description: "
|
131
|
+
description: "Require template literals instead of string concatenation",
|
132
132
|
recommended: false,
|
133
133
|
url: "https://eslint.org/docs/rules/prefer-template"
|
134
134
|
},
|
package/lib/rules/quote-props.js
CHANGED
@@ -22,7 +22,7 @@ module.exports = {
|
|
22
22
|
type: "suggestion",
|
23
23
|
|
24
24
|
docs: {
|
25
|
-
description: "
|
25
|
+
description: "Require quotes around object literal property names",
|
26
26
|
recommended: false,
|
27
27
|
url: "https://eslint.org/docs/rules/quote-props"
|
28
28
|
},
|
package/lib/rules/quotes.js
CHANGED
@@ -80,7 +80,7 @@ module.exports = {
|
|
80
80
|
type: "layout",
|
81
81
|
|
82
82
|
docs: {
|
83
|
-
description: "
|
83
|
+
description: "Enforce the consistent use of either backticks, double, or single quotes",
|
84
84
|
recommended: false,
|
85
85
|
url: "https://eslint.org/docs/rules/quotes"
|
86
86
|
},
|
package/lib/rules/radix.js
CHANGED
@@ -80,7 +80,7 @@ module.exports = {
|
|
80
80
|
type: "suggestion",
|
81
81
|
|
82
82
|
docs: {
|
83
|
-
description: "
|
83
|
+
description: "Enforce the consistent use of the radix argument when using `parseInt()`",
|
84
84
|
recommended: false,
|
85
85
|
url: "https://eslint.org/docs/rules/radix"
|
86
86
|
},
|
@@ -171,7 +171,7 @@ module.exports = {
|
|
171
171
|
type: "problem",
|
172
172
|
|
173
173
|
docs: {
|
174
|
-
description: "
|
174
|
+
description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
175
175
|
recommended: false,
|
176
176
|
url: "https://eslint.org/docs/rules/require-atomic-updates"
|
177
177
|
},
|
@@ -34,7 +34,7 @@ module.exports = {
|
|
34
34
|
type: "suggestion",
|
35
35
|
|
36
36
|
docs: {
|
37
|
-
description: "
|
37
|
+
description: "Disallow async functions which have no `await` expression",
|
38
38
|
recommended: false,
|
39
39
|
url: "https://eslint.org/docs/rules/require-await"
|
40
40
|
},
|
@@ -26,7 +26,7 @@ module.exports = {
|
|
26
26
|
type: "suggestion",
|
27
27
|
|
28
28
|
docs: {
|
29
|
-
description: "
|
29
|
+
description: "Enforce the use of `u` flag on RegExp",
|
30
30
|
recommended: false,
|
31
31
|
url: "https://eslint.org/docs/rules/require-unicode-regexp"
|
32
32
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require generator functions to contain `yield`",
|
19
19
|
recommended: true,
|
20
20
|
url: "https://eslint.org/docs/rules/require-yield"
|
21
21
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "layout",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Enforce spacing between rest and spread operators and their expressions",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/rest-spread-spacing"
|
21
21
|
},
|
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
type: "layout",
|
18
18
|
|
19
19
|
docs: {
|
20
|
-
description: "
|
20
|
+
description: "Enforce consistent spacing before and after semicolons",
|
21
21
|
recommended: false,
|
22
22
|
url: "https://eslint.org/docs/rules/semi-spacing"
|
23
23
|
},
|
package/lib/rules/semi-style.js
CHANGED
package/lib/rules/semi.js
CHANGED
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Enforce sorted import declarations within modules",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/sort-imports"
|
21
21
|
},
|
package/lib/rules/sort-keys.js
CHANGED
@@ -81,7 +81,7 @@ module.exports = {
|
|
81
81
|
type: "suggestion",
|
82
82
|
|
83
83
|
docs: {
|
84
|
-
description: "
|
84
|
+
description: "Require object keys to be sorted",
|
85
85
|
recommended: false,
|
86
86
|
url: "https://eslint.org/docs/rules/sort-keys"
|
87
87
|
},
|
@@ -105,6 +105,10 @@ module.exports = {
|
|
105
105
|
type: "integer",
|
106
106
|
minimum: 2,
|
107
107
|
default: 2
|
108
|
+
},
|
109
|
+
allowLineSeparatedGroups: {
|
110
|
+
type: "boolean",
|
111
|
+
default: false
|
108
112
|
}
|
109
113
|
},
|
110
114
|
additionalProperties: false
|
@@ -124,17 +128,21 @@ module.exports = {
|
|
124
128
|
const insensitive = options && options.caseSensitive === false;
|
125
129
|
const natural = options && options.natural;
|
126
130
|
const minKeys = options && options.minKeys;
|
131
|
+
const allowLineSeparatedGroups = options && options.allowLineSeparatedGroups || false;
|
127
132
|
const isValidOrder = isValidOrders[
|
128
133
|
order + (insensitive ? "I" : "") + (natural ? "N" : "")
|
129
134
|
];
|
130
135
|
|
131
136
|
// The stack to save the previous property's name for each object literals.
|
132
137
|
let stack = null;
|
138
|
+
const sourceCode = context.getSourceCode();
|
133
139
|
|
134
140
|
return {
|
135
141
|
ObjectExpression(node) {
|
136
142
|
stack = {
|
137
143
|
upper: stack,
|
144
|
+
prevNode: null,
|
145
|
+
prevBlankLine: false,
|
138
146
|
prevName: null,
|
139
147
|
numKeys: node.properties.length
|
140
148
|
};
|
@@ -159,10 +167,45 @@ module.exports = {
|
|
159
167
|
const numKeys = stack.numKeys;
|
160
168
|
const thisName = getPropertyName(node);
|
161
169
|
|
170
|
+
// Get tokens between current node and previous node
|
171
|
+
const tokens = stack.prevNode && sourceCode
|
172
|
+
.getTokensBetween(stack.prevNode, node, { includeComments: true });
|
173
|
+
|
174
|
+
let isBlankLineBetweenNodes = stack.prevBlankLine;
|
175
|
+
|
176
|
+
if (tokens) {
|
177
|
+
|
178
|
+
// check blank line between tokens
|
179
|
+
tokens.forEach((token, index) => {
|
180
|
+
const previousToken = tokens[index - 1];
|
181
|
+
|
182
|
+
if (previousToken && (token.loc.start.line - previousToken.loc.end.line > 1)) {
|
183
|
+
isBlankLineBetweenNodes = true;
|
184
|
+
}
|
185
|
+
});
|
186
|
+
|
187
|
+
// check blank line between the current node and the last token
|
188
|
+
if (!isBlankLineBetweenNodes && (node.loc.start.line - tokens[tokens.length - 1].loc.end.line > 1)) {
|
189
|
+
isBlankLineBetweenNodes = true;
|
190
|
+
}
|
191
|
+
|
192
|
+
// check blank line between the first token and the previous node
|
193
|
+
if (!isBlankLineBetweenNodes && (tokens[0].loc.start.line - stack.prevNode.loc.end.line > 1)) {
|
194
|
+
isBlankLineBetweenNodes = true;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
stack.prevNode = node;
|
199
|
+
|
162
200
|
if (thisName !== null) {
|
163
201
|
stack.prevName = thisName;
|
164
202
|
}
|
165
203
|
|
204
|
+
if (allowLineSeparatedGroups && isBlankLineBetweenNodes) {
|
205
|
+
stack.prevBlankLine = thisName === null;
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
|
166
209
|
if (prevName === null || thisName === null || numKeys < minKeys) {
|
167
210
|
return;
|
168
211
|
}
|
package/lib/rules/sort-vars.js
CHANGED
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require variables within the same declaration block to be sorted",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/sort-vars"
|
21
21
|
},
|
@@ -40,7 +40,7 @@ module.exports = {
|
|
40
40
|
type: "layout",
|
41
41
|
|
42
42
|
docs: {
|
43
|
-
description: "
|
43
|
+
description: "Enforce consistent spacing before blocks",
|
44
44
|
recommended: false,
|
45
45
|
url: "https://eslint.org/docs/rules/space-before-blocks"
|
46
46
|
},
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "layout",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Enforce consistent spacing before `function` definition opening parenthesis",
|
24
24
|
recommended: false,
|
25
25
|
url: "https://eslint.org/docs/rules/space-before-function-paren"
|
26
26
|
},
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
16
16
|
type: "layout",
|
17
17
|
|
18
18
|
docs: {
|
19
|
-
description: "
|
19
|
+
description: "Enforce consistent spacing inside parentheses",
|
20
20
|
recommended: false,
|
21
21
|
url: "https://eslint.org/docs/rules/space-in-parens"
|
22
22
|
},
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
20
20
|
type: "layout",
|
21
21
|
|
22
22
|
docs: {
|
23
|
-
description: "
|
23
|
+
description: "Enforce consistent spacing before or after unary operators",
|
24
24
|
recommended: false,
|
25
25
|
url: "https://eslint.org/docs/rules/space-unary-ops"
|
26
26
|
},
|
@@ -152,7 +152,7 @@ module.exports = {
|
|
152
152
|
type: "suggestion",
|
153
153
|
|
154
154
|
docs: {
|
155
|
-
description: "
|
155
|
+
description: "Enforce consistent spacing after the `//` or `/*` in a comment",
|
156
156
|
recommended: false,
|
157
157
|
url: "https://eslint.org/docs/rules/spaced-comment"
|
158
158
|
},
|
package/lib/rules/strict.js
CHANGED
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
type: "layout",
|
22
22
|
|
23
23
|
docs: {
|
24
|
-
description: "
|
24
|
+
description: "Enforce spacing around colons of switch statements",
|
25
25
|
recommended: false,
|
26
26
|
url: "https://eslint.org/docs/rules/switch-colon-spacing"
|
27
27
|
},
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
21
21
|
type: "layout",
|
22
22
|
|
23
23
|
docs: {
|
24
|
-
description: "
|
24
|
+
description: "Require or disallow spacing around embedded expressions of template strings",
|
25
25
|
recommended: false,
|
26
26
|
url: "https://eslint.org/docs/rules/template-curly-spacing"
|
27
27
|
},
|
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "layout",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require or disallow spacing between template tags and their literals",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/template-tag-spacing"
|
21
21
|
},
|
package/lib/rules/unicode-bom.js
CHANGED
@@ -14,7 +14,7 @@ module.exports = {
|
|
14
14
|
type: "layout",
|
15
15
|
|
16
16
|
docs: {
|
17
|
-
description: "
|
17
|
+
description: "Require or disallow Unicode byte order mark (BOM)",
|
18
18
|
recommended: false,
|
19
19
|
url: "https://eslint.org/docs/rules/unicode-bom"
|
20
20
|
},
|
package/lib/rules/use-isnan.js
CHANGED
@@ -37,7 +37,7 @@ module.exports = {
|
|
37
37
|
type: "problem",
|
38
38
|
|
39
39
|
docs: {
|
40
|
-
description: "
|
40
|
+
description: "Require calls to `isNaN()` when checking for `NaN`",
|
41
41
|
recommended: true,
|
42
42
|
url: "https://eslint.org/docs/rules/use-isnan"
|
43
43
|
},
|
package/lib/rules/valid-jsdoc.js
CHANGED
@@ -14,7 +14,7 @@ module.exports = {
|
|
14
14
|
type: "problem",
|
15
15
|
|
16
16
|
docs: {
|
17
|
-
description: "
|
17
|
+
description: "Enforce comparing `typeof` expressions against valid strings",
|
18
18
|
recommended: true,
|
19
19
|
url: "https://eslint.org/docs/rules/valid-typeof"
|
20
20
|
},
|
package/lib/rules/vars-on-top.js
CHANGED
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "suggestion",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require `var` declarations be placed at the top of their containing scope",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/vars-on-top"
|
21
21
|
},
|
package/lib/rules/wrap-iife.js
CHANGED
@@ -43,7 +43,7 @@ module.exports = {
|
|
43
43
|
type: "layout",
|
44
44
|
|
45
45
|
docs: {
|
46
|
-
description: "
|
46
|
+
description: "Require parentheses around immediate `function` invocations",
|
47
47
|
recommended: false,
|
48
48
|
url: "https://eslint.org/docs/rules/wrap-iife"
|
49
49
|
},
|
package/lib/rules/wrap-regex.js
CHANGED
@@ -15,7 +15,7 @@ module.exports = {
|
|
15
15
|
type: "layout",
|
16
16
|
|
17
17
|
docs: {
|
18
|
-
description: "
|
18
|
+
description: "Require or disallow spacing around the `*` in `yield*` expressions",
|
19
19
|
recommended: false,
|
20
20
|
url: "https://eslint.org/docs/rules/yield-star-spacing"
|
21
21
|
},
|
package/lib/rules/yoda.js
CHANGED
package/lib/unsupported-api.js
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
//-----------------------------------------------------------------------------
|
13
13
|
|
14
14
|
const { FileEnumerator } = require("./cli-engine/file-enumerator");
|
15
|
+
const { FlatESLint } = require("./eslint/flat-eslint");
|
16
|
+
const FlatRuleTester = require("./rule-tester/flat-rule-tester");
|
15
17
|
|
16
18
|
//-----------------------------------------------------------------------------
|
17
19
|
// Exports
|
@@ -19,5 +21,7 @@ const { FileEnumerator } = require("./cli-engine/file-enumerator");
|
|
19
21
|
|
20
22
|
module.exports = {
|
21
23
|
builtinRules: require("./rules"),
|
24
|
+
FlatESLint,
|
25
|
+
FlatRuleTester,
|
22
26
|
FileEnumerator
|
23
27
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.21.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"bin": {
|
@@ -55,7 +55,8 @@
|
|
55
55
|
"bugs": "https://github.com/eslint/eslint/issues/",
|
56
56
|
"dependencies": {
|
57
57
|
"@eslint/eslintrc": "^1.3.0",
|
58
|
-
"@humanwhocodes/config-array": "^0.
|
58
|
+
"@humanwhocodes/config-array": "^0.10.4",
|
59
|
+
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
|
59
60
|
"ajv": "^6.10.0",
|
60
61
|
"chalk": "^4.0.0",
|
61
62
|
"cross-spawn": "^7.0.2",
|
@@ -65,14 +66,17 @@
|
|
65
66
|
"eslint-scope": "^7.1.1",
|
66
67
|
"eslint-utils": "^3.0.0",
|
67
68
|
"eslint-visitor-keys": "^3.3.0",
|
68
|
-
"espree": "^9.3.
|
69
|
+
"espree": "^9.3.3",
|
69
70
|
"esquery": "^1.4.0",
|
70
71
|
"esutils": "^2.0.2",
|
71
72
|
"fast-deep-equal": "^3.1.3",
|
72
73
|
"file-entry-cache": "^6.0.1",
|
74
|
+
"find-up": "^5.0.0",
|
73
75
|
"functional-red-black-tree": "^1.0.1",
|
74
76
|
"glob-parent": "^6.0.1",
|
75
77
|
"globals": "^13.15.0",
|
78
|
+
"globby": "^11.1.0",
|
79
|
+
"grapheme-splitter": "^1.0.4",
|
76
80
|
"ignore": "^5.2.0",
|
77
81
|
"import-fresh": "^3.0.0",
|
78
82
|
"imurmurhash": "^0.1.4",
|
@@ -98,15 +102,14 @@
|
|
98
102
|
"cheerio": "^0.22.0",
|
99
103
|
"common-tags": "^1.8.0",
|
100
104
|
"core-js": "^3.1.3",
|
101
|
-
"dateformat": "^4.5.1",
|
102
105
|
"ejs": "^3.0.2",
|
103
106
|
"eslint": "file:.",
|
104
107
|
"eslint-config-eslint": "file:packages/eslint-config-eslint",
|
105
108
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
106
|
-
"eslint-plugin-eslint-plugin": "^4.
|
109
|
+
"eslint-plugin-eslint-plugin": "^4.4.0",
|
107
110
|
"eslint-plugin-internal-rules": "file:tools/internal-rules",
|
108
|
-
"eslint-plugin-jsdoc": "^
|
109
|
-
"eslint-plugin-
|
111
|
+
"eslint-plugin-jsdoc": "^38.1.6",
|
112
|
+
"eslint-plugin-n": "^15.2.4",
|
110
113
|
"eslint-plugin-unicorn": "^42.0.0",
|
111
114
|
"eslint-release": "^3.2.0",
|
112
115
|
"eslump": "^3.0.0",
|
@@ -124,8 +127,8 @@
|
|
124
127
|
"karma-webpack": "^5.0.0",
|
125
128
|
"lint-staged": "^11.0.0",
|
126
129
|
"load-perf": "^0.2.0",
|
127
|
-
"markdownlint": "^0.
|
128
|
-
"markdownlint-cli": "^0.
|
130
|
+
"markdownlint": "^0.25.1",
|
131
|
+
"markdownlint-cli": "^0.31.1",
|
129
132
|
"marked": "^4.0.8",
|
130
133
|
"memfs": "^3.0.1",
|
131
134
|
"metascraper": "^5.25.7",
|
@@ -142,7 +145,7 @@
|
|
142
145
|
"pirates": "^4.0.5",
|
143
146
|
"progress": "^2.0.3",
|
144
147
|
"proxyquire": "^2.0.1",
|
145
|
-
"puppeteer": "^
|
148
|
+
"puppeteer": "^13.7.0",
|
146
149
|
"recast": "^0.20.4",
|
147
150
|
"regenerator-runtime": "^0.13.2",
|
148
151
|
"semver": "^7.3.5",
|