# eslint-plugin-pnpm

> ESLint Plugin for pnpm

Latest version **1.9.1** (published 2026-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-pnpm
pnpm add eslint-plugin-pnpm
yarn add eslint-plugin-pnpm
bun add eslint-plugin-pnpm
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.9.1 |
| Published | 2026-09-02 |
| First published | 2025-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 8 |
| Unpacked size | 42.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 138 |
| Author | Anthony Fu <anthonyfu117@hotmail.com> |
| Maintainers | antfu, sxzz |
| Keywords | eslint-plugin, pnpm |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-pnpm
- Repository: https://github.com/antfu/pnpm-workspace-utils
- Homepage: https://github.com/antfu/pnpm-workspace-utils#readme
- Issues: https://github.com/antfu/pnpm-workspace-utils/issues
- Funding: https://github.com/sponsors/antfu
- npm.io page: https://npm.io/package/eslint-plugin-pnpm

## Dependencies (8)

- [yaml](https://npm.io/package/yaml.md) ^2.9.0
- [pathe](https://npm.io/package/pathe.md) ^2.0.3
- [empathic](https://npm.io/package/empathic.md) ^2.0.1
- [tinyglobby](https://npm.io/package/tinyglobby.md) ^0.2.17
- [yaml-eslint-parser](https://npm.io/package/yaml-eslint-parser.md) ^2.1.0
- [jsonc-eslint-parser](https://npm.io/package/jsonc-eslint-parser.md) ^3.3.0
- [pnpm-workspace-yaml](https://npm.io/package/pnpm-workspace-yaml.md) 1.9.1
- [eslint-json-compat-utils](https://npm.io/package/eslint-json-compat-utils.md) ^0.2.3

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.9.1 (latest) — 2026-09-02
- 1.9.0 — 2026-09-02
- 1.8.0 — 2026-08-13
- 1.7.0 — 2026-07-22
- 1.6.1 — 2026-05-19
- 1.6.0 — 2026-02-25
- 1.5.0 — 2026-01-19
- 1.4.3 — 2025-12-14
- 1.4.2 — 2025-12-08
- 1.4.1 — 2025-12-05
- 1.4.0 — 2025-12-04
- 1.3.0 — 2025-10-17
- 1.2.0 — 2025-10-01
- 1.1.2 — 2025-09-24
- 1.1.1 — 2025-08-15
- … 8 more at https://npm.io/package/eslint-plugin-pnpm/versions

## README

# eslint-plugin-pnpm

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
[![License][license-src]][license-href]

ESLint plugin to enforce and auto-fix pnpm catalogs.

This plugin consists of two set of rules that applies to `package.json` and `pnpm-workspace.yaml` respectively.

- [`json-` rules](./src/rules/json) applies to `package.json` and requires [`jsonc-eslint-parser`](https://github.com/ota-meshi/jsonc-eslint-parser) to be used as parser.
  - The `json-` rules also work when `package.json` is linted with the `json/json` language from [`@eslint/json`](https://github.com/eslint/json) instead (e.g. when combined with other JSON-linting plugins), via [`eslint-json-compat-utils`](https://github.com/ota-meshi/eslint-json-compat-utils).
- [`yaml-` rules](./src/rules/yaml) applies to `pnpm-workspace.yaml` and requires [`yaml-eslint-parser`](https://github.com/ota-meshi/yaml-eslint-parser) to be used as parser.
  - YAML support is still experimental as it might have race conditions with other plugins.

## Setup

```bash
pnpm add -D eslint-plugin-pnpm
```

### Basic Usage

```js
// eslint.config.mjs
import { configs } from 'eslint-plugin-pnpm'

export default [
  {
    ignores: ['**/node_modules/**', '**/dist/**'],
  },
  ...configs.json,
  ...configs.yaml,
]
```

### Manual Configuration

```js
// eslint.config.mjs
import pluginPnpm from 'eslint-plugin-pnpm'
import * as jsoncParser from 'jsonc-eslint-parser'
import * as yamlParser from 'yaml-eslint-parser'

export default [
  {
    ignores: ['**/node_modules/**', '**/dist/**'],
  },
  {
    name: 'pnpm/package.json',
    files: [
      'package.json',
      '**/package.json',
    ],
    languageOptions: {
      parser: jsoncParser,
    },
    plugins: {
      pnpm: pluginPnpm,
    },
    rules: {
      'pnpm/json-enforce-catalog': 'error',
      'pnpm/json-valid-catalog': 'error',
      'pnpm/json-prefer-workspace-settings': 'error',
    },
  },
  {
    name: 'pnpm/pnpm-workspace-yaml',
    files: ['pnpm-workspace.yaml'],
    languageOptions: {
      parser: yamlParser,
    },
    plugins: {
      pnpm: pluginPnpm,
    },
    rules: {
      'pnpm/yaml-no-unused-catalog-item': 'error',
      'pnpm/yaml-no-duplicate-catalog-item': 'error',
      'pnpm/yaml-valid-packages': 'error',
      'pnpm/yaml-no-anonymous-catalog': 'error',
      'pnpm/yaml-blank-lines': 'error',
    },
  },
]
```

## Rules

### JSON Rules (`package.json`)

- [`json-enforce-catalog`](./src/rules/json/json-enforce-catalog.ts) - Enforce catalog usage for dependencies
- [`json-valid-catalog`](./src/rules/json/json-valid-catalog.ts) - Validate catalog references in dependencies
- [`json-prefer-workspace-settings`](./src/rules/json/json-prefer-workspace-settings.ts) - Prefer workspace protocol for local dependencies

### YAML Rules (`pnpm-workspace.yaml`)

- [`yaml-no-unused-catalog-item`](./src/rules/yaml/yaml-no-unused-catalog-item.ts) - Disallow unused catalog items
- [`yaml-no-duplicate-catalog-item`](./src/rules/yaml/yaml-no-duplicate-catalog-item.ts) - Disallow duplicate catalog items
- [`yaml-no-anonymous-catalog`](./src/rules/yaml/yaml-no-anonymous-catalog.ts) - Disallow the anonymous `catalog:` in favor of named catalogs (opt-in)
- [`yaml-valid-packages`](./src/rules/yaml/yaml-valid-packages.ts) - Ensure package patterns match directories with package.json
- [`yaml-enforce-settings`](./src/rules/yaml/yaml-enforce-settings.ts) - Enforce settings in `pnpm-workspace.yaml`
- [`yaml-blank-lines`](./src/rules/yaml/yaml-blank-lines.ts) - Require blank lines around multi-line top-level entries, and disallow them between single-line entries (opt-in)

## Settings

| Name                  | Description                                                 | Type    | Default |
| --------------------- | ----------------------------------------------------------- | ------- | ------- |
| `ensureWorkspaceFile` | Whether to create `pnpm-workspace.yaml` if it doesn't exist | boolean | false   |

## Sponsors

<p align="center">
  <a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
    <img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg' alt="antfu's sponsors"/>
  </a>
</p>

## License

[MIT](./LICENSE) License © [Anthony Fu](https://github.com/antfu)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-pnpm?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/eslint-plugin-pnpm
[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-pnpm?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-pnpm
[bundle-src]: https://img.shields.io/bundlephobia/minzip/eslint-plugin-pnpm?style=flat&colorA=080f12&colorB=1fa669&label=minzip
[bundle-href]: https://bundlephobia.com/result?p=eslint-plugin-pnpm
[license-src]: https://img.shields.io/github/license/antfu/pnpm-workspace-utils.svg?style=flat&colorA=080f12&colorB=1fa669
[license-href]: https://github.com/antfu/pnpm-workspace-utils/blob/main/LICENSE.md
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
[jsdocs-href]: https://www.jsdocs.io/package/eslint-plugin-pnpm

---
_Source: https://npm.io/package/eslint-plugin-pnpm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
