-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intendedIssues that are closed as they are working as intended
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
I couldn't attach a playground link because I needed two code source files for the case (to import one from the other) - only one is created in the sandbox...
Related links
Repro Code
enum.ts
export enum DATA_TYPE {
First = 0,
Second = 1,
}index.ts
import type { DATA_TYPE } from './enums';
export function test(type: DATA_TYPE) {
switch (type) {
case 0: { throw new Error('Not implemented yet: 0 case') }
case 1: { throw new Error('Not implemented yet: 1 case') }
default:
}
}ESLint Config
const {
defineConfig,
} = require("eslint/config");
const tsParser = require("@typescript-eslint/parser");
const typescriptEslintEslintPlugin = require("@typescript-eslint/eslint-plugin");
module.exports = defineConfig([{
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
},
},
plugins: {
"@typescript-eslint": typescriptEslintEslintPlugin,
},
files: ["**/*.ts"],
"rules": {
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/switch-exhaustiveness-check": ["error"],
},
}]);tsconfig
Expected Result
success
Actual Result
4:11 error Switch is not exhaustive. Cases not matched: DATA_TYPE.First | DATA_TYPE.Second @typescript-eslint/switch-exhaustiveness-check
✖ 1 problem (1 error, 0 warnings)Additional Info
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginworking as intendedIssues that are closed as they are working as intendedIssues that are closed as they are working as intended
{ "include": ["*.ts"], "compilerOptions": { "strictNullChecks": true } }