From 204d31c9c2a92496a59635d9f42a532e1dc46f90 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Tue, 7 May 2024 19:18:33 +0800 Subject: [PATCH] Update `eslint-plugin-eslint-plugin` to v6 (#2336) --- package.json | 2 +- rules/better-regex.js | 1 + rules/catch-error-name.js | 1 + rules/consistent-destructuring.js | 1 + rules/consistent-function-scoping.js | 1 + rules/custom-error-definition.js | 1 + rules/empty-brace-spaces.js | 1 + rules/error-message.js | 1 + rules/escape-case.js | 1 + rules/expiring-todo-comments.js | 1 + rules/explicit-length-check.js | 1 + rules/filename-case.js | 1 + rules/import-style.js | 1 + rules/new-for-builtins.js | 1 + rules/no-abusive-eslint-disable.js | 1 + rules/no-anonymous-default-export.js | 1 + rules/no-array-callback-reference.js | 1 + rules/no-array-for-each.js | 1 + rules/no-array-method-this-argument.js | 1 + rules/no-array-push-push.js | 1 + rules/no-array-reduce.js | 1 + rules/no-await-expression-member.js | 1 + rules/no-await-in-promise-methods.js | 1 + rules/no-console-spaces.js | 1 + rules/no-document-cookie.js | 1 + rules/no-empty-file.js | 1 + rules/no-for-loop.js | 1 + rules/no-hex-escape.js | 1 + rules/no-instanceof-array.js | 1 + rules/no-invalid-remove-event-listener.js | 1 + rules/no-keyword-prefix.js | 1 + rules/no-lonely-if.js | 1 + rules/no-negated-condition.js | 1 + rules/no-nested-ternary.js | 1 + rules/no-new-array.js | 1 + rules/no-new-buffer.js | 1 + rules/no-null.js | 1 + rules/no-object-as-default-parameter.js | 1 + rules/no-process-exit.js | 1 + rules/no-single-promise-in-promise-methods.js | 1 + rules/no-static-only-class.js | 1 + rules/no-thenable.js | 1 + rules/no-this-assignment.js | 1 + rules/no-typeof-undefined.js | 1 + rules/no-unnecessary-await.js | 1 + rules/no-unnecessary-polyfills.js | 1 + rules/no-unreadable-array-destructuring.js | 1 + rules/no-unreadable-iife.js | 1 + rules/no-unused-properties.js | 1 + rules/no-useless-fallback-in-spread.js | 1 + rules/no-useless-length-check.js | 1 + rules/no-useless-promise-resolve-reject.js | 1 + rules/no-useless-spread.js | 1 + rules/no-useless-switch-case.js | 1 + rules/no-useless-undefined.js | 1 + rules/no-zero-fractions.js | 1 + rules/number-literal-case.js | 1 + rules/numeric-separators-style.js | 1 + rules/prefer-add-event-listener.js | 1 + rules/prefer-array-find.js | 1 + rules/prefer-array-flat-map.js | 1 + rules/prefer-array-flat.js | 5 +++++ rules/prefer-array-index-of.js | 1 + rules/prefer-array-some.js | 1 + rules/prefer-at.js | 1 + rules/prefer-blob-reading-methods.js | 1 + rules/prefer-code-point.js | 1 + rules/prefer-date-now.js | 1 + rules/prefer-default-parameters.js | 1 + rules/prefer-dom-node-append.js | 1 + rules/prefer-dom-node-dataset.js | 1 + rules/prefer-dom-node-remove.js | 1 + rules/prefer-dom-node-text-content.js | 1 + rules/prefer-event-target.js | 1 + rules/prefer-export-from.js | 1 + rules/prefer-includes.js | 1 + rules/prefer-json-parse-buffer.js | 1 + rules/prefer-keyboard-event-key.js | 1 + rules/prefer-logical-operator-over-ternary.js | 1 + rules/prefer-math-trunc.js | 1 + rules/prefer-modern-dom-apis.js | 1 + rules/prefer-modern-math-apis.js | 2 ++ rules/prefer-module.js | 1 + rules/prefer-native-coercion-functions.js | 1 + rules/prefer-negative-index.js | 1 + rules/prefer-node-protocol.js | 1 + rules/prefer-number-properties.js | 1 + rules/prefer-object-from-entries.js | 1 + rules/prefer-optional-catch-binding.js | 1 + rules/prefer-prototype-methods.js | 1 + rules/prefer-query-selector.js | 1 + rules/prefer-reflect-apply.js | 1 + rules/prefer-regexp-test.js | 1 + rules/prefer-set-has.js | 1 + rules/prefer-set-size.js | 1 + rules/prefer-spread.js | 1 + rules/prefer-string-replace-all.js | 1 + rules/prefer-string-slice.js | 1 + rules/prefer-string-starts-ends-with.js | 1 + rules/prefer-string-trim-start-end.js | 1 + rules/prefer-structured-clone.js | 2 ++ rules/prefer-switch.js | 1 + rules/prefer-ternary.js | 1 + rules/prefer-top-level-await.js | 1 + rules/prefer-type-error.js | 1 + rules/prevent-abbreviations.js | 1 + rules/relative-url-style.js | 1 + rules/require-array-join-separator.js | 1 + .../require-number-to-fixed-digits-argument.js | 1 + rules/require-post-message-target-origin.js | 1 + rules/string-content.js | 1 + rules/switch-case-braces.js | 1 + rules/template-indent.js | 1 + rules/text-encoding-identifier-case.js | 1 + rules/throw-new-error.js | 1 + scripts/template/rule.js.jst | 1 + test/package.mjs | 18 ++++++++++++++++++ 117 files changed, 140 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4580b291b9..0637675c01 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "eslint": "^9.0.0", "eslint-ava-rule-tester": "^5.0.1", "eslint-doc-generator": "^1.7.0", - "eslint-plugin-eslint-plugin": "^5.2.1", + "eslint-plugin-eslint-plugin": "^6.1.0", "eslint-plugin-internal-rules": "file:./scripts/internal-rules/", "eslint-remote-tester": "^3.0.1", "eslint-remote-tester-repositories": "^1.0.1", diff --git a/rules/better-regex.js b/rules/better-regex.js index 26ef86d761..96329bbec8 100644 --- a/rules/better-regex.js +++ b/rules/better-regex.js @@ -136,6 +136,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Improve regexes by making them shorter, consistent, and safer.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/catch-error-name.js b/rules/catch-error-name.js index 0c21d0e391..58f2cdf127 100644 --- a/rules/catch-error-name.js +++ b/rules/catch-error-name.js @@ -128,6 +128,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce a specific parameter name in catch clauses.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/consistent-destructuring.js b/rules/consistent-destructuring.js index c6b20c35b9..dcd35594d2 100644 --- a/rules/consistent-destructuring.js +++ b/rules/consistent-destructuring.js @@ -157,6 +157,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Use destructured variables over properties.', + recommended: false, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/consistent-function-scoping.js b/rules/consistent-function-scoping.js index 6ef9975250..b4199125cf 100644 --- a/rules/consistent-function-scoping.js +++ b/rules/consistent-function-scoping.js @@ -216,6 +216,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Move function definitions to the highest possible scope.', + recommended: true, }, schema, messages, diff --git a/rules/custom-error-definition.js b/rules/custom-error-definition.js index a4975b3163..23ce253769 100644 --- a/rules/custom-error-definition.js +++ b/rules/custom-error-definition.js @@ -208,6 +208,7 @@ module.exports = { type: 'problem', docs: { description: 'Enforce correct `Error` subclassing.', + recommended: false, }, fixable: 'code', messages, diff --git a/rules/empty-brace-spaces.js b/rules/empty-brace-spaces.js index b8c86e0cce..927cfba1fb 100644 --- a/rules/empty-brace-spaces.js +++ b/rules/empty-brace-spaces.js @@ -65,6 +65,7 @@ module.exports = { type: 'layout', docs: { description: 'Enforce no spaces between braces.', + recommended: true, }, fixable: 'whitespace', messages, diff --git a/rules/error-message.js b/rules/error-message.js index 880fe9ee37..5871630eee 100644 --- a/rules/error-message.js +++ b/rules/error-message.js @@ -98,6 +98,7 @@ module.exports = { type: 'problem', docs: { description: 'Enforce passing a `message` value when creating a built-in error.', + recommended: true, }, messages, }, diff --git a/rules/escape-case.js b/rules/escape-case.js index a4c8f54e5c..85a84f69ea 100644 --- a/rules/escape-case.js +++ b/rules/escape-case.js @@ -56,6 +56,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Require escape sequences to use uppercase values.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/expiring-todo-comments.js b/rules/expiring-todo-comments.js index 2dcc53fe70..f38a50adb4 100644 --- a/rules/expiring-todo-comments.js +++ b/rules/expiring-todo-comments.js @@ -581,6 +581,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Add expiration conditions to TODO comments.', + recommended: true, }, schema, messages, diff --git a/rules/explicit-length-check.js b/rules/explicit-length-check.js index 96352bcfa5..5fcbf5c013 100644 --- a/rules/explicit-length-check.js +++ b/rules/explicit-length-check.js @@ -225,6 +225,7 @@ module.exports = { type: 'problem', docs: { description: 'Enforce explicitly comparing the `length` or `size` property of a value.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/filename-case.js b/rules/filename-case.js index 9ec7cbed01..8fdaf69d63 100644 --- a/rules/filename-case.js +++ b/rules/filename-case.js @@ -284,6 +284,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce a case style for filenames.', + recommended: true, }, schema, messages, diff --git a/rules/import-style.js b/rules/import-style.js index 6db6674db4..6674d06349 100644 --- a/rules/import-style.js +++ b/rules/import-style.js @@ -363,6 +363,7 @@ module.exports = { type: 'problem', docs: { description: 'Enforce specific import styles per module.', + recommended: true, }, schema, messages, diff --git a/rules/new-for-builtins.js b/rules/new-for-builtins.js index 559e50cdf5..b60844653d 100644 --- a/rules/new-for-builtins.js +++ b/rules/new-for-builtins.js @@ -78,6 +78,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce the use of `new` for all builtins, except `String`, `Number`, `Boolean`, `Symbol` and `BigInt`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-abusive-eslint-disable.js b/rules/no-abusive-eslint-disable.js index 927dabe748..9bd759e041 100644 --- a/rules/no-abusive-eslint-disable.js +++ b/rules/no-abusive-eslint-disable.js @@ -42,6 +42,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce specifying rules to disable in `eslint-disable` comments.', + recommended: true, }, messages, }, diff --git a/rules/no-anonymous-default-export.js b/rules/no-anonymous-default-export.js index 8195ec7796..3fe29706ea 100644 --- a/rules/no-anonymous-default-export.js +++ b/rules/no-anonymous-default-export.js @@ -205,6 +205,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow anonymous functions and classes as the default export.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/no-array-callback-reference.js b/rules/no-array-callback-reference.js index e658bbab9a..6325c586cc 100644 --- a/rules/no-array-callback-reference.js +++ b/rules/no-array-callback-reference.js @@ -278,6 +278,7 @@ module.exports = { type: 'problem', docs: { description: 'Prevent passing a function reference directly to iterator methods.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/no-array-for-each.js b/rules/no-array-for-each.js index 9674929299..025ffff593 100644 --- a/rules/no-array-for-each.js +++ b/rules/no-array-for-each.js @@ -475,6 +475,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `for…of` over the `forEach` method.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-array-method-this-argument.js b/rules/no-array-method-this-argument.js index d6330a7c35..ee50d3a586 100644 --- a/rules/no-array-method-this-argument.js +++ b/rules/no-array-method-this-argument.js @@ -216,6 +216,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow using the `this` argument in array methods.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-array-push-push.js b/rules/no-array-push-push.js index 6d356f8e62..776fcbf3d0 100644 --- a/rules/no-array-push-push.js +++ b/rules/no-array-push-push.js @@ -135,6 +135,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce combining multiple `Array#push()` into one call.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-array-reduce.js b/rules/no-array-reduce.js index 5c62068997..9a7057130a 100644 --- a/rules/no-array-reduce.js +++ b/rules/no-array-reduce.js @@ -119,6 +119,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow `Array#reduce()` and `Array#reduceRight()`.', + recommended: true, }, schema, messages, diff --git a/rules/no-await-expression-member.js b/rules/no-await-expression-member.js index f4bf8f06d5..c7cfd8206c 100644 --- a/rules/no-await-expression-member.js +++ b/rules/no-await-expression-member.js @@ -83,6 +83,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow member access from await expression.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-await-in-promise-methods.js b/rules/no-await-in-promise-methods.js index 4e428558bd..7ece11f2c4 100644 --- a/rules/no-await-in-promise-methods.js +++ b/rules/no-await-in-promise-methods.js @@ -61,6 +61,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow using `await` in `Promise` method parameters.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/no-console-spaces.js b/rules/no-console-spaces.js index c0f583e893..558fe24f31 100644 --- a/rules/no-console-spaces.js +++ b/rules/no-console-spaces.js @@ -79,6 +79,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Do not use leading/trailing space between `console.log` parameters.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-document-cookie.js b/rules/no-document-cookie.js index c9db79352c..ac95ccc21b 100644 --- a/rules/no-document-cookie.js +++ b/rules/no-document-cookie.js @@ -19,6 +19,7 @@ module.exports = { type: 'problem', docs: { description: 'Do not use `document.cookie` directly.', + recommended: true, }, messages, }, diff --git a/rules/no-empty-file.js b/rules/no-empty-file.js index dc3a396917..f1711a3959 100644 --- a/rules/no-empty-file.js +++ b/rules/no-empty-file.js @@ -51,6 +51,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow empty files.', + recommended: true, }, messages, }, diff --git a/rules/no-for-loop.js b/rules/no-for-loop.js index f3c0d0ffb9..c7f3916c72 100644 --- a/rules/no-for-loop.js +++ b/rules/no-for-loop.js @@ -419,6 +419,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Do not use a `for` loop that can be replaced with a `for-of` loop.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-hex-escape.js b/rules/no-hex-escape.js index 52acbe4751..ba9037f061 100644 --- a/rules/no-hex-escape.js +++ b/rules/no-hex-escape.js @@ -39,6 +39,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce the use of Unicode escapes instead of hexadecimal escapes.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-instanceof-array.js b/rules/no-instanceof-array.js index cc6689478c..539b8e7560 100644 --- a/rules/no-instanceof-array.js +++ b/rules/no-instanceof-array.js @@ -58,6 +58,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Require `Array.isArray()` instead of `instanceof Array`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-invalid-remove-event-listener.js b/rules/no-invalid-remove-event-listener.js index 017f275b2f..24115de226 100644 --- a/rules/no-invalid-remove-event-listener.js +++ b/rules/no-invalid-remove-event-listener.js @@ -54,6 +54,7 @@ module.exports = { type: 'problem', docs: { description: 'Prevent calling `EventTarget#removeEventListener()` with the result of an expression.', + recommended: true, }, messages, }, diff --git a/rules/no-keyword-prefix.js b/rules/no-keyword-prefix.js index 17bdd8edc2..f595edad0d 100644 --- a/rules/no-keyword-prefix.js +++ b/rules/no-keyword-prefix.js @@ -192,6 +192,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow identifiers starting with `new` or `class`.', + recommended: false, }, schema, messages, diff --git a/rules/no-lonely-if.js b/rules/no-lonely-if.js index 6e2989307a..4f224d8f4b 100644 --- a/rules/no-lonely-if.js +++ b/rules/no-lonely-if.js @@ -144,6 +144,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow `if` statements as the only statement in `if` blocks without `else`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-negated-condition.js b/rules/no-negated-condition.js index 2ebaa70bb1..7af4db6774 100644 --- a/rules/no-negated-condition.js +++ b/rules/no-negated-condition.js @@ -137,6 +137,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow negated conditions.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-nested-ternary.js b/rules/no-nested-ternary.js index 61e01cf1a4..57f3ea8182 100644 --- a/rules/no-nested-ternary.js +++ b/rules/no-nested-ternary.js @@ -51,6 +51,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow nested ternary expressions.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-new-array.js b/rules/no-new-array.js index cc8c813448..7cd8f3d166 100644 --- a/rules/no-new-array.js +++ b/rules/no-new-array.js @@ -96,6 +96,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow `new Array()`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-new-buffer.js b/rules/no-new-buffer.js index 4c03eac12e..42c529264d 100644 --- a/rules/no-new-buffer.js +++ b/rules/no-new-buffer.js @@ -90,6 +90,7 @@ module.exports = { type: 'problem', docs: { description: 'Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-null.js b/rules/no-null.js index b639969ef9..b18fc9cf95 100644 --- a/rules/no-null.js +++ b/rules/no-null.js @@ -144,6 +144,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow the use of the `null` literal.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-object-as-default-parameter.js b/rules/no-object-as-default-parameter.js index 0b61566b6a..49cd9ad655 100644 --- a/rules/no-object-as-default-parameter.js +++ b/rules/no-object-as-default-parameter.js @@ -44,6 +44,7 @@ module.exports = { type: 'problem', docs: { description: 'Disallow the use of objects as default parameters.', + recommended: true, }, messages, }, diff --git a/rules/no-process-exit.js b/rules/no-process-exit.js index dd84e0e760..1cc6ea9988 100644 --- a/rules/no-process-exit.js +++ b/rules/no-process-exit.js @@ -98,6 +98,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow `process.exit()`.', + recommended: true, }, messages, }, diff --git a/rules/no-single-promise-in-promise-methods.js b/rules/no-single-promise-in-promise-methods.js index b0090f1c2a..94e30744a7 100644 --- a/rules/no-single-promise-in-promise-methods.js +++ b/rules/no-single-promise-in-promise-methods.js @@ -159,6 +159,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow passing single-element arrays to `Promise` methods.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-static-only-class.js b/rules/no-static-only-class.js index ed19172e52..c320bc6da0 100644 --- a/rules/no-static-only-class.js +++ b/rules/no-static-only-class.js @@ -217,6 +217,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow classes that only have static members.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-thenable.js b/rules/no-thenable.js index 2aa903bd2f..238c8b8749 100644 --- a/rules/no-thenable.js +++ b/rules/no-thenable.js @@ -192,6 +192,7 @@ module.exports = { type: 'problem', docs: { description: 'Disallow `then` property.', + recommended: true, }, messages, }, diff --git a/rules/no-this-assignment.js b/rules/no-this-assignment.js index a7d4975f73..7ba5b97b7d 100644 --- a/rules/no-this-assignment.js +++ b/rules/no-this-assignment.js @@ -32,6 +32,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow assigning `this` to a variable.', + recommended: true, }, messages, }, diff --git a/rules/no-typeof-undefined.js b/rules/no-typeof-undefined.js index 261dfe0207..54a5306464 100644 --- a/rules/no-typeof-undefined.js +++ b/rules/no-typeof-undefined.js @@ -134,6 +134,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow comparing `undefined` using `typeof`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/no-unnecessary-await.js b/rules/no-unnecessary-await.js index addae9666f..f0b9516766 100644 --- a/rules/no-unnecessary-await.js +++ b/rules/no-unnecessary-await.js @@ -99,6 +99,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow awaiting non-promise values.', + recommended: true, }, fixable: 'code', diff --git a/rules/no-unnecessary-polyfills.js b/rules/no-unnecessary-polyfills.js index 5ccacb38c0..6f2d09a835 100644 --- a/rules/no-unnecessary-polyfills.js +++ b/rules/no-unnecessary-polyfills.js @@ -169,6 +169,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce the use of built-in methods instead of unnecessary polyfills.', + recommended: true, }, schema, messages, diff --git a/rules/no-unreadable-array-destructuring.js b/rules/no-unreadable-array-destructuring.js index daa41fe6fa..6e17b4720b 100644 --- a/rules/no-unreadable-array-destructuring.js +++ b/rules/no-unreadable-array-destructuring.js @@ -76,6 +76,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow unreadable array destructuring.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-unreadable-iife.js b/rules/no-unreadable-iife.js index 17a25687f4..d8f0098340 100644 --- a/rules/no-unreadable-iife.js +++ b/rules/no-unreadable-iife.js @@ -38,6 +38,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow unreadable IIFEs.', + recommended: true, }, hasSuggestions: false, messages, diff --git a/rules/no-unused-properties.js b/rules/no-unused-properties.js index 0f190d4eb0..912d48f933 100644 --- a/rules/no-unused-properties.js +++ b/rules/no-unused-properties.js @@ -232,6 +232,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow unused object properties.', + recommended: false, }, messages, }, diff --git a/rules/no-useless-fallback-in-spread.js b/rules/no-useless-fallback-in-spread.js index 68c081527f..1598173f65 100644 --- a/rules/no-useless-fallback-in-spread.js +++ b/rules/no-useless-fallback-in-spread.js @@ -60,6 +60,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow useless fallback when spreading in object literals.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-useless-length-check.js b/rules/no-useless-length-check.js index 2b9b611bfc..d2fc8aedf1 100644 --- a/rules/no-useless-length-check.js +++ b/rules/no-useless-length-check.js @@ -145,6 +145,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow useless array length check.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-useless-promise-resolve-reject.js b/rules/no-useless-promise-resolve-reject.js index f0d36c57be..f99afbba68 100644 --- a/rules/no-useless-promise-resolve-reject.js +++ b/rules/no-useless-promise-resolve-reject.js @@ -205,6 +205,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-useless-spread.js b/rules/no-useless-spread.js index e76e0f21ce..ef43965a75 100644 --- a/rules/no-useless-spread.js +++ b/rules/no-useless-spread.js @@ -374,6 +374,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow unnecessary spread.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/no-useless-switch-case.js b/rules/no-useless-switch-case.js index 6651fc1ea6..84d622f030 100644 --- a/rules/no-useless-switch-case.js +++ b/rules/no-useless-switch-case.js @@ -50,6 +50,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow useless case in switch statements.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/no-useless-undefined.js b/rules/no-useless-undefined.js index 3aba0e8b2a..4a24698a6a 100644 --- a/rules/no-useless-undefined.js +++ b/rules/no-useless-undefined.js @@ -293,6 +293,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow useless `undefined`.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/no-zero-fractions.js b/rules/no-zero-fractions.js index 372c3a844d..185a023904 100644 --- a/rules/no-zero-fractions.js +++ b/rules/no-zero-fractions.js @@ -72,6 +72,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Disallow number literals with zero fractions or dangling dots.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/number-literal-case.js b/rules/number-literal-case.js index 26ad799439..6d93da187c 100644 --- a/rules/number-literal-case.js +++ b/rules/number-literal-case.js @@ -45,6 +45,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce proper case for numeric literals.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/numeric-separators-style.js b/rules/numeric-separators-style.js index 9c0ccaf649..7b713c1cf9 100644 --- a/rules/numeric-separators-style.js +++ b/rules/numeric-separators-style.js @@ -173,6 +173,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce the style of numeric separators by correctly grouping digits.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/prefer-add-event-listener.js b/rules/prefer-add-event-listener.js index 2a957d2367..f40b8545b0 100644 --- a/rules/prefer-add-event-listener.js +++ b/rules/prefer-add-event-listener.js @@ -180,6 +180,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/prefer-array-find.js b/rules/prefer-array-find.js index 6a81ae233f..736ac4b8c5 100644 --- a/rules/prefer-array-find.js +++ b/rules/prefer-array-find.js @@ -442,6 +442,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-array-flat-map.js b/rules/prefer-array-flat-map.js index 186666ae33..5b4e444f3d 100644 --- a/rules/prefer-array-flat-map.js +++ b/rules/prefer-array-flat-map.js @@ -75,6 +75,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.flatMap(…)` over `.map(…).flat()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-array-flat.js b/rules/prefer-array-flat.js index 363469add3..2bf40baca9 100644 --- a/rules/prefer-array-flat.js +++ b/rules/prefer-array-flat.js @@ -46,6 +46,7 @@ const arrayFlatMap = { }, getArrayNode: node => node.callee.object, description: 'Array#flatMap()', + recommended: true, }; // `array.reduce((a, b) => a.concat(b), [])` @@ -99,6 +100,7 @@ const arrayReduce = { }, getArrayNode: node => node.callee.object, description: 'Array#reduce()', + recommended: true, }; // `[].concat(maybeArray)` @@ -119,6 +121,7 @@ const emptyArrayConcat = { return argumentNode.type === 'SpreadElement' ? argumentNode.argument : argumentNode; }, description: '[].concat()', + recommended: true, shouldSwitchToArray: node => node.arguments[0].type !== 'SpreadElement', }; @@ -154,6 +157,7 @@ const arrayPrototypeConcat = { return argumentNode.type === 'SpreadElement' ? argumentNode.argument : argumentNode; }, description: 'Array.prototype.concat()', + recommended: true, shouldSwitchToArray: node => node.arguments[1].type !== 'SpreadElement' && node.callee.property.name === 'call', }; @@ -271,6 +275,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Array#flat()` over legacy techniques to flatten arrays.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/prefer-array-index-of.js b/rules/prefer-array-index-of.js index 42ae76ff53..f211e3c5be 100644 --- a/rules/prefer-array-index-of.js +++ b/rules/prefer-array-index-of.js @@ -21,6 +21,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-array-some.js b/rules/prefer-array-some.js index 5ffc51059b..563dd39b79 100644 --- a/rules/prefer-array-some.js +++ b/rules/prefer-array-some.js @@ -149,6 +149,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast}(…)`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-at.js b/rules/prefer-at.js index b337bcd684..9986a8e10d 100644 --- a/rules/prefer-at.js +++ b/rules/prefer-at.js @@ -365,6 +365,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.at()` method for index access and `String#charAt()`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-blob-reading-methods.js b/rules/prefer-blob-reading-methods.js index bbb1bb418b..e7a892b763 100644 --- a/rules/prefer-blob-reading-methods.js +++ b/rules/prefer-blob-reading-methods.js @@ -39,6 +39,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.', + recommended: true, }, messages, }, diff --git a/rules/prefer-code-point.js b/rules/prefer-code-point.js index f94317f393..3d72bf82ca 100644 --- a/rules/prefer-code-point.js +++ b/rules/prefer-code-point.js @@ -60,6 +60,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/prefer-date-now.js b/rules/prefer-date-now.js index 3d46f07366..b9cbc008cf 100644 --- a/rules/prefer-date-now.js +++ b/rules/prefer-date-now.js @@ -128,6 +128,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-default-parameters.js b/rules/prefer-default-parameters.js index 8bb0fe4b44..c5bb54b73f 100644 --- a/rules/prefer-default-parameters.js +++ b/rules/prefer-default-parameters.js @@ -208,6 +208,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer default parameters over reassignment.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-dom-node-append.js b/rules/prefer-dom-node-append.js index 43526b7b33..ea3634e350 100644 --- a/rules/prefer-dom-node-append.js +++ b/rules/prefer-dom-node-append.js @@ -41,6 +41,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Node#append()` over `Node#appendChild()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-dom-node-dataset.js b/rules/prefer-dom-node-dataset.js index d27788feaf..abc6456a4f 100644 --- a/rules/prefer-dom-node-dataset.js +++ b/rules/prefer-dom-node-dataset.js @@ -124,6 +124,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using `.dataset` on DOM elements over calling attribute methods.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-dom-node-remove.js b/rules/prefer-dom-node-remove.js index 1411ec51a0..3b64ac6b0f 100644 --- a/rules/prefer-dom-node-remove.js +++ b/rules/prefer-dom-node-remove.js @@ -114,6 +114,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-dom-node-text-content.js b/rules/prefer-dom-node-text-content.js index 03b09a749c..72ff975856 100644 --- a/rules/prefer-dom-node-text-content.js +++ b/rules/prefer-dom-node-text-content.js @@ -68,6 +68,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.textContent` over `.innerText`.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/prefer-event-target.js b/rules/prefer-event-target.js index 9d4373d4d0..68a4b0b691 100644 --- a/rules/prefer-event-target.js +++ b/rules/prefer-event-target.js @@ -111,6 +111,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `EventTarget` over `EventEmitter`.', + recommended: true, }, messages, }, diff --git a/rules/prefer-export-from.js b/rules/prefer-export-from.js index 789174bbd4..5dec4345ae 100644 --- a/rules/prefer-export-from.js +++ b/rules/prefer-export-from.js @@ -402,6 +402,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `export…from` when re-exporting.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-includes.js b/rules/prefer-includes.js index 43ada06615..0cfd14a6c2 100644 --- a/rules/prefer-includes.js +++ b/rules/prefer-includes.js @@ -87,6 +87,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.includes()` over `.indexOf()` and `Array#some()` when checking for existence or non-existence.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-json-parse-buffer.js b/rules/prefer-json-parse-buffer.js index d58c9aa916..585b173794 100644 --- a/rules/prefer-json-parse-buffer.js +++ b/rules/prefer-json-parse-buffer.js @@ -152,6 +152,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer reading a JSON file as a buffer.', + recommended: false, }, fixable: 'code', messages, diff --git a/rules/prefer-keyboard-event-key.js b/rules/prefer-keyboard-event-key.js index 65642332e9..8230de582c 100644 --- a/rules/prefer-keyboard-event-key.js +++ b/rules/prefer-keyboard-event-key.js @@ -179,6 +179,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-logical-operator-over-ternary.js b/rules/prefer-logical-operator-over-ternary.js index 084b798c1e..240855c93b 100644 --- a/rules/prefer-logical-operator-over-ternary.js +++ b/rules/prefer-logical-operator-over-ternary.js @@ -151,6 +151,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using a logical operator over a ternary.', + recommended: true, }, hasSuggestions: true, diff --git a/rules/prefer-math-trunc.js b/rules/prefer-math-trunc.js index 430af5f2e9..a90e4e4148 100644 --- a/rules/prefer-math-trunc.js +++ b/rules/prefer-math-trunc.js @@ -101,6 +101,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce the use of `Math.trunc` instead of bitwise operators.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-modern-dom-apis.js b/rules/prefer-modern-dom-apis.js index 75acf8cf31..b06e502663 100644 --- a/rules/prefer-modern-dom-apis.js +++ b/rules/prefer-modern-dom-apis.js @@ -134,6 +134,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.before()` over `.insertBefore()`, `.replaceWith()` over `.replaceChild()`, prefer one of `.before()`, `.after()`, `.append()` or `.prepend()` over `insertAdjacentText()` and `insertAdjacentElement()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-modern-math-apis.js b/rules/prefer-modern-math-apis.js index 35c23fcca5..232803e1f0 100644 --- a/rules/prefer-modern-math-apis.js +++ b/rules/prefer-modern-math-apis.js @@ -154,6 +154,7 @@ const create = context => { data: { replacement: `Math.${replacementMethod}(…)`, description: 'Math.sqrt(…)', + recommended: true, }, * fix(fixer) { const {sourceCode} = context; @@ -205,6 +206,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer modern `Math` APIs over legacy patterns.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-module.js b/rules/prefer-module.js index 553a9b8417..82e380d8c7 100644 --- a/rules/prefer-module.js +++ b/rules/prefer-module.js @@ -372,6 +372,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer JavaScript modules (ESM) over CommonJS.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-native-coercion-functions.js b/rules/prefer-native-coercion-functions.js index 1eff6bc390..deb9a18085 100644 --- a/rules/prefer-native-coercion-functions.js +++ b/rules/prefer-native-coercion-functions.js @@ -178,6 +178,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-negative-index.js b/rules/prefer-negative-index.js index 09255cbe47..5d528d3e57 100644 --- a/rules/prefer-negative-index.js +++ b/rules/prefer-negative-index.js @@ -206,6 +206,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer negative index over `.length - index` when possible.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-node-protocol.js b/rules/prefer-node-protocol.js index c436eecfef..6515a1a600 100644 --- a/rules/prefer-node-protocol.js +++ b/rules/prefer-node-protocol.js @@ -55,6 +55,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using the `node:` protocol when importing Node.js builtin modules.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-number-properties.js b/rules/prefer-number-properties.js index e4acad1854..3c9e641ca2 100644 --- a/rules/prefer-number-properties.js +++ b/rules/prefer-number-properties.js @@ -130,6 +130,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Number` static properties over global ones.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-object-from-entries.js b/rules/prefer-object-from-entries.js index 6170daf5f9..6c5c46aae2 100644 --- a/rules/prefer-object-from-entries.js +++ b/rules/prefer-object-from-entries.js @@ -244,6 +244,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using `Object.fromEntries(…)` to transform a list of key-value pairs into an object.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/prefer-optional-catch-binding.js b/rules/prefer-optional-catch-binding.js index 8e3d5187a4..c0a94680a5 100644 --- a/rules/prefer-optional-catch-binding.js +++ b/rules/prefer-optional-catch-binding.js @@ -68,6 +68,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer omitting the `catch` binding parameter.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-prototype-methods.js b/rules/prefer-prototype-methods.js index 363622ee93..7aeccc5b74 100644 --- a/rules/prefer-prototype-methods.js +++ b/rules/prefer-prototype-methods.js @@ -153,6 +153,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer borrowing methods from the prototype instead of the instance.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-query-selector.js b/rules/prefer-query-selector.js index b7d685e626..832f419cd2 100644 --- a/rules/prefer-query-selector.js +++ b/rules/prefer-query-selector.js @@ -128,6 +128,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `.querySelector()` over `.getElementById()`, `.querySelectorAll()` over `.getElementsByClassName()` and `.getElementsByTagName()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-reflect-apply.js b/rules/prefer-reflect-apply.js index 013e897137..5aec914039 100644 --- a/rules/prefer-reflect-apply.js +++ b/rules/prefer-reflect-apply.js @@ -90,6 +90,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Reflect.apply()` over `Function#apply()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-regexp-test.js b/rules/prefer-regexp-test.js index ecff31099e..f0ccd0ddaa 100644 --- a/rules/prefer-regexp-test.js +++ b/rules/prefer-regexp-test.js @@ -148,6 +148,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-set-has.js b/rules/prefer-set-has.js index b1113cb8b1..3015ccce80 100644 --- a/rules/prefer-set-has.js +++ b/rules/prefer-set-has.js @@ -178,6 +178,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-set-size.js b/rules/prefer-set-size.js index 4a2d967532..4ad0892c1e 100644 --- a/rules/prefer-set-size.js +++ b/rules/prefer-set-size.js @@ -96,6 +96,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using `Set#size` instead of `Array#length`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-spread.js b/rules/prefer-spread.js index 27a7921a38..afe661322d 100644 --- a/rules/prefer-spread.js +++ b/rules/prefer-spread.js @@ -508,6 +508,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#{slice,toSpliced}()` and `String#split(\'\')`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-string-replace-all.js b/rules/prefer-string-replace-all.js index cd0d01161b..9c223a50b2 100644 --- a/rules/prefer-string-replace-all.js +++ b/rules/prefer-string-replace-all.js @@ -138,6 +138,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `String#replaceAll()` over regex searches with the global flag.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-string-slice.js b/rules/prefer-string-slice.js index d2d09ef837..386de12f20 100644 --- a/rules/prefer-string-slice.js +++ b/rules/prefer-string-slice.js @@ -180,6 +180,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `String#slice()` over `String#substr()` and `String#substring()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-string-starts-ends-with.js b/rules/prefer-string-starts-ends-with.js index 834556a92d..a05a34c0d6 100644 --- a/rules/prefer-string-starts-ends-with.js +++ b/rules/prefer-string-starts-ends-with.js @@ -191,6 +191,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `String#startsWith()` & `String#endsWith()` over `RegExp#test()`.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/prefer-string-trim-start-end.js b/rules/prefer-string-trim-start-end.js index 343ef75d5e..d24bb72dc4 100644 --- a/rules/prefer-string-trim-start-end.js +++ b/rules/prefer-string-trim-start-end.js @@ -37,6 +37,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prefer-structured-clone.js b/rules/prefer-structured-clone.js index 896e510b64..997a4437f0 100644 --- a/rules/prefer-structured-clone.js +++ b/rules/prefer-structured-clone.js @@ -62,6 +62,7 @@ const create = context => { messageId: MESSAGE_ID_ERROR, data: { description: 'JSON.parse(JSON.stringify(…))', + recommended: true, }, suggest: [ { @@ -145,6 +146,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer using `structuredClone` to create a deep clone.', + recommended: true, }, hasSuggestions: true, schema, diff --git a/rules/prefer-switch.js b/rules/prefer-switch.js index 28723d0858..57662b9864 100644 --- a/rules/prefer-switch.js +++ b/rules/prefer-switch.js @@ -336,6 +336,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer `switch` over multiple `else-if`.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/prefer-ternary.js b/rules/prefer-ternary.js index a1f8ab9163..934af8a5e5 100644 --- a/rules/prefer-ternary.js +++ b/rules/prefer-ternary.js @@ -272,6 +272,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer ternary expressions over simple `if-else` statements.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/prefer-top-level-await.js b/rules/prefer-top-level-await.js index 509dcf939c..3505f1c6fa 100644 --- a/rules/prefer-top-level-await.js +++ b/rules/prefer-top-level-await.js @@ -145,6 +145,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prefer top-level await over top-level promises and async function calls.', + recommended: true, }, hasSuggestions: true, messages, diff --git a/rules/prefer-type-error.js b/rules/prefer-type-error.js index 48849d853a..b08ae4dcef 100644 --- a/rules/prefer-type-error.js +++ b/rules/prefer-type-error.js @@ -144,6 +144,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce throwing `TypeError` in type checking conditions.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/prevent-abbreviations.js b/rules/prevent-abbreviations.js index 661e0a5af9..cb10e1324d 100644 --- a/rules/prevent-abbreviations.js +++ b/rules/prevent-abbreviations.js @@ -637,6 +637,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Prevent abbreviations.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/relative-url-style.js b/rules/relative-url-style.js index b1b2e83123..7236dd28ef 100644 --- a/rules/relative-url-style.js +++ b/rules/relative-url-style.js @@ -159,6 +159,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce consistent relative URL style.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/require-array-join-separator.js b/rules/require-array-join-separator.js index bceb236e11..90f17098c1 100644 --- a/rules/require-array-join-separator.js +++ b/rules/require-array-join-separator.js @@ -56,6 +56,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce using the separator argument with `Array#join()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/require-number-to-fixed-digits-argument.js b/rules/require-number-to-fixed-digits-argument.js index a9e2ed4026..1eb88dbbdd 100644 --- a/rules/require-number-to-fixed-digits-argument.js +++ b/rules/require-number-to-fixed-digits-argument.js @@ -47,6 +47,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce using the digits argument with `Number#toFixed()`.', + recommended: true, }, fixable: 'code', messages, diff --git a/rules/require-post-message-target-origin.js b/rules/require-post-message-target-origin.js index 981aa6e08d..1a6734e70b 100644 --- a/rules/require-post-message-target-origin.js +++ b/rules/require-post-message-target-origin.js @@ -64,6 +64,7 @@ module.exports = { type: 'problem', docs: { description: 'Enforce using the `targetOrigin` argument with `window.postMessage()`.', + recommended: false, }, hasSuggestions: true, messages, diff --git a/rules/string-content.js b/rules/string-content.js index 39d99b9627..66f998b565 100644 --- a/rules/string-content.js +++ b/rules/string-content.js @@ -179,6 +179,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce better string content.', + recommended: false, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/switch-case-braces.js b/rules/switch-case-braces.js index 6dd094e4c1..530bc0e0d7 100644 --- a/rules/switch-case-braces.js +++ b/rules/switch-case-braces.js @@ -101,6 +101,7 @@ module.exports = { type: 'layout', docs: { description: 'Enforce consistent brace style for `case` clauses.', + recommended: true, }, fixable: 'code', schema: [{enum: ['always', 'avoid']}], diff --git a/rules/template-indent.js b/rules/template-indent.js index 560fd36e03..f46ee5e92e 100644 --- a/rules/template-indent.js +++ b/rules/template-indent.js @@ -211,6 +211,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Fix whitespace-insensitive template indentation.', + recommended: true, }, fixable: 'code', schema, diff --git a/rules/text-encoding-identifier-case.js b/rules/text-encoding-identifier-case.js index 21729ab32b..992c310859 100644 --- a/rules/text-encoding-identifier-case.js +++ b/rules/text-encoding-identifier-case.js @@ -100,6 +100,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Enforce consistent case for text encoding identifiers.', + recommended: true, }, fixable: 'code', hasSuggestions: true, diff --git a/rules/throw-new-error.js b/rules/throw-new-error.js index 2815f98691..5c509795cb 100644 --- a/rules/throw-new-error.js +++ b/rules/throw-new-error.js @@ -39,6 +39,7 @@ module.exports = { type: 'suggestion', docs: { description: 'Require `new` when creating an error.', + recommended: true, }, fixable: 'code', messages, diff --git a/scripts/template/rule.js.jst b/scripts/template/rule.js.jst index 90afdc6da3..eb3ae562e5 100644 --- a/scripts/template/rule.js.jst +++ b/scripts/template/rule.js.jst @@ -63,6 +63,7 @@ module.exports = { type: '<%= type %>', docs: { description: '<%= description %>', + recommended: true, }, <% if (fixableType) { %>fixable: '<%= fixableType %>',<% } %> <% if (hasSuggestions) { %>hasSuggestions: true,<% } %> diff --git a/test/package.mjs b/test/package.mjs index ebe78b6d32..2c27a25ba4 100644 --- a/test/package.mjs +++ b/test/package.mjs @@ -192,3 +192,21 @@ test('flat configs', t => { {...eslintPluginUnicorn.configs['flat/all'], plugins: undefined}, ); }); + +test('rule.meta.docs.recommended should be synchronized with presets', t => { + for (const [name, rule] of Object.entries(eslintPluginUnicorn.rules)) { + if (deprecatedRules.includes(name)) { + continue; + } + + const {recommended} = rule.meta.docs; + t.is(typeof recommended, 'boolean', `meta.docs.recommended in '${name}' rule should be a boolean.`); + + const severity = eslintPluginUnicorn.configs.recommended.rules[`unicorn/${name}`]; + if (recommended) { + t.is(severity, 'error', `'${name}' rule should set to 'error'.`); + } else { + t.is(severity, 'off', `'${name}' rule should set to 'off'.`); + } + } +});