From adc8fa88c9f223b984a3519ed159a055bf933b18 Mon Sep 17 00:00:00 2001 From: Anix Date: Sun, 5 Apr 2020 01:40:38 +0530 Subject: [PATCH] Docs: clarify exceptions in spaced-comment (fixes #13032) (#13126) * Docs: update exception details to cover newline issue (fixes #13032) * Docs: refactore explaination and added example * chore: changed explaination * Chore: change from 'line' to 'block' docs eg --- docs/rules/spaced-comment.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/rules/spaced-comment.md b/docs/rules/spaced-comment.md index 3d0a5d9a90b..5a885f9821b 100644 --- a/docs/rules/spaced-comment.md +++ b/docs/rules/spaced-comment.md @@ -21,7 +21,7 @@ The rule takes two options. * This rule can also take a 2nd option, an object with any of the following keys: `"exceptions"` and `"markers"`. - * The `"exceptions"` value is an array of string patterns which are considered exceptions to the rule. + * The `"exceptions"` value is an array of string patterns which are considered exceptions to the rule. The rule will not warn when the pattern starts from the beginning of the comment and repeats until the end of the line or `*/` if the comment is a single line comment. Please note that exceptions are ignored if the first argument is `"never"`. ``` @@ -175,6 +175,12 @@ Examples of **incorrect** code for this rule with the `"always"` option combined /*-+-+-+-+-+-+-+*/ ``` +```js +/* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */ + +/******** COMMENT *******/ +``` + Examples of **correct** code for this rule with the `"always"` option combined with `"exceptions"`: ```js @@ -221,6 +227,16 @@ Examples of **correct** code for this rule with the `"always"` option combined w /*-+-+-+-+-+-+-+*/ ``` +```js +/* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */ + +/***************/ + +/******** +COMMENT +*******/ +``` + ### markers Examples of **incorrect** code for this rule with the `"always"` option combined with `"markers"`: