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

Missing parens for ClassExpression with decorators #12257

Closed
fisker opened this issue Feb 7, 2022 · 0 comments · Fixed by #12260
Closed

Missing parens for ClassExpression with decorators #12257

fisker opened this issue Feb 7, 2022 · 0 comments · Fixed by #12260
Labels
lang:javascript Issues affecting JS type:bug Issues identifying ugly output, or a defect in the program

Comments

@fisker
Copy link
Sponsor Member

fisker commented Feb 7, 2022

Prettier 2.5.1
Playground link

--parser babel

Input:

(@f() class {});

Output:

@f()
class {};

Second Output:

SyntaxError: A class name is required. (2:7)
  1 | @f()
> 2 | class {};
    |       ^
  3 |

Expected behavior:

Should keep parens


Found this during #12241, when fixing this, should add this test back.

@fisker fisker added type:bug Issues identifying ugly output, or a defect in the program lang:javascript Issues affecting JS labels Feb 7, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant