{"id":19661,"library":"eslint-import-resolver-custom-alias","title":"eslint-import-resolver-custom-alias","description":"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.","status":"active","version":"1.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/laysent/eslint-import-resolver-custom-alias","tags":["javascript","eslint-import-resolver","eslint-import-plugin","alias","resolver"],"install":[{"cmd":"npm install eslint-import-resolver-custom-alias","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-import-resolver-custom-alias","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-import-resolver-custom-alias","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: resolver plugin for eslint-plugin-import","package":"eslint-plugin-import","optional":false}],"imports":[{"note":"Not imported directly; configured in .eslintrc settings. The resolver name must match the package name exactly.","wrong":"import resolver from 'eslint-import-resolver-custom-alias'","symbol":"resolver","correct":"settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { ... } } }"},{"note":"The property is `alias`, not `maps`, `map`, or `paths`. No import required.","wrong":"settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { maps: { '@': './src' } } } }","symbol":"alias","correct":"settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { alias: { '@': './src' } } } }"},{"note":"Use `packages` array with glob patterns; no Lerna-specific boolean option.","wrong":"settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { lerna: true } } }","symbol":"packages","correct":"settings: { 'import/resolver': { 'eslint-import-resolver-custom-alias': { packages: ['packages/*'] } } }"}],"quickstart":{"code":"{\n  \"settings\": {\n    \"import/resolver\": {\n      \"eslint-import-resolver-custom-alias\": {\n        \"alias\": {\n          \"@\": \"./src\"\n        },\n        \"extensions\": [\".js\", \".jsx\", \".ts\"],\n        \"packages\": [\"packages/*\"]\n      }\n    }\n  }\n}","lang":"javascript","description":"ESLint config to resolve imports like `@/utils` to `./src/utils` in a Lerna monorepo."},"warnings":[{"fix":"Use absolute paths or configure `packages` so the resolver adjusts based on file location.","message":"Relative alias values are resolved from process.cwd(), not relative to the file. This might cause unexpected resolution in monorepos without proper `packages` config.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Avoid using empty string alias or pin version and test thoroughly.","message":"Empty string alias behavior is undocumented for nested directories; may change in future versions.","severity":"deprecated","affected_versions":"<=1.3.2"},{"fix":"Double-check the resolver name in .eslintrc settings.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add .jsx, .ts, .tsx etc. to the `extensions` array.","message":"Extensions default to ['.js'] only; if your project uses .jsx or .ts, you must explicitly list them.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use simple globs like 'packages/*' or 'modules/**' without leading ./","message":"Packages glob pattern must be relative to root; absolute paths or complex patterns may not work.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --dev eslint-import-resolver-custom-alias` and ensure it's in devDependencies.","cause":"The resolver is not installed or not in node_modules.","error":"ESLint couldn't find the plugin \"eslint-import-resolver-custom-alias\""},{"fix":"Check alias keys match imports, and alias values point to existing directories.","cause":"Alias key not matching the import prefix or alias path invalid.","error":"Unable to resolve path to module 'path/to/module'"},{"fix":"Ensure alias values are strings (relative or absolute paths).","cause":"Alias object property type mismatch (e.g., using array instead of string for path).","error":"Resolve error: the package alias \"@\" has been misconfigured"},{"fix":"Use exactly: 'eslint-import-resolver-custom-alias' (quoted) in settings.import.resolver.","cause":"Resolver name string missing or incorrectly spelled in settings.","error":"Configuration for rule 'import/no-unresolved' is invalid: Value \"eslint-import-resolver-custom-alias\" is invalid"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}