From d03a8bf8978bd330aeb951f18cc92bf1ad24eeec Mon Sep 17 00:00:00 2001 From: Maritaria Date: Mon, 31 Oct 2022 19:54:57 +0100 Subject: [PATCH] docs: Add heading to justification explanation (#16430) * 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 * Update docs/src/user-guide/configuring/rules.md Co-authored-by: Nicholas C. Zakas --- 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..cd3ee979bf8 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. + +#### Comment descriptions + 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: