Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix peer warning message requester (#6376)
## What's the problem this PR addresses? When an incompatible peer warning occurs, the warning message shown during install simply uses the first peer requester found but that may not have any relation to the unsatisfied request. See #6205 (comment) (partial fix) ## How did you fix it? Actually find the first unsatisfied requester, prioritizing root requesters (i.e. direct dependencies). If an unsatisfied root requester is found, the warning message looks similar to 4.2.2 ![image](https://github.com/yarnpkg/berry/assets/41266433/08a3b91e-ed03-4002-9f60-e982a8d7189b) ``` ➤ YN0000: ┌ Post-resolution validation ➤ YN0060: │ react is listed by your project with version 18.3.1 (pfa021), which doesn't satisfy what reflux and other dependencies request (but they have non-overlapping ranges!). ➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code. ➤ YN0000: └ Completed ``` If all root requesters are satisfied, then an unsatisfied requester is found and reported with one of the corresponding root requesters ![image](https://github.com/yarnpkg/berry/assets/41266433/753f7b94-2151-47b0-ac04-69621de8e355) ``` ➤ YN0000: ┌ Post-resolution validation ➤ YN0060: │ react is listed by your project with version 18.3.1 (pfa021), which doesn't satisfy what reflux (via @local/test-reflux-dependent) and other dependencies request (but they have non-overlapping ranges!). ➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code. ➤ YN0000: └ Completed ``` One concern I had was that it will make the message longer, but we are already way past the common terminal width so I don't think that's a big issue. ## Checklist <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed. --------- Co-authored-by: Maël Nison <[email protected]>
- Loading branch information