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

JSX spread operator syntax error on the flow parser #3898

Closed
vjeux opened this issue Feb 6, 2018 · 3 comments
Closed

JSX spread operator syntax error on the flow parser #3898

vjeux opened this issue Feb 6, 2018 · 3 comments
Labels
lang:flow Issues affecting Flow-specific constructs (not general JS issues) locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@vjeux
Copy link
Contributor

vjeux commented Feb 6, 2018

Prettier 1.10.2
Playground link

--parser flow

Input:

<JSX>
  {...edges}
</JSX>

Output:

SyntaxError: Unexpected token ... (2:4)
  1 | <JSX>
> 2 |   {...edges}
    |    ^^^
  3 | </JSX>

It works in babylon, so my guess is that we just need to upgrade flow and it should just go away.

@vjeux vjeux added type:bug Issues identifying ugly output, or a defect in the program lang:flow Issues affecting Flow-specific constructs (not general JS issues) labels Feb 6, 2018
@j-f1
Copy link
Member

j-f1 commented Feb 6, 2018

What does this even do? the Babel 6 REPL passes the spread through unchanged, even in ES5 mode. Babel can’t parse the result in standards mode, either.

@vjeux
Copy link
Contributor Author

vjeux commented Feb 6, 2018

I have some more context. In React currently we don't need to use ... because the type of a child in React is either an object or an array of objects. We're playing around with a version of React that doesn't handle arrays and you've got to manually spread in order to get the same behavior. We have a custom jsx transform step for it.

It's unclear at this point if we are going to move forward with it but the latest version of both flow and babylon are parsing it so it shouldn't be a burden on prettier to print it.

@mroch
Copy link

mroch commented Feb 6, 2018

facebook/jsx#57

It's part of JSX now

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:flow Issues affecting Flow-specific constructs (not general JS issues) locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

3 participants