From d2255db24526de604b4a34e90c870158c4ea277e Mon Sep 17 00:00:00 2001 From: dosisod <39638017+dosisod@users.noreply.github.com> Date: Wed, 9 Mar 2022 03:37:49 -0800 Subject: [PATCH] docs: Add clarification about `eslint-enable` (#15680) * docs: Add clarification about eslint-enable rule: Fixes #15662 * Update docs/user-guide/configuring/rules.md * Update docs/user-guide/configuring/rules.md Co-authored-by: Nicholas C. Zakas Co-authored-by: Milos Djermanovic --- docs/user-guide/configuring/rules.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/user-guide/configuring/rules.md b/docs/user-guide/configuring/rules.md index c33a64ad4f2..205a5f11995 100644 --- a/docs/user-guide/configuring/rules.md +++ b/docs/user-guide/configuring/rules.md @@ -144,6 +144,8 @@ console.log('bar'); /* eslint-enable no-alert, no-console */ ``` +**Note:** `/* eslint-enable */` without any specific rules listed will cause all disabled rules to be re-enabled. + To disable rule warnings in an entire file, put a `/* eslint-disable */` block comment at the top of the file: ```js @@ -160,6 +162,14 @@ You can also disable or enable specific rules for an entire file: alert('foo'); ``` +To ensure that a rule is never applied (regardless of any future enable/disable lines): + +```js +/* eslint no-alert: "off" */ + +alert('foo'); +``` + To disable all rules on a specific line, use a line or block comment in one of the following formats: ```js