-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Loops without braces #202
Comments
I see the options as
Prettier has had requests to add an option prettier/prettier#7659
Which has convinced me that not adding braces is probably the way to go. Also if we start adding braces then the CSharpier validation process needs to take that into account or it will report the new braces as a failure. |
Okay, in that case this bug should just track printing if/for blocks
without braces properly.
…On Mon, May 17, 2021 at 7:11 AM Bela VanderVoort ***@***.***> wrote:
I see the options as
1. Add braces automatically
2. Add an option to add braces automatically - which kind of goes
against the no options philosophy
3. Don't add braces - for people that do want to enforce braces they
could use style cop and it looks like this is what prettier does
Prettier has had requests to add an option prettier/prettier#7659
<prettier/prettier#7659>
Which lead me to
https://prettier.io/docs/en/rationale.html#what-prettier-is-not-concerned-about
Prettier only prints code. It does not transform it. This is to limit the
scope of Prettier. Let’s focus on the printing and do it really well!
Here are a few examples of things that are out of scope for Prettier:
- Adding/removing {} and return where they are optional.
Which has convinced me that not adding braces is probably the way to go.
Also if we start adding braces then the CSharpier validation process needs
to take that into account or it will report the new braces as a failure.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#202 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRDLPTJGA7MM6CX3PSIK3TOEPYFANCNFSM447KKATA>
.
|
I had foreach loop in my code without braces
and csharpier did this to it:
Should we make csharpier deal with conditions/loops without braces? Or should we just have it add braces automatically?
The text was updated successfully, but these errors were encountered: