From a9c1e9e5b06de14d36b86a97ac08d78675a7069e Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 19 Oct 2021 10:30:02 -0400 Subject: [PATCH 1/2] Docs: Clarify rationale for `consistent-output` rule --- docs/rules/consistent-output.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/rules/consistent-output.md b/docs/rules/consistent-output.md index 9e110a06..4638958b 100644 --- a/docs/rules/consistent-output.md +++ b/docs/rules/consistent-output.md @@ -2,11 +2,11 @@ ✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. -When writing tests for a fixable rule with `RuleTester`, you can assert the autofix output of your test cases. However, it can be easy to forget to assert the output of a particular test case. +When writing tests for fixable rules, it's 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`. -[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. +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. -Even test that do not trigger an autofix can benefit from asserting that they have no autofix using `output: null`. +[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. ## Rule Details From 4f5df3a10b936a4490a3b132c87272eecc3f11a1 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 19 Oct 2021 10:39:58 -0400 Subject: [PATCH 2/2] Update docs/rules/consistent-output.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 唯然 --- docs/rules/consistent-output.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rules/consistent-output.md b/docs/rules/consistent-output.md index 4638958b..a6d88583 100644 --- a/docs/rules/consistent-output.md +++ b/docs/rules/consistent-output.md @@ -2,7 +2,7 @@ ✔️ The `"extends": "plugin:eslint-plugin/recommended"` property in a configuration file enables this rule. -When writing tests for fixable rules, it's 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`. +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.