-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support Flow typing in component_loader #187
Comments
If so, then this sounds good to me! I totally respect flow users and the Dash component archetype should be as flexible as possible. Could you point me to some code snippets in your |
Would any of these additions to
|
There's actually not that much more since the babel react preset already supports stripping Flow types. But here's a The user could actually set up their own eslint to extend the current Some related discussion about config via Modified next stepsIt does seem like after some further thought and your questions that the only thing really needed to support Flow out of the box is to modify the
If it makes sense, I or someone on my team can likely put something together for a |
I think that this makes sense and it seems like much lesser impact. Looking forward to seeing what this looks like! |
Description
Right now, creating a custom Dash component requires using the
prop-types
library.react-docgen
used indash-components-archetype
here does support Flow types, but themetadata.json
parser incomponent_loader
uses the fields generated from thePropTypes
attribute of the component. Development of new components would be a potentially better environment if it also supported using Flow (see, e.g., amaterial-ui
Dialog
component. It would also allow faster porting of React components already written with Flow to Dash components.Necessary pieces
dash-components-archetype
will need to useeslint-plugin-flowtype
dash-components-archetype
will need to usetransform-class-properties
in order to supportstatic defaultProps = {}
(not required, but would be nice), and thereact
preset already handles stripping Flow types.package.json
indash-components-archetype
would need (at least)eslint-plugin-flowtype
andbabel-plugin-transform-class-properties
metadata.json
will need to be generated using the generated Flow types (matching the current structure) indash-components-archetype
, if they exist orcomponent_loader
will need to support Flow types if they are found in themetadata.json
and the fields generated byPropTypes
are not found.Note that some of the code changes would occur in
dash-components-archetype
, but figured here might be a better place to discuss since thecomponent_loader
is the biggest "Dash user"-facing piece. There may also be other necessary pieces that I missed.We've set this structure up in the
material-ui
ports that we're using internally for our own material Dash components, and very much like it (we're also using jest for testing and would love to get the Dash toolchain updated to use React 16 since the current chain is tied to an older version of React).If this makes sense, I can create issues specifically on
dash-components-archetype
and plan to get this out in the next couple of weeks. There should not be any breaking changes anywhere from addressing this issue.Finally: insert flamewar about type hinting here 😄
The text was updated successfully, but these errors were encountered: