[consistent-type-imports] Using with --fix changes constructor imports to type imports in nest and angular #3630
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
enhancement
New feature or request
package: parser
Issues related to @typescript-eslint/parser
Repro
https://github.com/yharaskrik/eslint-type-import-repro
yarn nx affected:lint --fix
Expected Result
I would expect that concrete classes that are needed for dependency injection,
ClassType
, would be left as non-type imports and the types that are not needed to be concrete are changed to type only imports,InterfaceType
. I realize this is probably framework dependant since not everything uses DI and needs concrete classes at runtime.Actual Result
As it stands the imports in
app.service.ts
are not using type imports. when runningyarn nx affected:lint --fix
(which uses eslint and @typescript-eslint under the hood) it changes the import toimport type { ClassType, InterfaceType } from './type';
which then breaks the nest server as theClassType
is a concrete class that is needed for dependency injection.Versions
@typescript-eslint/eslint-plugin
^4.28.2
@typescript-eslint/parser
^4.28.2
TypeScript
~4.2.4
ESLint
7.22.0
node
12.22.1
The text was updated successfully, but these errors were encountered: