#lazytwitter Can someone write an eslint rule that disallows` braceless if` when:
- newline before the expr
- >1 stmt on the same line
1/
-
-
I know you do! Not gonna get into JS. Agree on linting point.
-
yeah I don't need tail guards, but if (foo.isValid()) { return; } is a lot :)
-
with paren-free and getters and more targeted lints, that could have been: if foo.isValid return; Which seems fine for guards
-
the case of the "then" part being just 'return;' is indeed special: easy to read even when skimming.
-
the two special cases imo are `return` and simple throws (I abstract complex throws when used in guards to keep 'em shirt)
-
I like forcing return to be on next line because I see all exit points when scanning vertically
-
Especially useful when there is no highlighting, like in diffs
-
Both GitHub and Phabricator highlight syntax in diffs, right?
- 2 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.