-
Notifications
You must be signed in to change notification settings - Fork 657
🐛 loop/if with empty statement body #2448
Comments
This is probably a common issue in all places where an |
Additionally |
We added |
Following the conversation in #2504 So you'd prefer to stick with compatibility, then implement the lint rule and then in that case to change the formatter to accommodate the lint rule? In case what I said would happen (it might not), how should we justify the change? Why you'd prefer to accomodate the formatter now and then revert it to a accomodate the linter later? Wouldn't this be seen as a change of opinion? |
What about the formatter would need to change? I don't think that Prettier prevents you from always using blocks. It just allows you to omit them in certain cases. I think our formatter should do what Prettier does. If you run the We can still have opinionated autofixes as part of our linter (e.g. the |
Yes, there's an incompatibility and I would like to understand how we should move. I will show everything so everyone has a clear picture of things will be. The incompatibility is how our linter will react to this code. Example of code: do; while(true); Then it's formatted, prettier's style: do;
while (true); Then the our linter will execute and it will show error because of the rule do {
} while (true); Now, I don't see anything wrong in this flow, it's just that it seems weird that we have to provide an autofix inside the linter while we can do that inside the formatter. At the end, the code we will have inside Rome is the last example because everything will be passed under the So wouldn't be faster to just change the style inside the formatter instead of having a lint rule too? Do you think I am overthinking this? Is this flow normal? |
Did you mean What I meant by "incompatibility" is if the formatter changes code from But the code
It might be a little faster, but I don't think that warrants violating our commitment to embracing Prettier's styling decisions for our formatter. We could consider having a more opinionated option in the future, but I don't think that's a priority.
That's only when they choose to use |
@leops what's your opinion on this one? I don't mind both approaches. |
I think since we aim to have an integrated formatter + linter experience we can actually do both at the same time: if users want to use the formatter in Prettier-compatible mode they get a fixable diagnostic in their editor, but if they opt-in to use our own configuration for the formatter we can disable the corresponding lint rule in the analyzer and just rewrite their code with braces when the file gets formatted |
Given the discussion, we could re-open #2504 and apply the first solution. |
Environment information
What happened?
yarn format
(rome format .
)yarn
Expected result
Rome should correctly format cjs without breaking it or not touch cjs at all.
Code of Conduct
The text was updated successfully, but these errors were encountered: