Andy Davies is a Software Development Engineer for Skype in London. He's a fan of clean code and building great stuff.

Installing JSLint on Eclipse IDE

For those don’t know, JSLint is a great tool written in javascript that allows you to validate your javascript code against a set of best practises. Written by one of the gurus of the js world Douglas Crockford it is a must for anyone wanting to improve their scripting skills.

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 Three: Once the information has loaded choose the options as shown on the next screen below selecting ‘Javascript Development Tools’ and ‘jslint4java’ and click next.

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.

This entry was posted in Javascript. Bookmark the permalink.

27 Responses to Installing JSLint on Eclipse IDE

  1. Thanks for the tip, installed it in Aptana Studio, which is Eclipse based.

  2. kumar says:

    this really helped me

  3. Jose Dias says:

    Nice write up. I have just followed it to install in an Eclipse Indigo with PDT and it worked. Thank you.

  4. david ward says:

    eclipse states it can’i find the site address you gave

  5. Andy says:

    @david: Very strange, I have just managed to get to the URL using my browser so I’m not sure what’s happening there. jslint4java is a sub package of the phonegap addon modules for eclipse so you could try searching for other links. If you do find a good alternative please share it here just in case anyone else is having this problem!

    Hope you find a solution :)

  6. Philip says:

    @david: You have to change the “https” into “http” and it works from eclipse

  7. Pingback: Linting JavaScript: The process of making your java-script clean and bug-free | titansturf.in

  8. Alpesh says:

    This is awesome. There should be tweet this button to share this post.

    • Andy says:

      Thanks Alpesh, that’s a good idea, I’ve been a bit slow getting that setup

    • William C Grisaitis (@caravaggisto) says:

      Ditto… @Alpesh and @Andy, what are your twitter handles for when you tweet with stuff like this?

      I tweet about coding and all other aspects of the postmodern human condition with @caravaggisto.

      Cheers maties.

  9. Shawn says:

    Good post. While searching for a way to exclude libs like jquery, came across an updated version.
    http://www.mobiledevelopersolutions.com/home/announce-1/mds12released-nowwithjslintjshint

    thanks!

  10. Leo says:

    so, i wonder how can i disable jslint4java,it seems there is no this option.

    • Andy says:

      @Leo: If you right click on the project folder there should be an option to disable it.

    • wagad says:

      Disable jslint4java option is available on the Navigator view (and, for some reason, not on the Package Explorer view) if you right click on the project folder.

  11. JSLINT is strictly a powerful tool and also a message..Warning! JSLint will hurt your feelings. thank you for giving such powerful tool .

  12. Frederik Krautwald says:

    Thanks for the tip. However, after installing the plugins and enabling jslint4java, I don’t get any JSLint warnings even though I deliberately create bad JavaScript. Where are they supposed to show up? Do I need to do anything else but enable and start writing JavaScript code?

  13. Frederik Krautwald says:

    Okay, I figured out I have to go to `Project > Clean` to make JSLint run after enabling it for the project.

  14. Nicof says:

    @Andy :

    As leo says, there is no way to disable jsLint4java.
    I’m using Spring Tool Suite (2.5.2.RELEASE), eclipse IDE with a spring layer.

    Thanks if you’ve got the solution.

    Nico

  15. Nivedhitha says:

    Thank you for sharing the URL. Seems to be an easiest way of using Jlint in eclipse.

  16. Nomaan Maniar says:

    I had followed the above step but getting some Eclipse version problem.
    i got success in integrating for javalint but not for javascript

    Can you please help me out
    Thanks in advance

  17. Ben-Liu says:

    Thx for ur sharing.

  18. Akhil says:

    Thanks a ton. I’m a java developer. JSLint just works perfectly with java now. I never knew this trick. Would definitely post on my blog.

  19. Trupthi Mahesh says:

    Thank you so much.. really helped me installing it in Eclipse.

  20. Trupthi Mahesh says:

    i have installed JSlint but dont know how to use it.. please send some link so that i can learn . it will be of help.

  21. Ronald says:

    To find out what the latest version of the plugin is browse to:

    http://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/

    At the time of writing the latest tag is: r1.2.91

    Now build the url by appending the tag-name and “/download”, e.g.

    http://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/r1.2.91/download

  22. Wolfgang says:

    Thanks for your article. Installation succeeded ;-)

my profile image