-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Tidy Code does not indent nested blocks properly if braces are missing #1815
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
Comments
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already. |
Thanks for reporting! I just checked if this will indent in your expected way with the merge of #1788, and it still puts them on the same line. I think this is actually a matter of code style, and both prettier and beautify-js enforce that if/else statements without curly braces should be on one line. I personally agree with this rule and think it should be enforced—I rarely use if/else statements without curly braces because I think it can lead to bugs if you need to update the logic in the future and want to change the body of the if/else statements to have multiple lines. I found some discussion in the prettier repository about this that seems to be unresolved: prettier/prettier#3049 |
Nature of issue? Bug
Details about the bug:
a)Check this Sample editor file
Here are the contents for ease of access
a. Expected, this code is already indented properly: if and else lines up. No change should occur
b. Actual: else gets aligned with previous block(while, do or for)
The text was updated successfully, but these errors were encountered: