This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
[doctor] check for @types/react-native on 48+ (and other things you shouldn't install directly) #4731
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.
Why
@types/react-native
is now included withreact-native
. Including the wrong/ old version of types could lead to... issues with types.How
This looks more complicated than it sounds. That's because I'm starting a refactor with bigger goals in mind :D. I could have wedged this check as a conditional into the existing
PackageJsonCheck
, but the SDK filter happens for each check file, so I'd either duplicate that, or.......introduce a
DoctorMultiCheck
that can filter by SDK by each individual item in a check, but, at least for now, without breaking theDoctorCheck
interface. Combined with extracting the precise message for each package, this makes it easier to define additional checks of the same type as configuration. This use case is very simplistic, but the pattern would really sing once we have, say, a singleDeepDependencyCheck
with all those defined as configuration, running 100% in parallel, etc.Bonus
Added the check for yarn/ npm direct installs because onto this because it's just another item in the list (and noticed some issues in the wild with it again).
Test Plan
types/react-native
npm:
Tagging @byCedric to at least confirm that the test for
@types/react-native
itself is accurate (I couldn't find much info about this change after you mentioned it).