import-js / import-js/eslint-plugin-import
import/order: unresolved imports affecting the other
- 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
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