ESLint plugin providing custom rules to enforce consistent import patterns within monorepos using Lerna or Yarn Workspaces. Current stable version is 0.3.2 (last released November 2020). It offers two rules: no-internal-import to forbid importing specific files from a package, and no-relative-import (fixable) to prevent relative imports between monorepo packages. Unlike generic import plugins, it automatically detects monorepo structure via package.json workspaces or lerna.json. Note: the package is in maintenance mode with no recent updates.
npm install eslint-plugin-monorepoVerified import paths — ran on the pinned version, not inferred.
Basic ESLint configuration enabling the recommended monorepo rules.
Ensure package.json has 'workspaces' array or lerna.json exists. Optionally set 'settings.monorepo.root' in ESLint config.
Review auto-fixes carefully. Consider using only in conjunction with proper workspace configuration.
Prefer explicit workspace array over glob patterns. Ensure all packages are listed.
Consider migrating to eslint-plugin-import or maintaining a fork.
Run 'npm install eslint-plugin-monorepo --save-dev' and add 'plugins: ["monorepo"]' to your ESLint config.
Ensure all dependencies are installed by running 'npm install eslint-plugin-monorepo get-monorepo-packages' (or reinstall the plugin itself).
Add 'parserOptions: { sourceType: "module" }' or 'ecmaVersion: 2015, sourceType: "module"' to your ESLint config.