-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[added] styleMaps.addStyle and CustomPropTypes.keyOf #496
Conversation
let valuesString = JSON.stringify(Object.keys(obj)); | ||
return new Error( | ||
('Invalid prop `' + propName + '` of value `' + propValue + '` ') + | ||
('supplied to `' + componentName + '`, expected one of ' + valuesString + '.') |
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're using ES6 you can use string interpolation here to clean this up: http://babeljs.io/docs/learn-es6/#template-strings
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.
Would that be preferable even with needing to escape the backticks within the string? I basically copied the code from ReactPropTypes
createOneOfChecker
. The surrounding code also doesn't use interpolation.
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.
Is there any major advantage to backticks in the error message? We could just change them to quotes.
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 didn't change everything to ES6 templates when I switched everything to ES6, I'm just trying to keep things as clean as possible going forward.
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.
That's fine with me. I think they're a bit odd anyway. The only issue is consistency with React error messages, but that seems minor.
This looks really great I like the simplicity of it. We should really add some documentation for this though so folks are aware that this is possible without combing the issues to find it. The Components page does not feel right for this though. I'm wondering if we should add a "Customize" page to the docs. This is partly why I feel that the |
Perhaps splitting off the styles from the other constants would be better, since they're the only ones likely to be extended by users? They could be in a module called |
#404 Is one such example where the Classes could be modified. But you're right that the Sizes and Glyphs should need to be exported. |
The code looks great! Can you squash the commits with a commit message following the Contributing Guidelines? A commit message of that formate will reflect the change in the automated changelog when we release. |
Squashed and also fixed a warning by removing unused |
[added] styleMaps.addStyle and CustomPropTypes.keyOf
Thanks! |
…p#496) * chore(package): update enzyme to version 3.9.0 * chore(package): update enzyme-adapter-react-16 to version 1.9.1 * chore(package): update lockfile package-lock.json
Proposed fix for #306 and partial fix for #440.