
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
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.
The npm package eslint-import-resolver-localalias receives a total of 16 weekly downloads. As such, eslint-import-resolver-localalias popularity was classified as not popular.
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.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.