Registry / testing / eslint-plugin-pnpm

eslint-plugin-pnpm

JSON →
library1.6.0jsnpmunverified

An ESLint plugin to enforce and auto-fix pnpm catalog usage in monorepos. Current stable version is 1.6.0, released with support for ESLint v10. It provides two sets of rules: JSON rules for package.json (requires jsonc-eslint-parser) and YAML rules for pnpm-workspace.yaml (requires yaml-eslint-parser, experimental). Key differentiators include auto-fixing support, catalog enforcement, duplicate detection, and workspace protocol preferences. Maintained by Anthony Fu, with active development and monthly releases.

npm install eslint-plugin-pnpm
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-PNPM
E
eslint-plugin-pnpm
testingjavascriptv1.6.0
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.

configs
import { configs } from 'eslint-plugin-pnpm'
import { configs } from 'eslint-plugin-pnpm/configs'
ESM-only. 'configs' is an object with json and yaml arrays.
default import
import pluginPnpm from 'eslint-plugin-pnpm'
const pluginPnpm = require('eslint-plugin-pnpm')
ESM-only, no CommonJS support. Default export is the plugin object.
rules
import { rules } from 'eslint-plugin-pnpm'
import { rules } from 'eslint-plugin-pnpm/rules'
Named export, access rule objects via rules['json-enforce-catalog'] etc.

Basic ESLint flat config setup for pnpm workspaces with both JSON and YAML rules.

import { configs } from 'eslint-plugin-pnpm'; export default [ { ignores: ['**/node_modules/**', '**/dist/**'], }, ...configs.json, ...configs.yaml, ];
Debug
Known issues
gotchaYAML rules require yaml-eslint-parser, which is experimental and may have race conditions with other plugins.
fix
Use with caution, or disable YAML rules if issues arise.
affects: <1.7.0
gotchaJSON rules require jsonc-eslint-parser as the parser for package.json files.
fix
Ensure the parser is configured in languageOptions.parser for relevant files.
affects: >=1.0.0
gotchaThis plugin only supports ESLint flat config (eslint.config.js), not .eslintrc.
fix
Migrate to flat config; the plugin does not export a deprecated configs object.
affects: >=1.0.0
breakingESLint v8 is not supported; requires ESLint ^9.0.0 or ^10.0.0.
fix
Upgrade ESLint to v9 or v10.
affects: >=1.0.0
deprecatedThe rule 'json-prefer-workspace-settings' is deprecated and will be removed in a future major version.
fix
Use other JSON rules or manually enforce workspace protocol.
affects: >=1.4.0
Errors
Common errors & fixes
Error: Could not find config 'pnpm/json-enforce-catalog' after extending 'plugin:pnpm/recommended'
The 'recommended' configs are not provided as plugin prefixes; configs must be imported directly.
fix
Use import { configs } from 'eslint-plugin-pnpm' and spread configs.json or configs.yaml.
Parsing error: Unexpected token }
Parser not set to jsonc-eslint-parser for package.json files.
fix
Add languageOptions: { parser: jsonc-eslint-parser } in the configuration for package.json files.
Cannot find module 'eslint-plugin-pnpm'
Missing installation or incorrect import path in ESM.
fix
Run `pnpm add -D eslint-plugin-pnpm` and use import statement without file extensions.
TypeError: pluginPnpm.rules is not iterable
Improper use of default import when spreading rules.
fix
Use the plugin object directly: plugins: { pnpm: pluginPnpm }.
Upgrade
Version history
1.6.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency, required version ^9.0.0 || ^10.0.0
jsonc-eslint-parseroptionalRequired to parse package.json for JSON rules
yaml-eslint-parseroptionalRequired to parse pnpm-workspace.yaml for YAML rules
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-pnpm — npm install eslint-plugin-pnpm · libregistry