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.

testing
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.

Not imported directly; configured in .eslintrc settings. The resolver name must match the package name exactly.

settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { ... } } }

The property is `alias`, not `maps`, `map`, or `paths`. No import required.

settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { alias: { '@': './src' } } } }

Use `packages` array with glob patterns; no Lerna-specific boolean option.

settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { packages: ['packages/*'] } } }

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 footguns
breakingRelative alias values are resolved from process.cwd(), not relative to the file. This might cause unexpected resolution in monorepos without proper `packages` config.
deprecatedEmpty string alias behavior is undocumented for nested directories; may change in future versions.
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.
gotchaExtensions default to ['.js'] only; if your project uses .jsx or .ts, you must explicitly list them.
gotchaPackages glob pattern must be relative to root; absolute paths or complex patterns may not work.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources