diff --git a/README.md b/README.md index cbb6bd9b..eb6a8267 100644 --- a/README.md +++ b/README.md @@ -61,21 +61,21 @@ Here's an example ESLint configuration that: Name | ✔️ | 🛠 | 💡 | Description ----- | ----- | ----- | ----- | ----- -[consistent-output](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/consistent-output.md) | ✔️ | | | enforce consistent use of `output` assertions in rule tests +[consistent-output](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/consistent-output.md) | | | | enforce consistent use of `output` assertions in rule tests [fixer-return](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/fixer-return.md) | ✔️ | | | require fixer functions to return a fix [meta-property-ordering](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/meta-property-ordering.md) | | 🛠 | | enforce the order of meta properties [no-deprecated-context-methods](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-deprecated-context-methods.md) | ✔️ | 🛠 | | disallow usage of deprecated methods on rule context objects [no-deprecated-report-api](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-deprecated-report-api.md) | ✔️ | 🛠 | | disallow the version of `context.report()` with multiple arguments [no-identical-tests](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-identical-tests.md) | ✔️ | 🛠 | | disallow identical tests -[no-missing-message-ids](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-message-ids.md) | | | | disallow `messageId`s that are missing from `meta.messages` +[no-missing-message-ids](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-message-ids.md) | ✔️ | | | disallow `messageId`s that are missing from `meta.messages` [no-missing-placeholders](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-placeholders.md) | ✔️ | | | disallow missing placeholders in rule report messages [no-only-tests](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-only-tests.md) | ✔️ | | 💡 | disallow the test case property `only` -[no-unused-message-ids](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-unused-message-ids.md) | | | | disallow unused `messageId`s in `meta.messages` +[no-unused-message-ids](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-unused-message-ids.md) | ✔️ | | | disallow unused `messageId`s in `meta.messages` [no-unused-placeholders](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-unused-placeholders.md) | ✔️ | | | disallow unused placeholders in rule report messages [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()` -[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 +[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 [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` +[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` [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 [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()` [report-message-format](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/report-message-format.md) | | | | enforce a consistent format for rule report messages diff --git a/docs/rules/consistent-output.md b/docs/rules/consistent-output.md index a6d88583..d71abdd1 100644 --- a/docs/rules/consistent-output.md +++ b/docs/rules/consistent-output.md @@ -1,7 +1,5 @@ # Enforce consistent use of `output` assertions in rule tests (consistent-output) -✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. - 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`. 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. diff --git a/docs/rules/no-missing-message-ids.md b/docs/rules/no-missing-message-ids.md index 76ee3599..268c42b1 100644 --- a/docs/rules/no-missing-message-ids.md +++ b/docs/rules/no-missing-message-ids.md @@ -1,5 +1,7 @@ # Disallow `messageId`s that are missing from `meta.messages` (no-missing-message-ids) +✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. + When using `meta.messages` and `messageId` to report rule violations, it's possible to mistakenly use a `messageId` that doesn't exist in `meta.messages`. ## Rule Details diff --git a/docs/rules/no-unused-message-ids.md b/docs/rules/no-unused-message-ids.md index 758140ab..942d33d7 100644 --- a/docs/rules/no-unused-message-ids.md +++ b/docs/rules/no-unused-message-ids.md @@ -1,5 +1,7 @@ # Disallow unused `messageId`s in `meta.messages` (no-unused-message-ids) +✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. + When using `meta.messages` and `messageId` to report rule violations, it's possible to mistakenly leave a message in `meta.messages` that is never used. ## Rule Details diff --git a/docs/rules/prefer-message-ids.md b/docs/rules/prefer-message-ids.md index 4455df26..4f1696ce 100644 --- a/docs/rules/prefer-message-ids.md +++ b/docs/rules/prefer-message-ids.md @@ -1,5 +1,7 @@ # Require using `messageId` instead of `message` to report rule violations (prefer-message-ids) +✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. + When reporting a rule violation, it's preferred to provide the violation message with the `messageId` property instead of the `message` property. Message IDs provide the following benefits: * Rule violation messages can be stored in a central `meta.messages` object for convenient management diff --git a/docs/rules/prefer-output-null.md b/docs/rules/prefer-output-null.md index 31d6ceb6..e5e0a5de 100644 --- a/docs/rules/prefer-output-null.md +++ b/docs/rules/prefer-output-null.md @@ -1,5 +1,7 @@ # Disallow invalid RuleTester test cases where the `output` matches the `code` (prefer-output-null) +✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. + ⚒️ 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. Instead of repeating the test case `code`, using `output: null` is more concise and makes it easier to distinguish whether a test case provides an autofix. diff --git a/lib/rules/consistent-output.js b/lib/rules/consistent-output.js index 18ce2824..28d9679f 100644 --- a/lib/rules/consistent-output.js +++ b/lib/rules/consistent-output.js @@ -19,7 +19,7 @@ module.exports = { description: 'enforce consistent use of `output` assertions in rule tests', category: 'Tests', - recommended: true, + recommended: false, url: 'https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/consistent-output.md', }, fixable: null, // or "code" or "whitespace" diff --git a/lib/rules/no-missing-message-ids.js b/lib/rules/no-missing-message-ids.js index f10c9507..47cabd78 100644 --- a/lib/rules/no-missing-message-ids.js +++ b/lib/rules/no-missing-message-ids.js @@ -14,7 +14,7 @@ module.exports = { description: 'disallow `messageId`s that are missing from `meta.messages`', category: 'Rules', - recommended: false, + recommended: true, url: 'https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/no-missing-message-ids.md', }, fixable: null, diff --git a/lib/rules/no-unused-message-ids.js b/lib/rules/no-unused-message-ids.js index a1724a60..df793605 100644 --- a/lib/rules/no-unused-message-ids.js +++ b/lib/rules/no-unused-message-ids.js @@ -13,7 +13,7 @@ module.exports = { docs: { description: 'disallow unused `messageId`s in `meta.messages`', category: 'Rules', - recommended: false, + recommended: true, url: 'https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/no-unused-message-ids.md', }, fixable: null, diff --git a/lib/rules/prefer-message-ids.js b/lib/rules/prefer-message-ids.js index 9fca98a5..8d80860b 100644 --- a/lib/rules/prefer-message-ids.js +++ b/lib/rules/prefer-message-ids.js @@ -15,7 +15,7 @@ module.exports = { description: 'require using `messageId` instead of `message` to report rule violations', category: 'Rules', - recommended: false, + recommended: true, url: 'https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/prefer-message-ids.md', }, fixable: null, diff --git a/lib/rules/prefer-output-null.js b/lib/rules/prefer-output-null.js index 87fe877f..0716d91e 100644 --- a/lib/rules/prefer-output-null.js +++ b/lib/rules/prefer-output-null.js @@ -19,7 +19,7 @@ module.exports = { description: 'disallow invalid RuleTester test cases where the `output` matches the `code`', category: 'Tests', - recommended: false, + recommended: true, url: 'https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/tree/HEAD/docs/rules/prefer-output-null.md', }, fixable: 'code',