Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
anikethsaha committed Apr 4, 2020
1 parent a784dac commit adc8fa8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/rules/spaced-comment.md
Expand Up @@ -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"`.

```
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"`:
Expand Down

0 comments on commit adc8fa8

Please sign in to comment.