Skip to main content

SKY-Q412 · Quality, structure and performance

Unresolved pnpm catalog reference

Medium

A workspace package.json declares a dependency with the catalog protocol, but the referenced catalog in pnpm-workspace.yaml has no entry for that package. The reference can name the default catalog or a named catalog.

Languages
package.json, pnpm-workspace.yaml
Turned on by
skylos . --quality
Quality gate
counted toward the gate limits (full and diff scans). Reported as quality; counts toward max_quality.
Finding type
defect
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

pnpm cannot resolve the version, so a clean install of the workspace fails. The error appears only when someone installs, often in CI.

What Skylos flags

pnpm-workspace.yaml · YAML
packages:  - "."catalog:  lodash: ^4.17.21
package.json · JSONReported on line 1
{"name":"shop","private":true,"dependencies":{"lodash":"catalog:","zod":"catalog:"}}
src/app.js · JavaScript
import _ from "lodash";import { z } from "zod";console.log(_, z);

What Skylos leaves alone

pnpm-workspace.yaml · YAML
packages:  - "."catalog:  lodash: ^4.17.21  zod: ^3.23.0

package.json: same as in the flagged example.

src/app.js: same as in the flagged example.

Why Skylos leaves it alone

Both references resolve to entries in the default catalog.

How Skylos decides

  1. Reads catalog and catalogs from the nearest pnpm-workspace.yaml as data and maps catalog:, catalog:default and catalog:<name> references to entries.
  2. Checks only package.json files that the workspace packages globs include (the workspace root is always included), and only dependency maps.
  3. Reports MEDIUM at the dependency line. A malformed workspace file, a pnpmfile hook or a competing bun or Yarn catalog source prevents the check.

How to fix it

Add the package to the referenced catalog, or use an explicit version range.

pnpm-workspace.yaml · YAML · the fix, against the flagged file
packages:  - "."catalog:  lodash: ^4.17.21Added:   zod: ^3.23.0

When it can be wrong

  • A package.json outside the workspace globs is not checked, even if it uses catalog references.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Set [tool.skylos] ignore = ["SKY-Q412"] to disable this rule project-wide.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.