-
Notifications
You must be signed in to change notification settings - Fork 3
Update documentation to suggest the use of --parser=flow
or --parser=bablyon
#6
Comments
@fkling Hi Felix - you're right, we should make that clear. I haven't had time to try the different parsers or update the examples, but in the meantime will update the readme to note their availability. Thanks! |
@fkling Hi Felix - when I add
Any idea what might be going on? Happy to open an issue, but thought I'd check with you first in case it's something obvious I'm doing. |
Great! (that you got a useful stack trace, not that you get an error :-/ ) I ran into this issue as well in astexplorer (when I used This looks like a problem with ast-types. It seems there is a If you can find out which exact declaration produces the error (maybe it's similar to mine?), we can look at the corresponding ast-types definition and see what needs to be updated. |
Yeah, I think you're right that it's ast-types. Here's the file that I was parsing:
I think you may just need to upgrade ast-types? But FYI just talked to @samwgoldman and there will probably be another change coming (type param variance annotations are currently just strings, but will become subnodes reused by property variances). Noob question, but is there any way things could be set up to spare you the manual labor of checking and updating the flow parser's dependencies? |
... to include `TypeParameter` information (d5ce0400511bdf6b063c13728c4fa09edd9e122d). See also flow/flow-codemod#6 (comment) .
A fresh install of jscodeshift should always pick up the latest version of recast. Unfortunately, the current version of recast (v0.11.10) is locked to ast-types v0.8.17, which doesn't contain the I created a PR (benjamn/recast#304) to update recast to use ast-types v0.8.18. A fresh install of jscodeshift (and recast) should then fix the issue. No need to make any changes to jscodeshift itself, but we can update the recast version in |
... to include `TypeParameter` information (d5ce0400511bdf6b063c13728c4fa09edd9e122d). See also flow/flow-codemod#6 (comment) .
... to include `TypeParameter` information (d5ce0400511bdf6b063c13728c4fa09edd9e122d). See also flow/flow-codemod#6 (comment) .
Ah, ok. I'll check back and bump the docs once recast is up to date and the workflow goes through - it'll be a big plus for flow-based codemods, that's for sure. Thanks again for adding the option! |
Just FYI, using flow should work fine by now 😃 |
I noticed that you warn users that not every files may be parsed with Babel 5.
Since v0.3.21, jscodeshift allows to specify a different parser, including flow and babylon. I haven't done extensive testing yet, but if you find that either parser works for your use cases, updating the examples to include
--parser=...
could be useful.The text was updated successfully, but these errors were encountered: