Open
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
{
"rules": {
"no-fallthrough": [2]
}
}
declare const n: { a: 1; b: 1 | 2 } | { a: 2 };
(() => {
switch (n.a) {
case 1: {
switch (n.b) {
case 1:
return 1;
case 2:
return 1;
}
}
// ESLint error:
// Expected a 'break' statement before 'case'.
case 2: {
return 2;
}
}
})();
Expected Result
No lint error
Actual Result
Lint error (see comment)
Additional Info
I think the TS ESLint plugin needs to provide its own version of no-fallthrough
in order to take advantage of type information so we can avoid false positives such as this.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
latest |
@typescript-eslint/parser |
latest |
TypeScript |
latest |
ESLint |
latest |
node |
latest |