Registry / testing / eslint-import-resolver-custom-alias

eslint-import-resolver-custom-alias

JSON →
library1.3.2jsnpmunverified

An ESLint resolver (v1.3.2, 2022) for eslint-plugin-import that enables custom import aliases and file extensions. Unlike other resolvers (e.g., eslint-import-resolver-alias, eslint-import-resolver-webpack), it supports Lerna monorepos via a `packages` config, allowing alias resolution relative to the current package directory. It also supports an empty-string alias to prepend a base path. Requires eslint-plugin-import >=2.2.0 as a peer dependency.

npm install eslint-import-resolver-custom-alias
INSTALL
IMPORT
SIG · ESLINT-IMPORT-RESO
E
eslint-import-resolver-custom-alias
testingjavascriptv1.3.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

resolver
settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { ... } } }
import resolver from 'eslint-import-resolver-custom-alias'
Not imported directly; configured in .eslintrc settings. The resolver name must match the package name exactly.
alias
settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { alias: { '@': './src' } } } }
settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { maps: { '@': './src' } } } }
The property is `alias`, not `maps`, `map`, or `paths`. No import required.
packages
settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { packages: ['packages/*'] } } }
settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { lerna: true } } }
Use `packages` array with glob patterns; no Lerna-specific boolean option.

ESLint config to resolve imports like `@/utils` to `./src/utils` in a Lerna monorepo.

{ "settings": { "import/resolver": { "eslint-import-resolver-custom-alias": { "alias": { "@": "./src" }, "extensions": [".js", ".jsx", ".ts"], "packages": ["packages/*"] } } } }
Debug
Known issues
breakingRelative alias values are resolved from process.cwd(), not relative to the file. This might cause unexpected resolution in monorepos without proper `packages` config.
fix
Use absolute paths or configure `packages` so the resolver adjusts based on file location.
affects: >=1.0.0
deprecatedEmpty string alias behavior is undocumented for nested directories; may change in future versions.
fix
Avoid using empty string alias or pin version and test thoroughly.
affects: <=1.3.2
gotchaThe resolver name must exactly match the package name in quotes, e.g., 'eslint-import-resolver-custom-alias'. Misspelling or wrong casing leads to silent fallback to default resolver.
fix
Double-check the resolver name in .eslintrc settings.
affects: >=1.0.0
gotchaExtensions default to ['.js'] only; if your project uses .jsx or .ts, you must explicitly list them.
fix
Add .jsx, .ts, .tsx etc. to the `extensions` array.
affects: >=1.0.0
gotchaPackages glob pattern must be relative to root; absolute paths or complex patterns may not work.
fix
Use simple globs like 'packages/*' or 'modules/**' without leading ./
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-import-resolver-custom-alias"
The resolver is not installed or not in node_modules.
fix
Run `npm install --dev eslint-import-resolver-custom-alias` and ensure it's in devDependencies.
Unable to resolve path to module 'path/to/module'
Alias key not matching the import prefix or alias path invalid.
fix
Check alias keys match imports, and alias values point to existing directories.
Resolve error: the package alias "@" has been misconfigured
Alias object property type mismatch (e.g., using array instead of string for path).
fix
Ensure alias values are strings (relative or absolute paths).
Configuration for rule 'import/no-unresolved' is invalid: Value "eslint-import-resolver-custom-alias" is invalid
Resolver name string missing or incorrectly spelled in settings.
fix
Use exactly: 'eslint-import-resolver-custom-alias' (quoted) in settings.import.resolver.
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies
eslint-plugin-importrequiredpeer dependency: resolver plugin for eslint-plugin-import
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-import-resolver-custom-alias — npm install eslint-import-resolver-custom-alias · libregistry