-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Fix some peer dependency warnings #14572
[core] Fix some peer dependency warnings #14572
Conversation
@@ -150,6 +151,7 @@ | |||
"nyc": "^13.0.0", | |||
"postcss": "^7.0.0", | |||
"prettier": "^1.8.2", | |||
"prop-types": "^15.6.0", |
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.
prop-types
shouldn't be a peer dependency as per recommendation anyway: https://github.com/facebook/prop-types#how-to-depend-on-this-package
This is a workaround for libraries not following this recommendation (e.g. material-ui-pickers)
/cc @dmtrKovalenko
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.
Well spotted! We should fix that.
@@ -190,6 +192,7 @@ | |||
"url-loader": "^1.0.1", | |||
"vrtest": "^0.2.0", | |||
"webfontloader": "^1.6.28", | |||
"webpack": "^4.28.4", |
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.
Was a transitive dependency of size-limit
and rollup-plugin-size-snapshot
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.
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.
Right, I mispoke. What I wanted to say was:
Is a direct dependency of [...]
or
Is a transitive dependency due to [...]
@@ -28,7 +28,6 @@ | |||
"@emotion/core": "^10.0.0", | |||
"@emotion/styled": "^10.0.0", | |||
"benchmark": "^2.1.4", | |||
"emotion-server": "^10.0.6", |
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.
This is a migration/compat package only: https://emotion.sh/docs/ssr Not sure if a benchmark for those kind of packages is usefull? @oliviertassinari
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.
Wait, emotion-server package is legacy? How are we supposed to handle interoperability specificity?
Let's say I have a core component X that uses emotion but I also have a component Y that extends the style of X using styled-components. If I understand it correctly, styled-components with inject the CSS in the head when emotion will inject the CSS in the body. The SSR output specificity will be wrong (inverted). cc @tkh44.
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.
Not legacy. Just "compatibility and migration purposes". I don't think that applies to the benchmark in question. It would however apply to the use case you mentioned I think.
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 believe the emotion-server package solves these concerns: whatwg/html#1605 (comment)
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 don't understand why you derail this to emotion concerns? The package specifically states that this is a package for compatibility concerns. If you think that we need to benchmark this solution then I have no objections. Let's fix the warning and keep the benchmark then.
Criticizing emotion architectural choices here is misplaced. If you have problems with emotions architectural choices you can open issues in their repo.
@@ -97,6 +97,7 @@ | |||
"babel-plugin-transform-react-remove-prop-types": "^0.4.21", | |||
"babel-plugin-unwrap-createStyles": "link:packages/babel-plugin-unwrap-createStyles", | |||
"chai": "^4.1.2", | |||
"classnames": "^2.2.6", |
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.
Was transitive dependency due to:
- recharts
- react-draggable
- react-select
- react-virtualized
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.
It's a peer dependency of these packages? Why do we need to install it?
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.
No it's a peer dependency of notisstack
. notisstack
would fail if we would remove the packages I mentioned.
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.
And it is already installed. We're not adding any new packages to the bundle in this PR
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 think that the classname package of notistack should make it a dependency cc @iamhosseindhv.
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.
What about waiting for iamhosseindhv/notistack#72 resolution?
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.
We can always remove it once it's resolved. After all it's just an entry in the package.json.
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.
classnames
and prop-types
should be dependencies of notistack
. This will be published in the next version.
I'm fascinated by the number of yarn warnings we have, and yet, they are all false positive (everything works). |
You can look at them like a built-in Some are also just underspecified peer dependencies. The |
@eps1lon You are right, it's hiding core problems. Now, let's imagine people who are pressured by a deadline, and don't have the time to look closer what they must think about yarn warnings: it's just noise. I believe many people have learned to ignore them. We shouldn't encourage this! |
379709a
to
819955b
Compare
My main issue is that you don't have a place were you can ignore those warnings (and preferably include an explanation why). This was pretty annoying during the hooks alpha where basically every package triggered peer dependency warnings. Spotting an actual warning in 30+ warnings that do not cause harm is very hard. I would've liked to have some sort of warning whitelist where I can tell that this is fine because this alpha is stable enough to not cause any harm (or ran integration tests etc). All of this is responsibility of the dev in control of the package.json Yarn maintainers are at least aware of this issue: yarnpkg/yarn#4064 (comment) peer dependencies are not in a perfect spot but it's all we have so we should make the best of it. Since we have things like tree-shaking I rather have an unused package in my package.json and no warnings than a warning that I just ignore. |
@@ -28,6 +28,7 @@ | |||
"@emotion/core": "^10.0.0", | |||
"@emotion/styled": "^10.0.0", | |||
"benchmark": "^2.1.4", | |||
"emotion": "^10.0.7", |
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.
@oliviertassinari I think this is now a more realistic benchmark. emotion-server@10
should use emotion@10
but it was using emotion@9
before this change. emotion@9
is a direct dependency of react-select
and was therefore available for emotion-server
.
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.
We should be using emotion@10 exclusively. I can fix that later on.
Reduces noise from peer dependency warnings that were not problematic since the referenced packages were transitive dependencies.
These warnings are removed: