import-js / import-js/eslint-plugin-import

[Feature request] import/no-same-package-import

Open
#2,134 6 comments 0 reactions 0 assignees View on GitHub
enhancement package: resolver/node resolver
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.