[ESCONF-15] implement conditionals require braces Created: 01/Mar/22 Updated: 19/May/22 Resolved: 19/May/22 |
|
| Status: | Closed |
| Project: | eslint-config-stripes |
| Components: | None |
| Affects versions: | None |
| Fix versions: | None |
| Type: | Bug | Priority: | TBD |
| Reporter: | Zak Burke | Assignee: | Unassigned |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original estimate: | Not Specified | ||
| Sprint: | |
| Development Team: | Prokopovych |
| RCA Group: | TBD |
| Description |
|
Overview: Conditionals should always be formatted with braces, no exceptions, not even for one-liners. Consistency is king. Clarity is king. Consistency and clarity are co-kings. |
| Comments |
| Comment by Jason Skomorowski [ 01/Mar/22 ] |
|
While I and any sane person agree multi-line if without braces is always wrong, I don't think there is as nearly that much consensus around your opinion here (as demonstrated by the AirBnB config we went with for our defaults allowing oneliners). If consistency is a co-king does the fact you want us to change every instance of:
if (a > b) doThing();
to:
if (a > b) {
doThing();
}
mean that we should, for consistency, also change: () => doThing(); to:
() => {
return doThing();
};
And (if ternaries can even have blocks?): (a > b) ? doThis() : doThat(); to:
(a > b)
? {
doThis();
}
: {
doThat();
};
But sure, I guess. If you really want, I'm okay with whatever. Especially if you're tidying up all the lint warnings. Because it's just not worth spending more attention, I think just having said this will suffice for me to move on. |
| Comment by Zak Burke [ 19/May/22 ] |
|
Many good points, Jason Skomorowski, and you're certainly correct that many people don't share my thinking on this. |