-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
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
const customId = 'id1';
enum CustomIds {
Id1 = 'id1',
Id2 = 'id2',
}
const compareNoToString = customId === CustomIds.Id1;
const compareWithToString = customId === CustomIds.Id1.toString();ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unnecessary-type-conversion": "error",
"@typescript-eslint/no-unsafe-enum-comparison": "error"
},
};tsconfig
Expected Result
No collision with rules...
Actual Result
Line 9 shows what happens when you do not include .toString() resulting in @typescript-eslint/no-unsafe-enum-comparison throwing...
Line 10 shows what happens when you do add .toString() to resolve the issue on line 9... resulting in @typescript-eslint/no-unnecessary-type-conversion throwing, which it wants the code from line 9.
Additional Info
Last week #11374 added @typescript-eslint/no-unnecessary-type-conversion to strict checks, which has resulted in a failure to build (dependabot) as I have @typescript-eslint/no-unsafe-enum-comparison set to error in my eslint config already.
ChrisMBarr
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
{ "compilerOptions": { "strictNullChecks": true } }