From 52421fa037b543366dcd80eef144cf0618dc7beb Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 10 Feb 2023 13:25:37 -0800 Subject: [PATCH 1/2] docs: Add explanation of when to use 'warn' severity Fixes #16754 Closes #16753 --- docs/src/use/configure/rules.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/src/use/configure/rules.md b/docs/src/use/configure/rules.md index fd661063fbb..0c4d51e37ef 100644 --- a/docs/src/use/configure/rules.md +++ b/docs/src/use/configure/rules.md @@ -20,6 +20,10 @@ To change a rule's severity, set the rule ID equal to one of these values: * `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code) * `"error"` or `2` - turn the rule on as an error (exit code is 1 when triggered) +Rules are typically set to `"error"` to enforce compliance with the rule during continuous integration testing, precommit checks, and pull request merging because doing so causes ESLint to exit with a non-zero exit code. + +If you don't want to enforce compliance with a rule but would still like ESLint to report the rule's violations, set the severity to `"warn"`. This is typically used when introducing a new rule that will eventually be set to `"error"`, when a rule is flagging something other than a potential buildtime or runtime error (such as an unused variable), or when a rule cannot determine with certainty that a problem has been found (when a rule might have false positives and need manual review). + ### Using configuration comments To configure rules inside of a file using configuration comments, use a comment in the following format: From 93f317e739cab4da9b3bc4bf289683774718715a Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 13 Feb 2023 12:43:55 -0800 Subject: [PATCH 2/2] Update docs/src/use/configure/rules.md Co-authored-by: Nitin Kumar --- docs/src/use/configure/rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/use/configure/rules.md b/docs/src/use/configure/rules.md index 0c4d51e37ef..fd93c2919a0 100644 --- a/docs/src/use/configure/rules.md +++ b/docs/src/use/configure/rules.md @@ -20,7 +20,7 @@ To change a rule's severity, set the rule ID equal to one of these values: * `"warn"` or `1` - turn the rule on as a warning (doesn't affect exit code) * `"error"` or `2` - turn the rule on as an error (exit code is 1 when triggered) -Rules are typically set to `"error"` to enforce compliance with the rule during continuous integration testing, precommit checks, and pull request merging because doing so causes ESLint to exit with a non-zero exit code. +Rules are typically set to `"error"` to enforce compliance with the rule during continuous integration testing, pre-commit checks, and pull request merging because doing so causes ESLint to exit with a non-zero exit code. If you don't want to enforce compliance with a rule but would still like ESLint to report the rule's violations, set the severity to `"warn"`. This is typically used when introducing a new rule that will eventually be set to `"error"`, when a rule is flagging something other than a potential buildtime or runtime error (such as an unused variable), or when a rule cannot determine with certainty that a problem has been found (when a rule might have false positives and need manual review).