Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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 0 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.