qwik
qwik copied to clipboard
fix:consistent type imports warning
What is it?
- [x] Feature / enhancement
- [ ] Bug
- [ ] Docs / tests
Description
fix consistent type import warning
Run & review this pull request in StackBlitz Codeflow.
Thanks @harshmangalam for taking the time to create this PR 🙏
May i ask what the motivation for the made changes is? As far as i know, we shouldn't use type imports when ever possible which covers with the statement of andrewbranch (member of the typescript team) as he stated here https://github.com/microsoft/TypeScript/issues/39861#issuecomment-668131921.
Many thanks for a quick reply and for your help pushing qwik forward 🙏
Vs code warn when we import type without type keyword.
Wow thanks a lot for the quick reply 🔥 🙏
I just checked it on latest main branch on my side vscode doesn't complain about it on the imports 🙈

tsc: 4.9.5
Your eslint is disabled hence you are not getting any warning.

Typescript v4.9.5
Thanks again for your feedback 🙏
My eslint is working and reports all issues as it should except the one you refer here 🙈
The mentioned rule @typescript-eslint/consistent-type-imports is not part of the recommended config of @[email protected] which is used on the default generated .eslintrc.cjs nor in any other referenced configs/inline config sets.
these presets are defined and as far as i can see non of them have the rule included 🙈 (pls correct me if i am wrong 🙏 )
eslint:recommended: https://github.com/eslint/eslint/blob/main/conf/eslint-recommended.js@typescript-eslint/recommended: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.tsqwik/recommended: https://github.com/BuilderIO/qwik/blob/main/packages/eslint-plugin-qwik/index.ts
can it be, that you use a global version of eslint in vscode which uses another config file? maybe we can get a step further when you do these steps on your app:
- run
pnpm lint(or npm / yarn) 😄 - if the error is reported proceed, otherwise vscode uses another config
- replace the
lintscript within thepackage.jsonfile with"lint": "eslint src/**/*.ts* --debug" - search in the generated output for
eslintrc:config-array-factory Loading JS config fileand check if your root file is used - search also for
consistent-type-imports
would be very interested to hear what the outcome of this is 🙏 thanks again for your help!
@zanettin got your points.
Hi @harshmangalam Just wanted to ask if you already had the time to check, where this rule is coming from 👼 Would be very interested to hear what the outcome is. Thanks again 🙏
Hey I follow your process now everything is working fine.
So glad to hear 🙏 Thanks anyways for creating this PR and doing the debugging! hope to see soooonish another PR from you 😃