Monolinter
raw JSON → 1.0.5 verified Fri May 01 auth: no javascript
Monolinter is a CLI tool for validating consistency across multiple package.json files in a monorepo (or single project). It checks for consistent package versions, duplicate package declarations, fuzzy version usage, and related package version matches. Current stable version is 1.0.5. Release cadence is low; last release was minor. Key differentiator: modular, extensible with custom validation modules, and designed for CI/CD integration. Alternatives like syncpack focus on version sync but monolinter also catches duplicates and related packages.
Common errors
error Cannot find module 'cosmiconfig' ↓
cause Missing peer dependency cosmiconfig
fix
Add cosmiconfig as a devDependency: yarn add -D cosmiconfig
error TypeError: Cannot read property 'match' of undefined ↓
cause A package.json file lacks a 'version' field (for exact version check)
fix
Ensure all included package.json files have a 'version' field, or exclude them from exact version validation.
error No configuration found. Create a .monolinterrc file. ↓
cause Monolinter cannot find any config file in the project root.
fix
Create a .monolinterrc file with at least an 'include' array.
Warnings
gotcha Glob patterns must match relative path from config file location ↓
fix Use relative paths from the directory containing .monolinterrc or the root where CLI is run.
gotcha Exact version validator rejects packages without version (e.g., file: or git dependencies) ↓
fix Exclude packages that use non-semver versions via exclude patterns in config.
breaking Version 1.0.4 removed peer dependencies on @babel/core and @babel/runtime ↓
fix No migration needed; those packages are no longer required.
deprecated ESLint-related checks were added in 1.0.3 but not documented; may change in future ↓
fix Check changelog for updates on related package validation.
Install
npm install monolinter yarn add monolinter pnpm add monolinter Imports
- monolinter CLI wrong
npx monolintercorrectyarn monolinter - programmatic API wrong
const monolinter = require('monolinter');correctimport { Monolinter } from 'monolinter'; - config file wrong
monolinter.config.tscorrect.monolinterrc (JSON, YAML, or JS via cosmiconfig)
Quickstart
// Create .monolinterrc in project root:
{
"include": ["package.json", "packages/*/package.json"]
}
// Add script to package.json:
{
"scripts": {
"lint:mono": "monolinter"
}
}
// Run:
yarn lint:mono
// Or run directly:
yarn monolinter package.json 'packages/*/package.json'
// Sample output on failure:
// ✖ Found inconsistent versions for 'lodash': 4.17.0 vs 4.17.21
// ✖ Duplicate 'express' in dependencies and devDependencies of server/package.json
// ✖ App/package.json uses fuzzy version '^1.0.0' for 'debug'