Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

fix(rome_js_formatter): Unnecessary parentheses for return/unary with verbatim argument #3736

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Nov 15, 2022

Summary

This PR fixes #3735 by only adding parentheses around the argument if the argument isn't suppressed. This is necessary because the verbatim formatting of the argument includes the parentheses too. Formatting the parentheses in the return/unary formatting and as part of the verbatim results in duplicating the parentheses on every save.

Test Plan

I added a handful of new tests covering the problematic cases.

… verbatim argument

## Summary
This PR fixes #3735 by only adding parentheses around the argument if the argument isn't suppressed. This is necessary because the verbatim formatting of the argument includes the parentheses too. Formatting the parentheses in the return/unary formatting and as part of the verbatim results in duplicating the parentheses on every save.

## Test Plan
I added a handful of new tests covering the problematic cases.
@MichaReiser MichaReiser added the A-Formatter Area: formatter label Nov 15, 2022
@MichaReiser MichaReiser added this to the 11.0.0 milestone Nov 15, 2022
@netlify
Copy link

netlify bot commented Nov 15, 2022

Deploy Preview for docs-rometools canceled.

Name Link
🔨 Latest commit bd228f4
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/6373511d603d2800085d579b

@MichaReiser MichaReiser merged commit 577f735 into main Nov 16, 2022
@MichaReiser MichaReiser deleted the fix/return-unary-parentheses branch November 16, 2022 08:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Formatter introduces infinite parentheses around certain logic expressions over time
2 participants