Skip to content

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

Open
@ljharb

Description

@ljharb

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 MichaelDeBoey/eslint-plugin-jsx-a11y@7dda470

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^8.1.0" from [email protected]
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority 2secondary priority issuews:arboristRelated to the arborist workspace

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions