Exploring JavaScript Lint

For topics about current BETA or future releases, including feature requests.
Post Reply
User avatar
MikeGale
Rank VI - Professional
Rank VI - Professional
Posts: 710
Joined: Mon Dec 13, 2004 1:50 pm
Location: Tannhauser Gate

Exploring JavaScript Lint

Post by MikeGale »

I've briefly explored the JSLint tool.

Here's some findings:

1) For a bit about the messages and what they mean see
http://wolfram.kriesing.de/blog/index.p ... int-output

2) To take control of the configuration you can alter the settings in CSE to something like:

Code: Select all

-nologo -nofilelisting -nocontext -conf DRIVE:\Path\to\file\jsl.cse.MyVersion.conf -process "%FILE%"
The original setting is in the help file so you always change it back if you make a mistake!

3) An error suppresses following warnings. When you clear an error you may get a crop of warnings appear.

4) There seem to be several JSLint tools. Look for the Matthias Miller version.

5) You can switch checking off for a whole file or part of it:

Code: Select all

/*jsl:ignoreall*/

/*jsl:ignore*/
(code that fires warnings)
/*jsl:end*/
6) I can confirm that with some of the extra features inside JSLint (Like: /*jsl:option explicit*/ to force variable declaration, /*jsl:import Whatever.js*/ to declare a dependency on another file and +define window (or whatever) in your configuration) it is possible to work well with the tool and get zero errors and warning messages, where you deserve it!!

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3454
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

MikeGale wrote:I have noticed a lot of warnings from third party JavaScript files. I have no test cases for such code so am unlikely to touch it, ever. In these cases a way to tell JS Lint to never touch the file would have value.
So you would like to see a way to exclude certain documents from JavaScript Lint checking, perhaps similar to some of the Batch Wizard exclude options? I'm thinking that I could add a text box that lets someone specify strings that, if matched a document name, will cause no JavaScript checking to be done for the document.

On a side note, thanks for posting some of your findings on JavaScript Lint. I improved the documentation a bit because of some ideas I got from your findings.
Image
Albert Wiersch

User avatar
MikeGale
Rank VI - Professional
Rank VI - Professional
Posts: 710
Joined: Mon Dec 13, 2004 1:50 pm
Location: Tannhauser Gate

Post by MikeGale »

I solved this problem in my own files, thanks to that JavaScript Lint research.

For a file that you want to totally ignore use:

Code: Select all

/*jsl:ignoreall*/
and for a section that you want to ignore use

Code: Select all

/*jsl:ignore*/
...
/*jsl:end*/
So provided that CSE users are happy to insert these fairly innocuous comments there is actually an existing solution.

Something layered over the top of that might confuse.

I spent a bit more time than expected investigating these switches, but the time was well spent. The Lint tool has been nicely thought through, and can do what I want.

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3454
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch »

MikeGale wrote:I spent a bit more time than expected investigating these switches, but the time was well spent. The Lint tool has been nicely thought through, and can do what I want.
Sounds good!
Image
Albert Wiersch

Post Reply