Package Exports
- eslint-import-resolver-alias
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-import-resolver-alias) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
eslint-import-resolver-alias
This is a simple Node.js module import resolution plugin for eslint-plugin-import
, which supports module alias and native Node.js module import.
Installation
Prerequisites: Node.js >=4.x and corresponding version of npm.
npm install eslint-plugin-import eslint-import-resolver-alias --save-dev
Usage
Pass this resolver and its parameters to eslint-plugin-import
using your eslint
config file, .eslintrc
or .eslintrc.js
.
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
'alias': [
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
['helper', './utils/helper'],
['material-ui/DatePicker', '../custom/DatePicker'],
['material-ui', 'material-ui-ie10']
],
// node: true
}
}
};
Note:
- The items of alias config array is also array which contains 2 string
- The first string represents the mapped module name or path
- The second string represents the module alias, the actual module path os module name
- The config item
['helper', './utils/helper']
means that the modulehelper/*
will be resolved to./utils/helper/*
. See #3 - The order of 'material-ui/DatePicker' and 'material-ui' cannot be reversed, otherwise the alias rule 'material-ui/DatePicker' does not work
- when the config is an empty array or not an array, the resolver falls back to native Node.js module import