Registry / testing / eslint-plugin-monorepo

eslint-plugin-monorepo

JSON →
library0.3.2jsnpmunverified

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-monorepo
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-MONO
E
eslint-plugin-monorepo
testingjavascriptv0.3.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin
module.exports = { plugins: ['monorepo'], rules: { 'monorepo/no-internal-import': 'error' } }
const plugin = require('eslint-plugin-monorepo')
ESLint plugins are loaded via configuration, not direct import. The plugin must be added to the 'plugins' array.
configs
import { configs } from 'eslint-plugin-monorepo'
Access the 'recommended' config via configs.recommended for programmatic use. ESM/CJS compatible.
rules
import { rules } from 'eslint-plugin-monorepo'
Access individual rule definitions for programmatic use. ESM/CJS compatible.

Basic ESLint configuration enabling the recommended monorepo rules.

// .eslintrc.cjs module.exports = { extends: ['plugin:monorepo/recommended'], settings: { monorepo: { // optional: specify workspace root if not automatically detected root: './' } } };
Debug
Known issues
gotchaPlugin may not detect monorepo structure if the workspace root is not correctly configured.
fix
Ensure package.json has 'workspaces' array or lerna.json exists. Optionally set 'settings.monorepo.root' in ESLint config.
affects: >=0.0.1
gotchaThe 'no-relative-import' rule can auto-fix imports, but may incorrectly change non-monorepo imports.
fix
Review auto-fixes carefully. Consider using only in conjunction with proper workspace configuration.
affects: >=0.0.1
gotchaRules may not work correctly if there are nested workspaces or glob patterns in workspaces.
fix
Prefer explicit workspace array over glob patterns. Ensure all packages are listed.
affects: >=0.0.1
deprecatedPackage has not been updated since 2020; may not support newer ESLint versions (>=8).
fix
Consider migrating to eslint-plugin-import or maintaining a fork.
affects: >=0.3.2
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-monorepo".
Plugin is not installed or not listed in ESLint's plugins array.
fix
Run 'npm install eslint-plugin-monorepo --save-dev' and add 'plugins: ["monorepo"]' to your ESLint config.
Cannot find module 'get-monorepo-packages'
Missing dependency when requiring the plugin.
fix
Ensure all dependencies are installed by running 'npm install eslint-plugin-monorepo get-monorepo-packages' (or reinstall the plugin itself).
Parsing error: The keyword 'import' is reserved
ESLint parser not configured for ES modules.
fix
Add 'parserOptions: { sourceType: "module" }' or 'ecmaVersion: 2015, sourceType: "module"' to your ESLint config.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
get-monorepo-packagesrequiredUsed to discover monorepo packages from package.json or lerna.json.
minimatchrequiredUsed for pattern matching of import paths.
parse-package-namerequiredUsed to parse npm package names from import statements.
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-monorepo — npm install eslint-plugin-monorepo · libregistry