-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Closed
Copy link
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: generator
Description
💻
- Would you like to work on a fix?
How are you using Babel?
Other (Next.js, Gatsby, vue-cli, ...)
Input code
(
a * (b // c
)) satisfies c;Configuration file name
No response
Configuration
/
Current and expected behavior
When parsing and re-printing (with no transforms) Babel generates this code:
a * b // c
satisfies c;It should instead wrap the LHS in parens, and generate
(
a * b // c
) satisfies c;Environment
- Babel 7.25.3
Possible solution
No response
Additional context
This is quite annoying to fix. We are currently checking if the expression contains any trailing comments, but we should instead check if any right-most descendants of the expression do.
Also, some cases already have parens due to operator precedence, so while fixing this issue we must make sure to avoid double parens, e.g.
(
a || (b // c
)) satisfies c;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: generator