Package · PKG0007

Forward the peers of workspace dependencies

Find published workspace packages that depend on another workspace package without declaring that package's required peers in peerDependencies, dependencies or optionalDependencies.
PKG0007vite-doctor/packagedependencieswarnSuggestion

Run this rule

pnpm vite-doctor . --extends package/recommended --rules package/no-unforwarded-peer

Why it matters

A peer is resolved from the packages above the one that declares it. When package A depends on workspace package B and B requires peer P, an app that installs only A never declares P: a strict install has no P and B fails to load, and an auto-installed P is a copy the app does not share. A development dependency on P covers only A's own tests. Yarn reports the same gap as a missing peer of A.

Declare the peer in the dependent package's peerDependencies with the same specifier the workspace dependency uses, and keep a devDependency for its own tests. If the dependent never loads the code that needs the peer, declare it as an optional peer instead.

Example

Forward Auth's drizzle-orm peer from Realtime

Before

{ "name": "@acme/realtime", "dependencies": { "@acme/auth": "workspace:*" } }
// @acme/auth: { "peerDependencies": { "drizzle-orm": "^1.0.0" } }

After

{ "name": "@acme/realtime", "dependencies": { "@acme/auth": "workspace:*" }, "peerDependencies": { "drizzle-orm": "^1.0.0" } }
Copyright © 2026