Closed
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
Minimal repo: arimah/typescript-eslint-no-unused-vars-issue-1
{
"parserOptions": {
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-unused-vars": "error"
}
}
function foo<T>(x: TemplateStringsArray, ...y: T[]) {
// (irrelevant code to get rid of unused variable warnings)
return [x, y];
}
interface FalsePositive { }
// ^^^^^^^^^^^^^ @typescript-eslint/no-unused-vars - false positive
foo<FalsePositive>``;
Expected Result
No lint error: the type is used as a template string type argument.
Actual Result
6:11 error 'FalsePositive' is defined but never used @typescript-eslint/no-unused-vars
Additional Info
False positive only occurs with "sourceType": "module"
. With that option unset, I can't reproduce the bug, even if I introduce an explicit export
or import
into the code.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
4.0.1 |
@typescript-eslint/parser |
4.0.1 |
TypeScript |
4.0.2 |
ESLint |
7.8.1 |
node |
12.16.1 |