Skip to content
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

Enable more flow parser options #281

Merged
merged 2 commits into from
Dec 3, 2018
Merged

Conversation

jbrown215
Copy link
Contributor

@jbrown215 jbrown215 commented Oct 26, 2018

tokens is an undocumented flag that adds the tokens to the output ast.
https://github.com/facebook/flow/blob/master/src/parser/libflowparser.ml#L60

This is necessary for the newest version of recast, which will use the esprima parser if the tokens aren't present: https://github.com/benjamn/recast/blob/master/lib/parser.js#L44-L48. The esprima parser doesn't parse JSX, which makes running jscodeshift on files with jsx in them fail when relying on the new version of recast. To repro, update the recast version and run a codemod on a file with JSX-- you will get a parse error.

It will be necessary to upgrade the recast dependency in order to support the new ... syntax for flow inexact objects.

Is there a reason not to include all of the proposal parsers? I enabled optional chaining and nullish coalescing because the rest were enabled.

@fkling fkling merged commit 8574771 into facebook:master Dec 3, 2018
@fkling
Copy link
Contributor

fkling commented Dec 3, 2018

There was actually a typo in your PR 😉 (token instead of tokens). I have fixed that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants