Hacker News new | past | comments | ask | show | jobs | submit login

I love these kind of style guides. But I also love to prove them wrong.

Unless you "use strict", it's better to put var in-front of every variable if you put them on separate lines.

  var foo = 1,
      bar = 2
      baz = 3
vs

   var foo = 1;
   var bar = 2;
   var baz = 3;
Forgetting a comma or semicolon in the first example might lead to silent bugs that will take hours to find.



Isn't this exact rule already in the guide?

https://github.com/airbnb/javascript#13.2


Ahh, someone might just have added it to troll me, or I'm crazy.


If you add a lint checker, like jshint, to your build steps those kinds of bugs are found instantly. You can also add these specific style guide checks to your build steps using jscs (https://www.npmjs.com/package/jscs).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: