{"id":19876,"library":"eslint-plugin-pnpm","title":"eslint-plugin-pnpm","description":"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.","status":"active","version":"1.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/pnpm-workspace-utils","tags":["javascript","eslint-plugin","pnpm","typescript"],"install":[{"cmd":"npm install eslint-plugin-pnpm","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-pnpm","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-pnpm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency, required version ^9.0.0 || ^10.0.0","package":"eslint","optional":false},{"reason":"Required to parse package.json for JSON rules","package":"jsonc-eslint-parser","optional":true},{"reason":"Required to parse pnpm-workspace.yaml for YAML rules","package":"yaml-eslint-parser","optional":true}],"imports":[{"note":"ESM-only. 'configs' is an object with json and yaml arrays.","wrong":"import { configs } from 'eslint-plugin-pnpm/configs'","symbol":"configs","correct":"import { configs } from 'eslint-plugin-pnpm'"},{"note":"ESM-only, no CommonJS support. Default export is the plugin object.","wrong":"const pluginPnpm = require('eslint-plugin-pnpm')","symbol":"default import","correct":"import pluginPnpm from 'eslint-plugin-pnpm'"},{"note":"Named export, access rule objects via rules['json-enforce-catalog'] etc.","wrong":"import { rules } from 'eslint-plugin-pnpm/rules'","symbol":"rules","correct":"import { rules } from 'eslint-plugin-pnpm'"}],"quickstart":{"code":"import { configs } from 'eslint-plugin-pnpm';\n\nexport default [\n  {\n    ignores: ['**/node_modules/**', '**/dist/**'],\n  },\n  ...configs.json,\n  ...configs.yaml,\n];","lang":"javascript","description":"Basic ESLint flat config setup for pnpm workspaces with both JSON and YAML rules."},"warnings":[{"fix":"Use with caution, or disable YAML rules if issues arise.","message":"YAML rules require yaml-eslint-parser, which is experimental and may have race conditions with other plugins.","severity":"gotcha","affected_versions":"<1.7.0"},{"fix":"Ensure the parser is configured in languageOptions.parser for relevant files.","message":"JSON rules require jsonc-eslint-parser as the parser for package.json files.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to flat config; the plugin does not export a deprecated configs object.","message":"This plugin only supports ESLint flat config (eslint.config.js), not .eslintrc.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade ESLint to v9 or v10.","message":"ESLint v8 is not supported; requires ESLint ^9.0.0 or ^10.0.0.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use other JSON rules or manually enforce workspace protocol.","message":"The rule 'json-prefer-workspace-settings' is deprecated and will be removed in a future major version.","severity":"deprecated","affected_versions":">=1.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use import { configs } from 'eslint-plugin-pnpm' and spread configs.json or configs.yaml.","cause":"The 'recommended' configs are not provided as plugin prefixes; configs must be imported directly.","error":"Error: Could not find config 'pnpm/json-enforce-catalog' after extending 'plugin:pnpm/recommended'"},{"fix":"Add languageOptions: { parser: jsonc-eslint-parser } in the configuration for package.json files.","cause":"Parser not set to jsonc-eslint-parser for package.json files.","error":"Parsing error: Unexpected token }"},{"fix":"Run `pnpm add -D eslint-plugin-pnpm` and use import statement without file extensions.","cause":"Missing installation or incorrect import path in ESM.","error":"Cannot find module 'eslint-plugin-pnpm'"},{"fix":"Use the plugin object directly: plugins: { pnpm: pluginPnpm }.","cause":"Improper use of default import when spreading rules.","error":"TypeError: pluginPnpm.rules is not iterable"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}