You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
Sometimes I write code formatted like this:
----------
if (condA) {
console.log('A');
} else // <- ?
if (condB) {
console.log('B');
} else {
console.log('else')
}
----------
(I do this when condA and condB are symmetrical and could be swapped without
side-effects).
In this case linter complains "Missing semicolon at end of line" (line 3).
I.e it seems to believe I should add a semicolon directly at "else;".
This is clearly am incorrect warning.
(If I do add a ";" it luckily catches that and reports as an error).
---------
A second note is that linter doesn't seem to enforce any particular style for
the last "else" though. I can write all combos of else and braces without
complaint.
----
} else {
..
}
---
} else
{
..
}
---
}
else
{
..
}
------
To me this kindof indicates I could be allowed to format middle "else" to my
liking too? (I don't find anything about this if-else in the Google code style
guide either. Although I'm aware that writing "else if" on same line is more
common).
Regards
/ Fredrik Blomqvist
Original issue reported on code.google.com by fblomqvist@gmail.com on 18 Oct 2013 at 8:38
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
fblomqvist@gmail.com
on 18 Oct 2013 at 8:38The text was updated successfully, but these errors were encountered: