Export select prop types#1876
Closed
ecbrodie wants to merge 4 commits intoJedWatson:masterfrom
ecbrodie:export_select_prop_types
Closed
Export select prop types#1876ecbrodie wants to merge 4 commits intoJedWatson:masterfrom ecbrodie:export_select_prop_types
ecbrodie wants to merge 4 commits intoJedWatson:masterfrom
ecbrodie:export_select_prop_types
Conversation
Due to how the ES6 code is being transpiled, the exports statement in the Select component lib file were breaking tests.
Contributor
|
See also #1882 |
Author
|
@JedWatson do you have any feedback on this PR? Thank you. |
Contributor
|
@ecbrodie, can't you just use |
Author
|
The feeling when you look back at your own PR from 3 months ago and say "Shit, what was I thinking?" You are right @jochenberger . |
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.
The purpose of this PR is to allow the prop types from the
Selectcomponent to be exported. The use case that this satisfies is to allow an application using thereact-selectto build a custom wrapper around theSelectcomponent (ie, to allow for customizations that serve business needs of the application, such as specific default prop values), but not need to copy-paste prop type code fromreact-selectto satisfy the prop-type checks. This duplicated prop-type code can simply be replaced with an import ofSelectPropTypesfromreact-select.I also made a couple other minor improvements, to hopefully improve the development experience for
react-selectcontributors:.nvmrcfile. The README calls out that Node v4 should be used for development environments. Using this file enables better UX for contributors usingnvmCONTRIBUTING.mdFeedback welcome. I hope this PR adds value to this project. Thank you.
UPDATE
One more thing I should note. I originally tried to export
SelectPropTypesfrom the same file as theSelectcomponent,select.js. I did this as a named export, alongside the default export ofSelect. Unfortunately, this ended up breaking all tests of theSelectcomponent. I narrowed down the reason to behaviour of ES6 transpilation in this project. Before my changes (master branch),lib/Select.jswould contain this line:However, with the named export included, the
exportobject would have itsdefaultandSelectPropTypesproperties set accordingly, but that latter line formodule.exportswould not appear. I decided to work around this by keeping a single export (the default) inSelect.jsand extractingSelectPropTypesinto its own file with anexport default. I am open to hearing other suggestions to better exportSelectPropTypes. This could also be a pattern for the prop types of other components for future PRs, as needed.