Add "all" custom prop type and fix issues#323
Merged
levithomason merged 6 commits intomasterfrom Jul 5, 2016
Merged
Conversation
032cb3c to
1bf6080
Compare
| <Header.H4 color='blue'>Blue</Header.H4> | ||
| <Header.H4 color='purple'>Purple</Header.H4> | ||
| <Header.H4 color='violent'>Violent</Header.H4> | ||
| <Header.H4 color='violet'>Violet</Header.H4> |
1bf6080 to
96bfb89
Compare
| 'Invalid argument supplied to ofComponentTypes, expected an instance of array.' | ||
| ` See ${componentName} prop \`${propName}\`.`, | ||
| ].join('')) | ||
| } |
Member
Author
There was a problem hiding this comment.
Added validation to all custom prop types arguments. Some of these were being improperly used, so there was no validation happening at all.
Current coverage is 88.71%@@ master #323 diff @@
==========================================
Files 65 65
Lines 869 886 +17
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 773 786 +13
- Misses 96 100 +4
Partials 0 0
|
src/utils/propUtils.js
Outdated
| // mutually exclusive | ||
| const disallowed = _.transform(exclusives, (acc, exclusive) => { | ||
| if (_.has(props, propName) && _.has(props, exclusive)) { | ||
| return acc.push(exclusive) |
Member
There was a problem hiding this comment.
.push returns what you pushed. Should it be return acc.concat(exclusive)?
Sidenote: feel like reduce or filter is more declarative, but is tangential to the above comment.
Member
Author
There was a problem hiding this comment.
ack! thanks, had a spread operator here earlier.
Member
|
👻 |
Contributor
|
🐧 looks good |
jhchill666
pushed a commit
to jhchill666/stardust
that referenced
this pull request
Jul 19, 2016
* fix(Header): fix color typos * feat(customPropTypes): add "all", clean up, add validation * refactor(Accordion): use "all" custom prop type * refactor(Item): use "all" custom prop type * fix(propUtils): mutuallyExclusive reduce * fix(customPropTypes): grammar and array join
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds the
all()custom prop type. This allows passing multiple prop type checkers. It is needed in #321 and elsewhere to validate mutually exclusive props.I also fixed a number of prop type issues and updated components using mutuallyExclusive.