Hacker News new | ask | show | jobs
by HoLyVieR 5244 days ago
If you are seeing JSLint as a dictatorship, you are probably seeing those tools from the wrong way. Those tools helps you spot potential mistake and help your code be a little better. What they give you is advice, you will find that from time to time the advice they give you aren't that great and you are always free to ignore them in those cases.
2 comments

The problem is that JSLint goes further than static analysis and suggests what could be considered simply "stylistic" changes to match the way Crockford thinks javascript should be written.

For example, doing comparisons (x == null) or (x != null) is a well known shortcut for checking vs null or undefined. There's nothing inherently "bad" about using that shortcut.

It sounds to me like what you need isn't an escape from JSLint, but rather a better JSLint config file that skips the stylistic checks you dislike. JSLint at its strictest can definitely be a little too strict.

(of course, there's really no reason to be using JSLint over JSHint anyway)

Well that was actually my point; JSHint is effectively a highly configurable version of JSLint.
JSLint is already a highly configurable version of JSLint. JSHint is a leniently configured JSLint.
breacimanno said it all. JSLint is highly opinionated, JSHint gives you the extra control so that you can use it just to catch mistakes, not conform your style to someone else's standard. I use a textmate extension that lints on every save, it's not practical/healthy to keep ignoring warnings - you know what that will lead to.