Skip to content

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