import-js / import-js/eslint-plugin-import
[Feature request] import/no-same-package-import
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Refactoring some code today in a package called 'our-utils' I noticed one of the files in that package was importing like:
```js
import { someDep } from 'our-utils';
```
Now in reality, `someDep` was in a file adjacent to the one we were working in, and the optimal import would be, in my view:
```js
import { someDep } from '.';
```
Is there any rule already that does this? I don't think so, but maybe I overlooked one. This would be like the `import/no-self-import` rule, but working on entire packages rather than single files.
Contributor guide
Research direction
Start with the existing import/no-self-import rule mentioned in the issue and inspect how it determines the current import target. Define the package-level behavior for imports like `our-utils`, add coverage for the adjacent-module example, and confirm the new rule reports only the intended cases.
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
- Mostly clear
- Newbie friendliness
- 35/100