-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
bugSomething isn't workingSomething isn't workingpackage: 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": {
"@typescript-eslint/prefer-regexp-exec": "warn",
}
}// your repro code case
const docsExlusion = ['package-lock.json', /regexp/];
const file = '';
docsExclusions.some((ex) => !!file.match(ex)); // Use the `RegExp#exec()` method instead.{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": false,
"jsx": "preserve",
"lib": [
"dom",
"DOM.Iterable",
"esnext"
],
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitReturns": true,
"pretty": true,
"strict": true,
"target": "es2018",
"resolveJsonModule": true,
"experimentalDecorators": true,
"useDefineForClassFields": false,
"allowJs": false,
"skipLibCheck": true,
"composite": true,
"declarationMap": true
}
}Expected Result
No warning/error for this case when union type is present and autofix not applied.
Actual Result
Type of the variable is string | RegExp and rule reports warning to use RegExp method.
Additional Info
Versions
| package | version |
|---|---|
@typescript-eslint/eslint-plugin |
4.22.0 |
@typescript-eslint/parser |
4.22.0 |
TypeScript |
4.2.4 |
ESLint |
7.24.0 |
node |
15.11.0 |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin