Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow curly on line following multi-line conditional? #747
Comments
dcousens
added
the
question
label
Jan 14, 2017
This comment has been minimized.
This comment has been minimized.
|
I personally prefer writing it like so: if (
long_condition_1 ||
long_condition_2 ||
long_condition_3
) {
body()
}Whatever the preferred way, I would love it if standard would enforce it :) |
This comment has been minimized.
This comment has been minimized.
|
@LinusU Yes, that is my preferred form for multiline if-statements as well. |
This comment has been minimized.
This comment has been minimized.
stale
bot
commented
May 10, 2018
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
stale
bot
added
the
stale
label
May 10, 2018
feross
added
the
enhancement
label
May 11, 2018
stale
bot
removed
the
stale
label
May 11, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thejohnfreeman commentedJan 14, 2017
Right now, long conditionals broken over multiple lines must be formatted like this:
In these circumstances, if I want the condition visually distinguished from the body, then I have to indent it differently (e.g. 4 spaces). I would prefer to put the curly on its own line:
I searched and didn't find this issue discussed here, so wanted to bring it up (please point me to the original if this is a duplicate). I also don't see a customization of the eslint curly rule that would permit this. Is there a popular alternative, e.g. do people really break long conditionals into separate variables? Or can we get this format in standard?