Open eliasmalik opened 8 years ago
At present the rule is requiring the else statement to start on the same line as the closing brace for the if
:
if (condition) {
// do things
} else {
// do alternative things
}
I prefer the else
on the next line for legibility ...
if (condition) {
// do things
}
else {
// do alternative things
}
Anyone have thoughts on this?
@eliascodes I very much prefer to use the Stroustrup
brace style
putting the else
block start on the same level of indentation as the if
as shown in the second example above makes the code more readable IMO...
If nobody has any objections I would like to enforce "stroustrup"
as our brace-style
...
@nelsonic I have no particular objections, might want to ask someone who uses goodparts
on a daily basis though.
Also be aware that JSLint takes the opposite view:
@eliascodes great point! 🔍
Yeah, http://jslint.com/ expects "double-quotes"
for String
and four-spaces
indentation ... 😕
Are we going to "conform" to all the JSLint "stylistic suggestions"...? 🤔
@nelsonic not necessarily, I was just pointing it out. Like I said, I'm happy either way. You can make arguments for legibility/comprehension on both sides I think.
http://eslint.org/docs/rules/brace-style
Use 1tbs by default, allow single line statements, although should only use them in v. simple cases