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

Babel turn invalid code to valid code #10412

Closed
fisker opened this issue Feb 26, 2021 · 3 comments · Fixed by #10416
Closed

Babel turn invalid code to valid code #10412

fisker opened this issue Feb 26, 2021 · 3 comments · Fixed by #10416
Labels
lang:javascript Issues affecting JS 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

@fisker
Copy link
Member

fisker commented Feb 26, 2021

Found in #10410, espree also not handle this code well eslint/espree#470

Prettier 2.2.1
Playground link

--parser babel

Input:

(a = b) = 1

Output:

a = b = 1;

Expected behavior:

Should throw SyntaxError.

@fisker fisker closed this as completed Feb 26, 2021
@fisker
Copy link
Member Author

fisker commented Feb 26, 2021

Sorry, fixed code still invalid.

@thorn0
Copy link
Member

thorn0 commented Feb 26, 2021

What about (a = b) = 1 then?

@fisker fisker reopened this Feb 26, 2021
@fisker
Copy link
Member Author

fisker commented Feb 26, 2021

Nice catch, we should throw an error on this.

@fisker fisker added lang:javascript Issues affecting JS type:bug Issues identifying ugly output, or a defect in the program labels Feb 26, 2021
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jun 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS 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

Successfully merging a pull request may close this issue.

2 participants