import-js / import-js/eslint-plugin-import
import/namespace should consider pkg.module
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
I am using:
* eslint: v7.6.0
* babel-eslint: 11.0.0-beta.2
* eslint-plugin-import: 2.22.0
sourcecode:
```js
import { Provider } from 'react-redux'
```
output:
```bash
10:26 error Parse errors in imported module 'react-redux': No Babel config file detected for /Users/weiran/repo/react-app/node_modules/react-redux/es/index.js. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files. (undefined:undefined) import/namespace
```
I've reread the import/namespace docs:
> Note: for packages, the plugin will find exported names from jsnext:main, if present in package.json. Redux's npm module includes this key, and thereby is lintable, for example.
but seems `react-redux` is using `pkg.module`, instead of `jsnext:main`. any reasons not to honor `pkg.module`?
Contributor guide
Research direction
Start with the import/namespace rule and its package resolution behavior, then inspect the package.json fields mentioned in the issue, especially jsnext:main and module. Reproduce the react-redux example and verify that the rule no longer reports the Babel configuration error when the module field is used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100