Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix: add missing peer dependencies#9744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -78,6 +78,11 @@ | ||||||||||||
"rimraf": "*", | ||||||||||||
"typescript": "*" | ||||||||||||
}, | ||||||||||||
"peerDependenciesMeta": { | ||||||||||||
"typescript": { | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. [Question] Shouldn't this also be listed in ContributorAuthor
|
"peerDependenciesMeta": { | |
"typescript": { | |
"optional":true | |
} | |
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ha, nice, so this might be an existing issue in that package then? My vote is to fix in both packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Just came here to say that appearently at least both Yarn and pnpm have opted in the past to have "peerDependenciesMeta
withoutpeerDependencies
" imply a peer dependency on*
. This was done due to some (legacy?) npm behavior regarding peer dependencies, making package authors hesistant to list them. Seepnpm/pnpm#2128.
But it's probably a better practice to explicitly list them; and given the age of the referenced issue probably safe enough as well.
bradzacherNov 12, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The reason we usedpeerDependenciesMeta
withoutpeerDependencies
was because there were versions of npm that did not supportpeerDependenciesMeta
. This meant that when we used an explicitpeerDependencies
then users would be spammed with warnings saying they didn't have TS installed. This was a problem as some big packages included our plugins by default but only used them if the user opted in to TS which caused non-TS users to get spammed with missing peer dep errors.
A this point we could probably also include the explicitpeerDependencies
on TS but also there's no harm in not including it and having it inferred to ensure that nobody gets spammed with logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do you know ifnpm
also shares this behavior ofpeerDependenciesMeta
implyingpeerDependencies
? From a cursory search of the npm sources it seems to me like it doesn't:https://github.com/npm/cli/blob/75a3f1228865f426d8790be27f1258e501f2c450/workspaces/arborist/lib/node.js#L859-L871
Anyways, what do we think of merging this PR first and moving the discussion about whether or not to list an explicit peerdep to a different issue? We don't need to block fixing users' warnings on figuring out the proper manifest declarations 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm 👍 on that. If nobody else weighs in with a contrary opinion by our weekly release midday Monday EST then we can just merge as-is.
Now that you mention it, I do like the idea of having one release just addingpeerDependenciesMeta
, then a subsequent release addingpeerDependencies
on top. Just in case there's some bizarre edge case bug with the latter.
Uh oh!
There was an error while loading.Please reload this page.