Check consistent if bracing with eslint
Categories
(Developer Infrastructure :: Lint and Formatting, enhancement)
Tracking
(firefox67 fixed)
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: mak, Assigned: mak)
References
Details
Attachments
(1 file)
We use to enforce (in reviews) a rule where if a side of an if/elseif/else is braced, all the sides should be braced.
In general I think it makes sense from a readability point of view, and can prevent cases where the else body may be wrongly interpreted; for example bug 1528486.
It would also not prevent people from using non braced constructs, provided all the sides are non braced.
Assignee | ||
Comment 1•5 years ago
•
|
||
This requires us to also enable "multi-line", that is currently commented out.
There was some discussion here https://bugzilla.mozilla.org/show_bug.cgi?id=1229097#c20
Assignee | ||
Comment 2•5 years ago
|
||
Looks like this is tricky, none of the ruleset works for us, the closer to our needs would be allowing to just use "consistent", without any other rule :(
Comment 3•5 years ago
|
||
We've been having some initial discussions about a JS formatter for the tree (similar to clang-format). As there's not a clear rule we could use, it might be better to put this off until we have some idea of the direction we're going to go with there.
Or we could have discussions about changing the style completely, but I'm inclined to wait a bit.
Assignee | ||
Comment 4•5 years ago
|
||
Could we write a mozilla-only rule checking consistent? It should be possible right?
Assignee | ||
Comment 5•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/74ce5e253d22 Add a custom eslint rule to check "consistent" if bracing. r=Standard8
Comment 7•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/comm-central/rev/d8419a366f68 Port bug 1528751 - fix inconsistent if bracing. r=me DONTBUILD
Updated•2 years ago
|
Description
•