Skip to content

Missing peer dependency declaration for TypeScript (YN0086 warnings under Yarn 4) #9846

@DK333D

Description

@DK333D

Describe the bug

Summary
Yarn 4 reports peer dependency warnings (YN0086) related to two ESLint plugins used in our project: @tanstack/eslint-plugin-query and eslint-plugin-testing-library. Both depend (transitively) on @typescript-eslint/utils, which declares a peer dependency on typescript, but neither plugin forwards that peer requirement in its own peerDependencies. This causes cosmetic warnings in strict installs and makes dependency hygiene noisier.

Affected packages
@tanstack/eslint-plugin-query@5.91.2
eslint-plugin-testing-library@7.13.3
@typescript-eslint/utils@8.46.1
Yarn: 4.x (strict peer validation)
TypeScript in our project: ~5.9.0
eslint: 9.15.0

Actual
Strict peer check flags the plugins for not supplying the typescript peer expected by @typescript-eslint/utils.

Expected
No warnings: plugins should forward the typescript peer requirement (optionally) so dependency graphs remain clean under Yarn 4 strict validation.

Suggested fix
Please consider adding an optional typescript peer to the plugin manifests. Example snippet to add to each plugin's package.json

"peerDependencies": {
  "eslint": "^8.0.0 || ^9.0.0",
  "typescript": ">=5.0.0"
},
"peerDependenciesMeta": {
  "typescript": {
    "optional": true
  }
}

Why optional?
Projects using only JS (no TS) may still want the plugin; marking typescript optional prevents forcing an install while satisfying Yarn’s propagation expectations in TS projects.

Impact

Eliminates noisy YN0086 warnings in modern Yarn setups (cleaner CI logs and developer installs).
Encourages consistent manifest hygiene with other ESLint + TypeScript tooling.
Avoids downstream hacks (Yarn packageExtensions) or local patch: modifications that only mask, not fix, the upstream issue.

Your minimal, reproducible example

Difficult to reproduce. I have yarn 4.x with strict dependency check and StackBlitz uses yarn 1.x with not-strict checking

Steps to reproduce

  1. Create a project using Yarn 4.
  2. Add devDependencies including eslint, typescript, and either/both plugins listed above.
  3. Run yarn install.
  4. Run yarn explain peer-requirements and observe lines like:
    ✘ @tanstack/eslint-plugin-query@... doesn't provide typescript to @typescript-eslint/utils@...
    ✘ eslint-plugin-testing-library@... doesn't provide typescript to @typescript-eslint/utils@...

Expected behavior

I don't see:
Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.

when executing command yarn install

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform

Ubuntu 22 LTS

Tanstack Query adapter

react-query

TanStack Query version

5.91.2

TypeScript version

5.9.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions