Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
enum Vegetable {
Asparagus = 'asparagus',
Broccoli = 'broccoli',
}
declare let vegetable: Vegetable;
if (vegetable === 'asparagus') {
// do something
}
if (vegetable === 'broccoli') {
// do something
}
switch (vegetable) {
case 'asparagus':
// do something
break;
case 'broccoli':
// do something
break;
}
ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/no-unsafe-enum-comparison": "error"
}
}
tsconfig
Expected Result
I would expect ESLint to error on comparisons in the switch
statement, because those comparisons look similar to the ones in the if...else
statements.
Actual Result
ESLint reports errors only for comparisons of the if...else
statements.
Additional Info
Might be I missed something. Could not find anything similar in the issues, so opening this one for discussion.