import-js / import-js/eslint-plugin-import
[import/no-extraneous-dependencies]: needs all package files to be build first to properly process dependencies
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
within our monorepo we run `lint` on packages without need to have all packages build first, for performance and simplicity reasons.
Recently our releases started to fail because `import/no-extraneous-dependencies` issues.
Our release pipeline runs build first then lint ( on PR bases we run lint and build in parallel ).
## issue with this rule
My naive understanding of how this rule works was that it processes package.json deps and evaluates import token names from source within AST.
I was bit surprised that after some amount of investigation I found out that this rule **relies on package assets to be build first(physically present)** as it uses resolve on real filesystem approach https://github.com/import-js/eslint-plugin-import/blob/main/src/rules/no-extraneous-dependencies.js#L195. I understand there is some more things going on with aliases to properly work with some edge-case scenarios.
We need to be able to run lint without a need to build things first (this plugin is now the only blocker).
Naive approach to make this work would be to remove the physical resolution and module traversing completely or to provide a configuration to the rule that can disable this behaviour.
Would love to hear maintainers thoughts in order how we should unblock ourselves.
cheers 🙌
Contributor guide
Research direction
Start with src/rules/no-extraneous-dependencies.js around the filesystem resolution referenced in the issue. Trace how package assets are resolved and review the rule's existing tests before deciding whether configuration or another behavior is appropriate. Done means linting can run before dependent packages are built without incorrectly reporting dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100