{"id":19836,"library":"eslint-plugin-monorepo","title":"eslint-plugin-monorepo","description":"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.","status":"maintenance","version":"0.3.2","language":"javascript","source_language":"en","source_url":"https://github.com/azz/eslint-plugin-monorepo","tags":["javascript","eslint","plugin","monorepo","yarn","workspaces","lerna"],"install":[{"cmd":"npm install eslint-plugin-monorepo","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-monorepo","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-monorepo","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to discover monorepo packages from package.json or lerna.json.","package":"get-monorepo-packages","optional":false},{"reason":"Used for pattern matching of import paths.","package":"minimatch","optional":false},{"reason":"Used to parse npm package names from import statements.","package":"parse-package-name","optional":false}],"imports":[{"note":"ESLint plugins are loaded via configuration, not direct import. The plugin must be added to the 'plugins' array.","wrong":"const plugin = require('eslint-plugin-monorepo')","symbol":"plugin","correct":"module.exports = { plugins: ['monorepo'], rules: { 'monorepo/no-internal-import': 'error' } }"},{"note":"Access the 'recommended' config via configs.recommended for programmatic use. ESM/CJS compatible.","wrong":"","symbol":"configs","correct":"import { configs } from 'eslint-plugin-monorepo'"},{"note":"Access individual rule definitions for programmatic use. ESM/CJS compatible.","wrong":"","symbol":"rules","correct":"import { rules } from 'eslint-plugin-monorepo'"}],"quickstart":{"code":"// .eslintrc.cjs\nmodule.exports = {\n  extends: ['plugin:monorepo/recommended'],\n  settings: {\n    monorepo: {\n      // optional: specify workspace root if not automatically detected\n      root: './'\n    }\n  }\n};","lang":"javascript","note":"Assumes CommonJS module format for .eslintrc.cjs. For JSON config, omit module.exports and use JSON syntax.","description":"Basic ESLint configuration enabling the recommended monorepo rules."},"warnings":[{"fix":"Ensure package.json has 'workspaces' array or lerna.json exists. Optionally set 'settings.monorepo.root' in ESLint config.","message":"Plugin may not detect monorepo structure if the workspace root is not correctly configured.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Review auto-fixes carefully. Consider using only in conjunction with proper workspace configuration.","message":"The 'no-relative-import' rule can auto-fix imports, but may incorrectly change non-monorepo imports.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Prefer explicit workspace array over glob patterns. Ensure all packages are listed.","message":"Rules may not work correctly if there are nested workspaces or glob patterns in workspaces.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Consider migrating to eslint-plugin-import or maintaining a fork.","message":"Package has not been updated since 2020; may not support newer ESLint versions (>=8).","severity":"deprecated","affected_versions":">=0.3.2"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-monorepo --save-dev' and add 'plugins: [\"monorepo\"]' to your ESLint config.","cause":"Plugin is not installed or not listed in ESLint's plugins array.","error":"ESLint couldn't find the plugin \"eslint-plugin-monorepo\"."},{"fix":"Ensure all dependencies are installed by running 'npm install eslint-plugin-monorepo get-monorepo-packages' (or reinstall the plugin itself).","cause":"Missing dependency when requiring the plugin.","error":"Cannot find module 'get-monorepo-packages'"},{"fix":"Add 'parserOptions: { sourceType: \"module\" }' or 'ecmaVersion: 2015, sourceType: \"module\"' to your ESLint config.","cause":"ESLint parser not configured for ES modules.","error":"Parsing error: The keyword 'import' is reserved"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}