-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add requireDirective to strip-flow-types for use in React preset #5468
Conversation
@existentialism, thanks for your PR! By analyzing the history of the files in this pull request, we identified @danez to be a potential reviewer. |
027b72c
to
f9a2958
Compare
Should add this to the migration guide also that flow is not included in react anymore. |
I do kinda like @spicyj's suggestion (mentioned in the OP now) of "Another option would be to add a flag to flow-strip-types that will only strip types if a so it's opt-in per file |
f9a2958
to
2eafa05
Compare
2eafa05
to
c89c1bc
Compare
e45929b
to
10251b9
Compare
What would people think about throwing an error if the file contains Flow annotations without My motivation for wanting to remove Flow-stripping from |
No objections from the React side and also received positive thoughts from Flow folks on our end. This seems like a good change. No hard opinion on @loganfsmyth's proposal but I guess erroring early sounds a little nicer. Is there a way to add the syntax-flow plugin only if the file has the directive? |
@spicyj that particular change can't really work we can't know anything until it's parse already (so have to parse beforehand, or need to redo how that works which would reparse I think? |
Yeah, for now instead of |
10251b9
to
af5f34a
Compare
@hzoo @spicyj @loganfsmyth updated! |
|
||
## Options | ||
|
||
### `development` |
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 think we can explain here/somewhere that you can use this in another "env" either via "env" config in babelrc (although we didn't deprecate yet), or via babelrc.js
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.
nice work!
"babel-plugin-transform-react-display-name": "7.0.0-alpha.18", | ||
"babel-plugin-transform-react-jsx": "7.0.0-alpha.18", | ||
"babel-plugin-transform-react-jsx-self": "7.0.0-alpha.18", | ||
"babel-plugin-transform-react-jsx-source": "7.0.0-alpha.18", | ||
"babel-preset-flow": "7.0.0-alpha.18" | ||
"babel-plugin-transform-react-jsx-source": "7.0.0-alpha.18" |
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.
duplicate dep here!
1764e68
to
2a83867
Compare
Let's keep the 7.0 fun train rolling!
- Removes flow preset from preset-react, (https://twitter.com/left_pad/status/841744171723587585).EDIT Another option would be to add a flag toflow-strip-types
that will only strip types if a@flow
declaration is present, and thenpreset-react
could just pass that flag.EDIT 2
flow-strip-types
now has arequireDirective
option, whichpreset-react
uses.development
flag to preset-react as env support is being deprecated