Skip to content

Commit a8dd5a2

Browse files
authoredFeb 2, 2022
docs: add 'when not to use it' section in no-duplicate-case docs (#15563)
Fixes #15552
1 parent 1ad439e commit a8dd5a2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎docs/rules/no-duplicate-case.md

+15
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,18 @@ switch (a) {
9191
break;
9292
}
9393
```
94+
95+
## When Not To Use It
96+
97+
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.
98+
99+
```js
100+
switch (a) {
101+
case i++:
102+
foo();
103+
break;
104+
case i++: // eslint-disable-line no-duplicate-case
105+
bar();
106+
break;
107+
}
108+
```

0 commit comments

Comments
 (0)
Please sign in to comment.