Skip to content

leondreamed-archives/vue-consistent-type-import-bug

Repository files navigation

Vue & @typescript-eslint/consistent-type-imports Bug

Repro

Clone this repo and run ESLint:

git clone https://github.com/leonzalion/vue-consistent-type-import-bug
cd vue-consistent-type-import-bug
npm install
npm run lint

You should get the following lint error:

  3:1  error  All imports in the declaration are only used as types. Use `import type`  @typescript-eslint/consistent-type-imports

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

When using the Component solely as a type in the <script> section (even though you want to use it in the <template>), TypeScript ESLint's @typescript-eslint/consistent-type-imports rule tries to replace it with an import type import, which breaks the import since it's compiled away:

Without import type: Without import type

With import type: With import type

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published