From 6735b7208e05db6aa4b46051b137fe45b577db54 Mon Sep 17 00:00:00 2001 From: Anix Date: Tue, 31 Mar 2020 11:31:09 +0000 Subject: [PATCH 1/4] Docs: update exception details to cover newline issue (fixes #13032) --- docs/rules/spaced-comment.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/rules/spaced-comment.md b/docs/rules/spaced-comment.md index 3d0a5d9a90b..c377a2a7cf3 100644 --- a/docs/rules/spaced-comment.md +++ b/docs/rules/spaced-comment.md @@ -22,7 +22,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. - Please note that exceptions are ignored if the first argument is `"never"`. + Please note that exceptions are ignored if the first argument is `"never"`. It starts from the beginning of the line and checks untill the end of line or `*/` if its in same line ``` "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }] @@ -175,6 +175,12 @@ Examples of **incorrect** code for this rule with the `"always"` option combined /*-+-+-+-+-+-+-+*/ ``` +```js +/* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["*"] } }] */ + +/******** COMMENT *******/ +``` + Examples of **correct** code for this rule with the `"always"` option combined with `"exceptions"`: ```js From bbc6cc6f6397b811ad480fbc4bf8f91f4b16c4c7 Mon Sep 17 00:00:00 2001 From: Anix Date: Wed, 1 Apr 2020 07:27:43 +0000 Subject: [PATCH 2/4] Docs: refactore explaination and added example --- docs/rules/spaced-comment.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/rules/spaced-comment.md b/docs/rules/spaced-comment.md index c377a2a7cf3..7549034d47f 100644 --- a/docs/rules/spaced-comment.md +++ b/docs/rules/spaced-comment.md @@ -21,8 +21,8 @@ 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. - Please note that exceptions are ignored if the first argument is `"never"`. It starts from the beginning of the line and checks untill the end of line or `*/` if its in same line + * 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 first line 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"` ``` "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }] @@ -227,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"`: From 1b554b6ab28d786c6c4de3a4638539e7f8a8eba6 Mon Sep 17 00:00:00 2001 From: Anix Date: Fri, 3 Apr 2020 06:58:51 +0000 Subject: [PATCH 3/4] chore: changed explaination --- docs/rules/spaced-comment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/rules/spaced-comment.md b/docs/rules/spaced-comment.md index 7549034d47f..46624aa5df2 100644 --- a/docs/rules/spaced-comment.md +++ b/docs/rules/spaced-comment.md @@ -21,8 +21,8 @@ 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 rule will not warn when the pattern starts from the beginning of the first line 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"` + * 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"`. ``` "spaced-comment": ["error", "always", { "exceptions": ["-", "+"] }] From 4fbd248aeb18e8a8a9d27eb4ed90d2d320db1381 Mon Sep 17 00:00:00 2001 From: Anix Date: Sat, 4 Apr 2020 04:02:07 +0000 Subject: [PATCH 4/4] Chore: change from 'line' to 'block' docs eg --- docs/rules/spaced-comment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rules/spaced-comment.md b/docs/rules/spaced-comment.md index 46624aa5df2..5a885f9821b 100644 --- a/docs/rules/spaced-comment.md +++ b/docs/rules/spaced-comment.md @@ -176,7 +176,7 @@ Examples of **incorrect** code for this rule with the `"always"` option combined ``` ```js -/* eslint spaced-comment: ["error", "always", { "line": { "exceptions": ["*"] } }] */ +/* eslint spaced-comment: ["error", "always", { "block": { "exceptions": ["*"] } }] */ /******** COMMENT *******/ ```