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

import/order: unresolved imports affecting the other

Open
#957 5 comments 1 reaction 0 assignees View on GitHub
import/export ordering
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Unresolved imports automatically get "NaN" rank and also take part in finding out order violations.

Config:
```json
{
"rules": {
"import/order": ["error", {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"newlines-between": "ignore"
}]
}
```

Example 1.
```js
import a from "a.js"; //external import
import b from "b.js";
import d from "../d.js";
import e from "./e.js";
import c from "src/c.js"; //eslint-error
```

Example 2.
```js
import a from "~/a.js"; //unresolved import
import b from "b.js";
import d from "../d.js";
import e from "./e.js";
import c from "src/c.js"; //no error
```

In the first example you may see that the order of imports is violated, because _external_ import **c** goes after _parent_ **d**. In the second one **a** becomes an unresolved due to _~_ sign and starts interfering to plugin work.

I would say that unresolved imports should be ignored from the ordering process.

Contributor guide

Open the contributing guide

Research direction

Start at the import/order rule and trace how unresolved imports are classified during ordering. Reproduce both configurations from the issue, then verify that unresolved imports no longer affect order violations while resolved imports retain their expected ordering behavior.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.