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

Support type annotation for rest argument on babylon parser #133

Merged
merged 1 commit into from Jan 12, 2017

Conversation

vjeux
Copy link
Contributor

@vjeux vjeux commented Jan 11, 2017

This is working on the flow parser but not babylon

echo 'function f(...flags: Array<boolean>) {}' | ./bin/prettier.js --stdin
function f(...flags: Array<boolean>) {}

This is working on the flow parser but not babylon

```js
echo 'function f(...flags: Array<boolean>) {}' | ./bin/prettier.js --stdin
function f(...flags: Array<boolean>) {}
```
@vjeux vjeux mentioned this pull request Jan 11, 2017
13 tasks
@hzoo
Copy link
Contributor

hzoo commented Jan 11, 2017

@vjeux if you have time, can you report these kinds of issues in babylon/recast as well if relevant?

@vjeux
Copy link
Contributor Author

vjeux commented Jan 11, 2017

I'm curious, what kind of issue are you looking for? Is the fact that the AST is different an issue worth raising?

@jlongster
Copy link
Member

To me your comment implies that the babylon parser doesn't have the typeAnnotation property on RestElement types. Is that why it doesn't work for babylon?

@jlongster
Copy link
Member

@hzoo This probably isn't the best place to talk about this, but it's worth noting that the jest test suite does not pass with babylon. The test runner passes the useFlowParser: true option always. I think some of it is whether it's parsing a file as a module or not and some strict mode checks or something. We should see what it takes to get it running.

@vjeux
Copy link
Contributor Author

vjeux commented Jan 11, 2017

For flow, it's in the Identifier inside of RestElement

image

For babylon, it's in the RestElement

image

@jlongster
Copy link
Member

Aaah very interesting. Ok, thanks!

@jlongster jlongster merged commit 809aabc into prettier:master Jan 12, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants