[no-extraneous-dependencies] improve validation of "import type"
See original GitHub issueat the moment if I do this rule is not checking dependency:
import type {TypeA} from 'ModuleA'
would be nice if such import would be checked against combination of dev and prod dependencies.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Allow no-extraneous-dependencies to check internal Imports ...
What I would like to see is to add an option to no-extraneous-dependencies to allow it to check internal imports based on a...
Read more >Why (and How Can I FIx) ESLint import/no-extraneous ...
Run 'npm i -S joi' to add it import/no-extraneous-dependencies 2:16 error 'lodash' should be listed in the project's dependencies.
Read more >eslint-plugin-import - Bountysource
ESLint plugin with rules that help validate proper imports. Become a Bounty Hunter
Read more >CSV import validator does not validate required fields that ...
Steps to Reproduce · Configure a required field for an issue type in a project · Build a CSV to import that issue...
Read more >@lingui/macro - Reference — LinguiJS documentation
You always use familiar JS and JSx code. Components and functions are type checked. Additional validation of plural rules is performed during transformation....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1 for an option “alsoCheckTypeDependencies” or additional rule “noExtraneousTypeImports” with same options as “noExtraneousImports”.
Typescript libraries are usually distributed as .js + .d.ts.
If your .ts file imports types from package A and consuming project does not have package A, it will fail to understand types defined in .d.ts.
So, even if you only import types from package A you may need to add it to dependencies or peer dependencies.
Sonarqube does not ignore type import by the way.
While I think that’s the common case, we couldn’t just impose that on everyone - you’d need to be able to opt in to it somehow.