Comments on: Best practices & JSLint https://j11y.io/javascript/best-practices-jslint/ Sun, 22 Mar 2015 15:39:22 +0000 hourly 1 https://wordpress.org/?v=5.0.13 By: David https://j11y.io/javascript/best-practices-jslint/#comment-1002 Wed, 17 Jun 2009 11:40:14 +0000 https://j11y.io/?p=902#comment-1002 Great writeup!

Question – how come you’re not plugging your hugely useful Lint-deployer Debug here? Simply not ready yet?

]]>
By: James https://j11y.io/javascript/best-practices-jslint/#comment-1001 Mon, 08 Jun 2009 16:45:22 +0000 https://j11y.io/?p=902#comment-1001 Thanks for the comments! 🙂

@Jeffrey, agreed, I don’t think I really understood any of those diagrams – but he seems to really like them; he uses them in some of his presentations too.

@Daniel, I should’ve included that tagline – it is certainly true. The first time I used JSLint the results were not pretty! But, over time, it’s definitely made me a better JavaScript developer!

@Alex, don’t be intimidated; try to embrace JSLint! 🙂

@Pete, agreed, plus its implementation seems a little shallow in some areas. For example, it will throw an error with this:

for (var i in obj) {
    if (!obj.hasOwnProperty(i)) { continue; }
    doSomething();
}

But not with this:

for (var i in obj) {
    if (obj.hasOwnProperty(i)) {
        doSomething();
    }
}

… even though, effectively, they’re the same.

@Mathias, by “unexpected” I meant from the author’s perspective (i.e. the fictional person who wrote that function). Understandably, the ignorance of that fictional individual lead to him/her being unaware of the radix issue.

]]>
By: Mathias Bynens https://j11y.io/javascript/best-practices-jslint/#comment-1000 Mon, 08 Jun 2009 16:23:54 +0000 https://j11y.io/?p=902#comment-1000 Great post!

I don’t mean to nitpick here, but… Indeed, parseInt('056') !== 56, but how is this “unexpected behavior”?

If the string passed to the parseInt() function begins with '0', and no radix parameter is given, the radix is implicitly set to 8 (octal).

If you want to parse decimal numbers, you need to use a radix of 10.

parseInt('056', 10) === 56

]]>
By: Pete https://j11y.io/javascript/best-practices-jslint/#comment-999 Mon, 08 Jun 2009 08:25:42 +0000 https://j11y.io/?p=902#comment-999 I think JSLint needs to be updated though, as it sometimes shows some odd ‘errors’, like requiring that you add filters to all ‘for in’ loops.

That doesn’t hurt my feelings, just makes me wonder if the tool itself is worth using.

]]>
By: Alex Weber https://j11y.io/javascript/best-practices-jslint/#comment-998 Sun, 07 Jun 2009 23:55:36 +0000 https://j11y.io/?p=902#comment-998 JS Lint hurt my feelings. I’m intimidated now…

]]>
By: daniel https://j11y.io/javascript/best-practices-jslint/#comment-997 Sun, 07 Jun 2009 21:49:45 +0000 https://j11y.io/?p=902#comment-997 JSLint is insanely helpful… and above all it has saved me a lot of headache, especially when it comes to IE debugging, because IE (6 in particular) is actually less forgiving than for example, firefox, and the IE script debugger isn’t particularly helpful. Also I’m a sloppy coder, not by heart, but I tend to miss a lot of semicolons as i type away and some trailing commas in objects, arrays etc.

Highly recommended!

ps. quote: It may hurt your feelings 😛

]]>
By: Jeffrey Way https://j11y.io/javascript/best-practices-jslint/#comment-996 Sun, 07 Jun 2009 19:05:14 +0000 https://j11y.io/?p=902#comment-996 Yeah – JSLint is a great tool. I enjoyed “JS: The Good Parts” as well, but all of those diagrams were confusing.

]]>