question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[no-extraneous-dependencies] improve validation of "import type"

See original GitHub issue

at 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:open
  • Created 2 years ago
  • Reactions:3
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ilyubcommented, Jul 8, 2021

+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.

1reaction
ljharbcommented, May 5, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found