I think this style ("npm style") is trying too hard to be clever without much benefit. Classic JavaScript style (see: Crockford) has done just fine and is familiar to everyone who knows C-style syntax. No reason to change it now.
I'd rather consistently have semicolons at the ends of lines than crap like this:
It's easier to always include the semicolons at the end of statements rather than try to figure out the edge cases where missing a semicolon would change the behavior.
I'm also not a fan of the "comma-first" style, especially for var declarations...
var foo
, bar
, baz
;
I prefer:
var foo;
var bar;
var baz;
It's fewer lines, consistent, symmetrical, and it's impossible to introduce errors through copy/paste or reordering.
It seems less cluttered. You can of course introduce errors through copy/paste/reordering, but I think it's a reasonable tradeoff. I agree about comma/semicolon-first being strange though.
I'd rather consistently have semicolons at the ends of lines than crap like this:
It's easier to always include the semicolons at the end of statements rather than try to figure out the edge cases where missing a semicolon would change the behavior.I'm also not a fan of the "comma-first" style, especially for var declarations...
I prefer: It's fewer lines, consistent, symmetrical, and it's impossible to introduce errors through copy/paste or reordering.