npm / npm/cli

[BUG](arborist) peer dep error message is inaccurate and confusing

Open
#4,268 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Priority 2 ws:arborist
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

What / Why

See https://github.com/MichaelDeBoey/eslint-plugin-jsx-a11y/runs/4036050330?check_suite_focus=true (reproduced below since GHA logs expire) on this commit https://github.com/MichaelDeBoey/eslint-plugin-jsx-a11y/commit/7dda47066649714275f96fd017c0ec3d722f2507

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: eslint-plugin-jsx-a11y@6.4.1
npm ERR! Found: eslint@7.32.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8" from the root project
npm ERR!   peer eslint@">=7.5.0" from @babel/eslint-parser@7.15.8
npm ERR!   node_modules/@babel/eslint-parser
npm ERR!     dev @babel/eslint-parser@"^7.15.8" from the root project
npm ERR!   3 more (eslint-config-airbnb-base, eslint-plugin-import, eslint-plugin-eslint-plugin)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev eslint-plugin-flowtype@"^5.8.0 || ^8.0.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: eslint@8.1.0
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^8.1.0" from eslint-plugin-flowtype@8.0.2
npm ERR!   node_modules/eslint-plugin-flowtype
npm ERR!     dev eslint-plugin-flowtype@"^5.8.0 || ^8.0.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

This error is correct! However, the reason it's correct is because eslint-config-airbnb-base doesn't allow eslint v8 in its peer dep declaration. The displayed message, though, shows two ranges that are 100% compatible (^3 || ^4 || ^5 || ^6 || ^7 || ^8 and >= 7.5.0) and that both are satisfied by the current version of v7.32.0.

What would be most helpful here is to display the only one (I believe) that's incompatible, which is that of eslint-config-airbnb-base.

In general, I'd expect that the only time packages would be "collapsed"/lumped together is when their peer ranges were identical - otherwise, it's most helpful to show all of them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the peer dependency resolution shown in the issue and inspect Arborist's peer dependency error reporting. Done means the message identifies eslint-config-airbnb-base as the incompatible peer dependency and does not collapse peer ranges that are not identical.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.