Does it make any sense to use JSLint and follow it?

Viewed 8777

Lately I've been writing some JS code using jQuery and JavaScript as it is and I thought I will give JSLint a try. Let me say that the code contains various functions and jQuery usages and it works fine (without any errors ) in IE8 and latest Firefox. The code also validatas as XHTML 1.0 Transitional (and Strict too but I mostly want it to be Transitional valid).

However, with JSLint it's like everything is wrong. While I have read about it being very strict, even if I turn on only "The Good Parts" it's still like 70+ errors in a typical HTML page.

It starts out with this (why in the world would I want to remove the type to make my documents XHTML invalid??)

Problem at line 5 character 67: type is unnecessary.

<script src="/Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>

and goes on with esoteric errors like

Problem at line 41 character 41: Use the array literal notation [].

var rows = new Array();

Problem at line 42 character 30: Too many var statements.

for (var i = 0; i < data.length; i++) {

Problem at line 42 character 55: Unexpected use of '++'.

for (var i = 0; i < data.length; i++) {

Problem at line 64 character 50: ['PrettyId'] is better written in dot notation.

var item = $("#item_" + data["PrettyId"]);

If anyone can provide me answers to these errors and especially, how to make JSLint be aware of jQuery and understand it, I will appreciate it.

If not, please explain whether you use it or not and whether you advice to use it or not.

UPDATE:

I'm going to wait one more day for more answers, if any, then I'll accept the answer with the most upvotes.

7 Answers
Related