Prettier Options compatibility #2465
Replies: 7 comments 58 replies
-
TabsBoth Rome and Prettier support the Rome defaults to ProposalKeep tabs as the default. Default to |
Beta Was this translation helpful? Give feedback.
-
Quote PropsThe quote props option specifies if the formatter should remove quotes around props that aren't syntactically necessary. Rome doesn't support this option today. The reason why quote props is configurable in Prettier is that quoted props prevent minifiers from mangling that property name. ProposalDon’t add support for quote props and hint users towards NoteImplementing the removal of quote props is tracked in #2405 |
Beta Was this translation helpful? Give feedback.
-
SemicolonsPrettier supports the semicolons option that specifies if semicolons should be inserted at the end of statements. ProposalDon't add support for it. My research shows that the option isn't widely used:
Edit: |
Beta Was this translation helpful? Give feedback.
-
Trailing CommasThe trailing commas option configures where to insert trailing commas. It supports three different configurations:
The reason Prettier added this option is for backward compatibility because trailing commas have only been supported in a few places prior to ES2017 and TypeScript 2.7. Thus, it would have been necessary to transform the source code if targeting a runtime that doesn't support ES2017.
ProposalDon’t support the trailing comma option because all modern engines support them today and the sole reason the option was introduced by Prettier is for compatibility’s sake. Prettier even changed the default from AlternativesImplement the option and either:
|
Beta Was this translation helpful? Give feedback.
-
JSX Quotes, Bracket Spacing, Bracket Line, and Arrow Function ParenthesesPrettier mentions on their philosophy page that they find these options harder to motivate and only keep them because it's difficult to remove them now:
ProposalTake Prettier's learning and don't add these options to Rome. Hopefully, this will help Prettier too to remove these options at some point in the future. |
Beta Was this translation helpful? Give feedback.
-
Hey @vjeux would you have a moment to share some of your experience from working at Prettier? I love Prettier's philosophy document and I have the impression you really figured it out what options you want and don't want to support! I also think it would be great if our options share the same semantics to reduce friction and confusion in the community. I've also been wondering what Prettier's plan is for the upcoming 3.0 release. Does Prettier plan to change any defaults or to deprecate or remove any options? |
Beta Was this translation helpful? Give feedback.
-
I would love to see the option to disable parenthesis on JSX. Rome and Prettier rewrite code with wrapping parenthesis all over JSX components and it creates a lot of ugly noise and mess. See this largely ignored request on Prettier repo: prettier/prettier#2724 (comment) Switching to Rome doesn't seem so useful if it produces the same output as Prettier. Some kind of option like this on Rome would help a large list of people on that thread since Prettier won't budge on it. |
Beta Was this translation helpful? Give feedback.
-
The goal of this discussion is to come to an agreement on what JavaScript Prettier options Rome should support and what values it should use as defaults. The discussion will also serve as a reference for our reasoning in the future.
Rome supports the following Prettier options today:
These options aren't part of this discussion except if Rome and Prettier use different defaults.
Supporting fewer options is desirable from a technical position because it reduces the number of possible option combinations, which reduces the overall complexity. The main non-technical benefit is that it removes debates about what the "right" formatter configuration is, one of the main goals of Rome's formatter. You can read more in Prettier's excellent philosophy documentation.
This discussion is related to the Formatter options discussion but is focused on inheriting options from Prettier.
Beta Was this translation helpful? Give feedback.
All reactions