-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancement: new base rule extensionNew base rule extension required to handle a TS specific caseNew base rule extension required to handle a TS specific casepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
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 |
BobNobrain, pocka, georgefst, lensbart, dani-mp and 13 moreuhyo and JonasKellerer
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancement: new base rule extensionNew base rule extension required to handle a TS specific caseNew base rule extension required to handle a TS specific casepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin