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

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
    }




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

Search: