Bug: [consistent-type-imports] "used by decorator metadata" false positive for type used in constructor parameter #7327
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
package: scope-manager
Issues related to @typescript-eslint/scope-manager
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
When upgrading from typescript-eslint 5.x.x to 6.x.x I started seeing false positive errors "used by decorator metadata" for types that are used in constructor parameters, even if the class itself is not using any decorators at all.
So given these two files
we would expect no errors, as no decorators are involved in either file.
Instead we get an error reported for the import of
ClassA
:Reproduction Repository Link
https://github.com/mpotthoff/consistent-type-imports-decorator-bug
Repro Steps
npm install
npx eslint classB.ts
Versions
@typescript-eslint/eslint-plugin
6.2.0
@typescript-eslint/parser
6.2.0
@typescript-eslint/scope-manager
6.2.0
@typescript-eslint/typescript-estree
6.2.0
@typescript-eslint/type-utils
6.2.0
@typescript-eslint/utils
6.2.0
TypeScript
5.1.6
ESLint
8.45.0
node
18.16.1
The text was updated successfully, but these errors were encountered: