-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
Fix propTypes in addon-background #2279
Conversation
@@ -118,7 +117,11 @@ BackgroundPanel.propTypes = { | |||
getQueryParam: PropTypes.func, | |||
setQueryParams: PropTypes.func, | |||
}).isRequired, | |||
channel: PropTypes.instanceOf(EventEmitter), | |||
channel: PropTypes.shape({ | |||
emit: PropTypes.func, |
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.
shouldn't all of these be required if the channel is supplied? should the channel be required as well?
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 have a defaultProp for channel, so it shouldn't be marked as required. As for particular shape, I basically just copypasted it from addons/knobs
(and it's the same as in addons/events
)
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.
Ideally, we should have this propTypes shape exported in @storybook/addons
and use it elsewhere. There is a couple of places with this line, which can be replaced with the shape as well:
channel: PropTypes.object, // eslint-disable-line react/forbid-prop-types
You can open a PR with such a refactoring if you feel like it =)
Codecov Report
@@ Coverage Diff @@
## master #2279 +/- ##
=======================================
Coverage 22.14% 22.14%
=======================================
Files 268 268
Lines 5893 5893
Branches 703 703
=======================================
Hits 1305 1305
Misses 4068 4068
Partials 520 520
Continue to review full report at Codecov.
|
See #2220 (comment)