Skip to content
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

Merged
merged 3 commits into from
Nov 9, 2017
Merged

Conversation

Hypnosphi
Copy link
Member

@Hypnosphi Hypnosphi removed the request for review from ndelangen November 9, 2017 23:14
@@ -118,7 +117,11 @@ BackgroundPanel.propTypes = {
getQueryParam: PropTypes.func,
setQueryParams: PropTypes.func,
}).isRequired,
channel: PropTypes.instanceOf(EventEmitter),
channel: PropTypes.shape({
emit: PropTypes.func,
Copy link
Member

@danielduan danielduan Nov 9, 2017

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?

Copy link
Member Author

@Hypnosphi Hypnosphi Nov 9, 2017

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)

Copy link
Member Author

@Hypnosphi Hypnosphi Nov 9, 2017

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
Copy link

codecov bot commented Nov 9, 2017

Codecov Report

Merging #2279 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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
Impacted Files Coverage Δ
addons/background/src/BackgroundPanel.js 93.93% <ø> (ø) ⬆️
addons/background/src/index.js 86.36% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a8dc0fd...3baba88. Read the comment docs.

@Hypnosphi Hypnosphi merged commit 16cb94d into master Nov 9, 2017
@Hypnosphi Hypnosphi deleted the fix-background-propType branch November 9, 2017 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants