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

Is any way for use Webpack alias like internal path?

Open
#1,306 9 comments 9 reactions 0 assignees View on GitHub
help wanted import/export ordering
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md

Seems that only paths like 'src/foo' interpretated like internal.
But if you use Webpack, you can define some "path alias" (in 90% ways it's like '@/....', or '~/....'. It used in many boilerplates). Is there any ways for use Webpack alias as internal? I found only one solutions:
```
node_modules/eslint-plugin-import/lib/core/importType.js
// change
const externalModuleRegExp = /^\w/;
// to
const externalModuleRegExp = /^(\w)|(@+\/)|(~+\/)/;
```

Contributor guide

Open the contributing guide

Research direction

The rule documentation is at docs/rules/order.md, and the current classification logic is in lib/core/importType.js. Read those first to understand how imports such as src/foo are classified and how Webpack aliases should be represented; done means aliases like @/... or ~/... are treated as internal by the order rule without editing installed package code.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, webpack
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.