From 36848871af08967d04b457582ebe60a2ff72bdfb Mon Sep 17 00:00:00 2001 From: Maritaria Date: Sun, 16 Oct 2022 09:54:26 +0200 Subject: [PATCH] docs: Add heading to justification explanation Places the documentation related to justifications (on comment directives) in its own section so it may be more easily found from the table of contents. Fixes #16426 --- docs/src/user-guide/configuring/rules.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/src/user-guide/configuring/rules.md b/docs/src/user-guide/configuring/rules.md index e504a53198e..cae2b403c2c 100644 --- a/docs/src/user-guide/configuring/rules.md +++ b/docs/src/user-guide/configuring/rules.md @@ -232,6 +232,10 @@ foo(); // eslint-disable-line example/rule-name foo(); /* eslint-disable-line example/rule-name */ ``` +**Note:** Comments that disable warnings for a portion of a file tell ESLint not to report rule violations for the disabled code. ESLint still parses the entire file, however, so disabled code still needs to be syntactically valid JavaScript. + +#### Documenting justification + Configuration comments can include descriptions to explain why the comment is necessary. The description must come after the configuration and needs to be separated from the configuration by two or more consecutive `-` characters. For example: ```js @@ -245,8 +249,6 @@ console.log('hello'); console.log('hello'); ``` -**Note:** Comments that disable warnings for a portion of a file tell ESLint not to report rule violations for the disabled code. ESLint still parses the entire file, however, so disabled code still needs to be syntactically valid JavaScript. - ### Using configuration files To disable rules inside of a configuration file for a group of files, use the `overrides` key along with a `files` key. For example: