
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
eslint-import-resolver-localalias
Advanced tools
A simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias with local project modules and node_modules.
This is a simple Node.js module import resolution plugin for eslint-plugin-import, which supports native Node.js module resolution, module alias and custom file extensions. Also supports aliases for project modules.
Prerequisites: Node.js >=6.x and corresponding version of npm.
npm install eslint-plugin-import eslint-import-resolver-localalias --save-dev
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': {
localalias: {
map: [
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
['helper', './utils/helper'],
['material-ui/DatePicker', '../custom/DatePicker'],
['material-ui', 'material-ui-ie10'],
['@project-module', 'module/path/'],
['project-module2', 'module2']
],
extensions: ['.ts', '.js', '.jsx', '.json']
}
}
}
};
Note:
map and extensions, both of which are array typesmap array is also array type which contains 2 string
map item ['helper', './utils/helper'] means that the module helper/* will be resolved to ./utils/helper/*. See #3extensions property is ['.js', '.json', '.node'] if it is assigned to an empty array or not specified.If the extensions property is not specified, the config object can be simplified to the map array.
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
localalias: [
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
['helper', './utils/helper'],
['material-ui/DatePicker', '../custom/DatePicker'],
['material-ui', 'material-ui-ie10'],
['@project-module', 'module/path/'],
['project-module2', 'module2']
]
}
}
};
When the config is not a valid object (such as true), the resolver falls back to native Node.js module resolution.
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
alias: true
}
}
};
FAQs
A simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias with local project modules and node_modules.
We found that eslint-import-resolver-localalias demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.