Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're going to use JS, you're not allowed to change things like this. It just causes problems for people.

Easy solution, use CoffeeScript and have it compile down to JS. My favorite feature of CoffeeScript is the ruby/python line conventions spacing (2 spaces, no tabs), and no semicolons.

They're already compiling the CSS from Less. Seems natural to add CoffeeScript to the chain.



For the sake of completeness, PEP8 actually says 'Use 4 spaces per indentation level'


He's not changing anything, and he's not relying on weird browser implementations - it's part of the spec.

I hate unnecessary semicolons too. Though I deal with them by including them everywhere, but making them hard to see in my editor ;)


alternatively, use JSLint


I much prefer JSHint. JSLint is draconian, and has some borderline insane decisions (it complains if you don't declare your vars at the top of a block—is this 1980?).

And yes, I realise that some of these options can be turned off—but JSHint has better defaults.


There is a reason for the insanity you are complaining about. The vars are effectively hoisted there by the interpreter anyway, by pulling them to the top of the block you remove a possible point of confusion, and more importantly a possible point of bugs.


jshint is great. Putting this in ~/.jshintrc makes it a lot more sane:

    {
      "browser" : true,
      "node"    : true,
      "undef"   : true,
      "eqeqeq"  : true,
      "noarg"   : true
    }




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: