import-js/eslint-plugin-import

Is any way for use Webpack alias like internal path?

Ouverte

#1 306 ouverte le 21 mars 2019

 (9 commentaires) (9 réactions) (0 personne assignée)JavaScript (1 549 forks)batch import
help wantedimport/export ordering

Métriques du dépôt

Stars
 (5 940 étoiles)
Métriques de merge PR
 (Merge moyen 138j 22h) (3 PRs mergées en 30 j)

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)|(@+\/)|(~+\/)/;

Guide contributeur