import-js / import-js/eslint-plugin-import
How to use import/named to detect non-existent imports from monorepo packages?
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Of course, using TypeScript can avoid the need for this - but for modules that are still JS-only, how can we detect instances of importing named exports which don't exist?
The docs seem to suggest that if the module you're importing from either uses `import` or `export` then it should work - or maybe if it defines a `module` field in `package.json` - but none of these seem to work and imports of non-existent names are not flagged.
It also mentions:
> Redux's npm module includes this key, and thereby is lintable, for example.
But this doesn't appear to be the case. I even tried manually specifying `jsnext:main` in the `package.json` but no difference.
I also tried with our monorepo's `packages` folder included under `import/external-module-folders` or not; again, no difference.
Is this the intended behavior?
Contributor guide
Research direction
Start with the import/named rule and its documentation, then review how package.json fields and import/external-module-folders affect resolution. Reproduce the behavior with the monorepo packages folder and the Redux example mentioned in the issue. Done means determining whether missing named exports should be flagged and updating the behavior or documentation accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100