{"id":19665,"library":"eslint-import-resolver-lerna","title":"eslint-import-resolver-lerna","description":"Resolver for eslint-plugin-import that enables module resolution in Lerna-based monorepos. Version 2.0.0 (latest, Nov 2020) is a rewrite to TypeScript with breaking changes from 1.x. It maps packages defined in Lerna's packages directories so that eslint-plugin-import can resolve cross-package imports, particularly needed when using compilation pipelines (Babel, TypeScript) that output to a different directory. Unlike the built-in Node resolver, this supports non-standard packages directories and helps avoid \"Unable to resolve path to module\" errors in monorepos.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/Dreamscapes/eslint-import-resolver-lerna","tags":["javascript","eslint-plugin-import","lerna","resolver"],"install":[{"cmd":"npm install eslint-import-resolver-lerna","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-import-resolver-lerna","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-import-resolver-lerna","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: the resolver is used by this plugin","package":"eslint-plugin-import","optional":false},{"reason":"optional: only needed if using Lerna for monorepo management","package":"lerna","optional":true}],"imports":[{"note":"ESM-only since v2; CJS require will not work with default export.","wrong":"const resolver = require('eslint-import-resolver-lerna')","symbol":"default","correct":"import resolver from 'eslint-import-resolver-lerna'"},{"note":"resolveSync is the named export for synchronous resolution; resolve does not exist.","wrong":"import { resolve } from 'eslint-import-resolver-lerna'","symbol":"resolveSync","correct":"import { resolveSync } from 'eslint-import-resolver-lerna'"},{"note":"resolve is a named export returning a promise (async). Not to be confused with resolveSync.","wrong":"import { resolve as syncResolve } from 'eslint-import-resolver-lerna'","symbol":"resolve","correct":"import { resolve } from 'eslint-import-resolver-lerna'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  settings: {\n    'import/resolver': {\n      'eslint-import-resolver-lerna': {\n        packages: __dirname + '/packages'\n      }\n    }\n  }\n};","lang":"javascript","description":"Configure eslint-plugin-import to use lerna resolver for packages directory."},"warnings":[{"fix":"Use import syntax; if you need CJS, stay on 1.x or use dynamic import.","message":"Version 2.0.0 drops CommonJS support; package is now ESM-only.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use named exports: import { resolve, resolveSync } from the package.","message":"The default export changed from a function to an object in v2.0.0.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always use absolute paths, e.g., path.resolve(__dirname, 'packages').","message":"The 'packages' option no longer accepts relative paths in some ESLint contexts.","severity":"deprecated","affected_versions":">=1.1.0"},{"fix":"Ensure every package subdirectory has a package.json with a valid 'name' field.","message":"The resolver expects package.json files in the packages subdirectories; missing ones cause silent failures.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always specify the 'packages' setting pointing to the packages directory.","message":"The resolver does not automatically detect Lerna's lerna.json; 'packages' option is mandatory.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1':35 '2.0.0':22 '2020':25 'avoid':88 'babel':64 'base':19 'break':32 'built':75 'built-in':74 'chang':33 'compil':62 'cross':55 'cross-packag':54 'defin':40 'differ':70 'directori':45,71,85 'enabl':13 'error':95 'eslint':2,9,49,100 'eslint-import-resolver-lerna':1 'eslint-plugin-import':8,48,99 'help':87 'import':3,11,51,57,102 'javascript':98 'latest':23 'lerna':5,18,42,103 'lerna-bas':17 'map':38 'modul':14,94 'monorepo':20,97 'need':59 'node':77 'non':82 'non-standard':81 'nov':24 'output':67 'packag':39,44,56,84 'particular':58 'path':92 'pipelin':63 'plugin':10,50,101 'resolut':15 'resolv':4,6,53,78,91,104 'rewrit':28 'standard':83 'support':80 'typescript':30,65 'unabl':89 'unlik':72 'use':61 'version':21 'x':36","created_at":"2026-04-25T11:18:59.390662+00:00","updated_at":"2026-04-25T11:18:59.390662+00:00","problems":[{"fix":"Add the lerna resolver configuration in .eslintrc as shown in quickstart.","cause":"eslint-plugin-import cannot find the internal package without the resolver.","error":"Unable to resolve path to module './packages/foo'."},{"fix":"Install eslint-plugin-import as a dev dependency: npm i -D eslint-plugin-import","cause":"Missing or misconfigured peer dependency eslint-plugin-import.","error":"Error: Cannot find module 'eslint-import-resolver-lerna'"},{"fix":"Change to import syntax in an ESM context or downgrade to v1.","cause":"Using require() for v2 which is ESM-only.","error":"TypeError: resolver.create is not a function"},{"fix":"Ensure packages is a string path or array of absolute paths.","cause":"Invalid type passed to packages option.","error":"The \"packages\" option must be a string or array of strings."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://www.npmjs.com/package/eslint-import-resolver-lerna","github":"https://github.com/Dreamscapes/eslint-import-resolver-lerna","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-import-resolver-lerna","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}