#lazytwitter Can someone write an eslint rule that disallows` braceless if` when:
- newline before the expr
- >1 stmt on the same line
1/
-
-
I think if-then on one line can be part of a consistent style, but it adds a small risk delta. I've avoided it since my Pascal days.
-
with a good linter, the risk Delta should be 0
-
I really miss ruby tail guards: def foo(bar) return unless bar.valid? # rest of function end
-
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)
- 5 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.