import-js/eslint-plugin-import

Is any way for use Webpack alias like internal path?

開放

#1,306 建立於 2019年3月21日

 (9 則留言) (9 個反應) (0 位負責人)JavaScript (1,549 個分叉)batch import
help wantedimport/export ordering

倉庫指標

星標
 (5,940 顆星)
PR 合併指標
 (平均合併 138天 22小時) (30 天內合併 3 個 PR)

描述

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

貢獻者指南