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

How to make it recognise internal modules as not external?

Open
#3,040 1 comment 0 reactions 0 assignees View on GitHub
import/export ordering question
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I've got this:

```
"pathGroups": [
{
"pattern": "react",
"group": "external",
"position": "before"
},
{
"pattern": "{app,components,constants,context,generated,images,pages,shared,testing}/**",
"group": "internal",
"position": "after"
}
]
```
but for certain modules like `shared` I import like so `import { Button } from "shared"` so it think it's an external module. How can I get it to put all `shared` stuff within the internal category? I also have other packages like this (e.g. context) so I need a way of handling multiple.
The ultimate order I want is:

import react

import emotion

import components/something
import shared/button

import ./currentDir

Contributor guide

Open the contributing guide

Research direction

Start with the import-order configuration's pathGroups behavior, especially how bare imports such as "shared" are matched against the supplied glob pattern. Check the existing rule documentation and related tests for pathGroups and internal imports. Done means imports from shared, context, and the other listed aliases are grouped as internal in the requested order.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.