Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
eslint-import-resolver-alias-array
Advanced tools
A simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias, modified to allow for arrays of aliases.
This is a simple Node.js module import resolution plugin for eslint-plugin-import
, which supports native Node.js module resolution, module alias/mapping and custom file extensions.
NOTE: This package is an update of the original, modified to allow for arrays of aliases. At this time, it is provided as a convenience only, until the original maintainer is able to return and address the PR containing this code. Any issues or bug reports not explicitly related to the alias array modifications are better addressed against the original repository.
Prerequisites: Node.js >=4.x and corresponding version of npm.
npm install eslint-plugin-import eslint-import-resolver-alias-array --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': {
'alias-array': {
map: [
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
['helper', './utils/helper'],
['material-ui/DatePicker', '../custom/DatePicker'],
['material-ui', 'material-ui-ie10'],
['lib', ['app/lib', 'common/lib']]
],
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 modules which match helper
or helper/*
will be resolved to ./utils/helper
or ./utils/helper/*
which are located relative to the process current working directory
(almost the project root directory). If you just want to resolve helper
to ./utils/helper
, use ['^helper$', './utils/helper']
instead. See issue #3extensions
property is ['.js', '.json', '.node']
if it is assigned to an empty array or not specifiedIf the extensions
property is not specified, the config object can be simplified to the map
array.
// .eslintrc.js
module.exports = {
settings: {
'import/resolver': {
'alias-array': [
['babel-polyfill', 'babel-polyfill/dist/polyfill.min.js'],
['helper', './utils/helper'],
['material-ui/DatePicker', '../custom/DatePicker'],
['material-ui', 'material-ui-ie10']
]
}
}
};
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, modified to allow for arrays of aliases.
The npm package eslint-import-resolver-alias-array receives a total of 1,550 weekly downloads. As such, eslint-import-resolver-alias-array popularity was classified as popular.
We found that eslint-import-resolver-alias-array 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.