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.
npm install eslint-import-resolver-lernaVerified import paths — ran on the pinned version, not inferred.
Configure eslint-plugin-import to use lerna resolver for packages directory.
Use import syntax; if you need CJS, stay on 1.x or use dynamic import.
Use named exports: import { resolve, resolveSync } from the package.Always use absolute paths, e.g., path.resolve(__dirname, 'packages').
Ensure every package subdirectory has a package.json with a valid 'name' field.
Always specify the 'packages' setting pointing to the packages directory.
Add the lerna resolver configuration in .eslintrc as shown in quickstart.
Install eslint-plugin-import as a dev dependency: npm i -D eslint-plugin-import
Change to import syntax in an ESM context or downgrade to v1.
Ensure packages is a string path or array of absolute paths.