So how do you go about using this tool? Well there are a few different ways, you can validate using the website www.jslint.com, you can download the source code and run it on command line or preferably you can run it within your development program of choice. My preferred IDE is Eclipse, mainly because it is java based so runs on Mac, Linux and Windows, but also due to its plugin architecture which means you are not limited to the core feature set.
When searching the internet for a jslint plugin for Eclipse I was somewhat surprised to find there were none to hand. A real shame, but after some digging I found that you can actually install it as a subset from another plugin.
How to do it
Step One: Open Eclipse up on your machine and go to ‘Help’ -> ‘Install New Software’
Step Two: Click ‘add’ on the popup and you will have the screen as below. With that screen where it says location add the following link: https://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/jslint4java1/download then click ‘ok’.
Step Four: Keep clicking next, you may have to accept any license terms and during installation you will get the screen below, don’t worry, just click ‘ok’.
Step Five: Once you have clicked through, the plugins should install and Eclipse should restart jslint will now be installed. To enable it you can right click on any open project and you’ll see an option that says ‘Enable jslint4java’ as the screen below shows. Once you have chosen this option errors and warnings should appear from jslint onto your errors / warnings bar.
As you can see it’s pretty easy to get set up with JSLint on Eclipse, once you are underway you’ll be able to see any JSLint errors on the fly and fix them before they become a foundation of your code. The more you end up using it, the less you’ll find errors you are creating as standard. I highly recommend using this as part of your daily workstream.