import-js / import-js/eslint-plugin-import
Incorrect import group for npm module and local file with same name in same folder
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
When I have a local file in the same folder with the same name of an npm module, the `import/order` rule detects the import group incorrectly.
My eslint rule config
'import/order': [
'error',
{
groups: [['builtin', 'external'], 'internal', 'parent', ['sibling', 'index']],
'newlines-between': 'always',
},
]
My folder structure:
api/
test,js
join-monster.js
join-monster is also a package installed in package.json
`test.js`
import { merge } from 'lodash';
import joinMonster from 'join-monster';
eslint gives this error
```
E:\Dropbox\Programming\evercare\api\src\app\api\test.js
1:1 error There should be at least one empty line between import groups import/order
```
I would expect that it should realize 'join-monster' refers to the npm module and './join-monster' refers to the local file.
Contributor guide
Research direction
Start with the import/order rule and reproduce the reported api/test.js layout, where join-monster.js sits beside the file and join-monster is also an npm package. Run ESLint with the shown configuration and verify that the package import is grouped as external while a relative local import remains local.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100