You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[no-useless-token-range](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-useless-token-range.md) | ✔️ | 🛠 | | disallow unnecessary calls to `sourceCode.getFirstToken()` and `sourceCode.getLastToken()`
76
76
[prefer-message-ids](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-message-ids.md) | ✔️ | | | require using `messageId` instead of `message` to report rule violations
77
-
[prefer-object-rule](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-object-rule.md) | ✔️ | 🛠 | | disallow rule exports where the export is a function
[prefer-output-null](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-output-null.md) | ✔️ | 🛠 | | disallow invalid RuleTester test cases where the `output` matches the `code`
79
79
[prefer-placeholders](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-placeholders.md) | | | | require using placeholders for dynamic report messages
80
80
[prefer-replace-text](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/prefer-replace-text.md) | | | | require using `replaceText()` instead of `replaceTextRange()`
Copy file name to clipboardExpand all lines: docs/rules/consistent-output.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Enforce consistent use of `output` assertions in rule tests (consistent-output)
2
2
3
-
When writing tests for fixable rules, it's a best practice to use the `output` property on each test case to assert what autofixed code is produced, or to assert that no autofix is produced using `output: null`.
3
+
When writing tests for fixable rules, the `output` property on each test case can be used to assert what autofixed code is produced, or to assert that no autofix is produced using `output: null`.
4
4
5
5
Prior to ESLint 7, it was easy to forget to assert the autofix output of a particular test case, resulting in incomplete test coverage and a greater chance of unexpected behavior / bugs.
6
6
7
-
[As of ESLint 7](https://eslint.org/docs/user-guide/migrating-to-7.0.0#additional-validation-added-to-the-ruletester-class), test cases that trigger an autofix are required to provide the `output` property.
7
+
[As of ESLint 7](https://eslint.org/docs/user-guide/migrating-to-7.0.0#additional-validation-added-to-the-ruletester-class), test cases that trigger an autofix are required by ESLint to provide the `output` property. Thus, it's now acceptable and more concise to omit this property when there's no autofix.
8
8
9
9
## Rule Details
10
10
@@ -69,6 +69,8 @@ This rule takes an optional string enum option with one of the following values:
69
69
70
70
If you're not writing fixable rules, or you want to write test cases without output assertions, do not enable this rule.
71
71
72
+
As mentioned in the introduction, the need for this rule is reduced as of ESLint v7.
Copy file name to clipboardExpand all lines: docs/rules/no-identical-tests.md
+26-9
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,34 @@
4
4
5
5
⚒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
6
6
7
-
When a rule has a lot of tests, it's sometimes difficult to tell if any tests are duplicates. This rule would warn if any test cases have the same properties.
7
+
Duplicate test cases can cause confusion, can be hard to detect manually in a long file, and serve no purpose.
8
+
9
+
As of [ESLint v9](https://github.com/eslint/rfcs/tree/main/designs/2021-stricter-rule-test-validation#disallow-identical-test-cases), ESLint attempts to detect and disallow duplicate tests.
✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule.
4
4
5
5
⚒️ The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#--fix) can automatically fix some of the problems reported by this rule.
6
6
7
+
Prior to ESLint v9, ESLint supported both [function-style](https://eslint.org/docs/developer-guide/working-with-rules-deprecated) and [object-style](https://eslint.org/docs/developer-guide/working-with-rules) rules. However, function-style rules have been deprecated since 2016, and do not support newer features like autofixing and suggestions.
8
+
9
+
As of [ESLint v9](https://github.com/eslint/rfcs/tree/main/designs/2021-schema-object-rules#motivation-for-requiring-object-style-rules), ESLint supports only object-style rules.
10
+
7
11
## Rule Details
8
12
9
-
The rule reports an error if it encounters a rule that's defined using the [deprecated style](https://eslint.org/docs/developer-guide/working-with-rules-deprecated) of just a `create`function instead of the newer [object style](https://eslint.org/docs/developer-guide/working-with-rules).
13
+
The rule reports an error if it encounters a rule that's defined using the deprecated function-style format.
Copy file name to clipboardExpand all lines: docs/rules/require-meta-schema.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@
4
4
5
5
💡 Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
6
6
7
-
Defining a schema for each rule allows eslint to validate that configuration options are passed correctly. Even when there are no options for a rule, a schema should still be defined (as an empty array) so that eslint can validate that no data is mistakenly passed to the rule.
7
+
Defining a schema for each rule allows eslint to validate that configuration options are passed correctly. Even when there are no options for a rule, a schema can still be defined as an empty array to validate that no data is mistakenly passed to the rule.
8
+
9
+
As of [ESLint v9](https://github.com/eslint/rfcs/tree/main/designs/2021-schema-object-rules#motivation-for-requiring-schemas), ESLint will validate that options are not provided to a rule when a schema is omitted.
8
10
9
11
## Rule Details
10
12
@@ -75,6 +77,10 @@ This rule takes an optional object containing:
75
77
76
78
*`boolean` — `requireSchemaPropertyWhenOptionless` — Whether the rule should require the `meta.schema` property to be specified (with `schema: []`) for rules that have no options. Defaults to `true`.
77
79
80
+
## When Not To Use It
81
+
82
+
As mentioned in the introduction, the need for this rule is reduced as of ESLint v9.
0 commit comments