Skip to content

Commit

Permalink
docs: add 'when not to use it' section in no-duplicate-case docs (#15563
Browse files Browse the repository at this point in the history
)

Fixes #15552
  • Loading branch information
mdjermanovic committed Feb 2, 2022
1 parent 1ad439e commit a8dd5a2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/rules/no-duplicate-case.md
Expand Up @@ -91,3 +91,18 @@ switch (a) {
break;
}
```

## When Not To Use It

In rare cases where identical test expressions in `case` clauses produce different values, which necessarily means that the expressions are causing and relying on side effects, you will have to disable this rule.

```js
switch (a) {
case i++:
foo();
break;
case i++: // eslint-disable-line no-duplicate-case
bar();
break;
}
```

0 comments on commit a8dd5a2

Please sign in to comment.