chore: make react-dom and react-native optional peer dependencies#9295
Open
Gudahtt wants to merge 3 commits into
Open
chore: make react-dom and react-native optional peer dependencies#9295Gudahtt wants to merge 3 commits into
react-dom and react-native optional peer dependencies#9295Gudahtt wants to merge 3 commits into
Conversation
The package `@metamask/react-data-query` has `react-dom` and `react-native` as `peerDependencies` because they are peer dependencies of a dependency this package uses, `@tanstack/react-query`. This "forwarding" of peer dependencies is something we started doing in our own packages because it better highlights the legitimate requirements of the package (transitive peer dependencies tend to not get surfaced by package managers when they're not met, you have to dig for it). However, `@tanstack/react-query` has these two peer dependencies as _optional_, as they should be. We forgot to document them as optional. This resolves an unnecessary peer dependency warning in `metamask-extension`.
1cf5a55 to
5e323b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
The package
@metamask/react-data-queryhasreact-domandreact-nativeaspeerDependenciesbecause they are peer dependencies of a dependency this package uses,@tanstack/react-query. This "forwarding" of peer dependencies is something we started doing in our own packages because it better highlights the legitimate requirements of the package (transitive peer dependencies tend to not get surfaced by package managers when they're not met, you have to dig for it).However,
@tanstack/react-queryhas these two peer dependencies as optional, as they should be. We forgot to document them as optional.This resolves an unnecessary peer dependency warning in
metamask-extension.References
N/A
Checklist
Note
Low Risk
Packaging and tooling metadata only; no application or library runtime logic changes.
Overview
@metamask/react-data-querynow marksreact-domandreact-nativeas optional peer dependencies viapeerDependenciesMeta, matching how@tanstack/react-querytreats them and stopping spurious peer warnings in consumers likemetamask-extension.The unreleased changelog documents the change,
yarn.lockreflects the updated workspace package metadata, andknip.config.tsadds apackages/react-data-queryignoreDependenciesentry for those two packages (linked to a known knip issue) so they are not reported as unused when they only exist as forwarded peers.Reviewed by Cursor Bugbot for commit 5e323b3. Bugbot is set up for automated code reviews on this repo. Configure here.