Lint your JavaScript with JSLint/JSHint in real time
May 24th, 2012 by Andrey CheptsovThis is a cross-post from WebStorm & PhpStorm blog, originally posted by Maxim Mossienko.
Do you have a habit running JSLint or JSHint for your JavaScript code? If you do not have it because the running is tedious, then IDE can help you with it while you edit the code. Here is how.
Open Settings, type JSLint, enable the code quality tool, configure options. Hit OK.

Here you go, the errors from JSLint appear in your editor.
Develop with pleasure!
Tags: JavaScript, JSHint, JSLint


May 30th, 2012 at 8:18 am
I was wondering if it is possible to export the lint settings from one Intellij to another. I am trying to set up coding standards for my team and while we can export the general “Code Style” attributes, no where can I find a way of exporting the JSLint and JSHint settings.
Cheers,
Francis
June 5th, 2012 at 5:47 am
JSHint settings are stored in ${PROJECT_DIR}/.idea/jsLinters/jshint.xml .
JSLint settings are stored in ${PROJECT_DIR}/.idea/jsLinters/jslint.xml .
To import|export settings via File->(Import|Export) Settings… please vote http://youtrack.jetbrains.com/issue/WI-11087 .
June 7th, 2012 at 3:10 pm
(Sorry might not be the best place to ask this) Am I correct in thinking that IntelliJ contains everything that Webstorm does? Trying to decide whether I’ll need to buy both (I’m using Webstorm now for web stuff, but might move to IntelliJ for my Java stuff as well.)
June 14th, 2012 at 2:09 pm
Steve, you are correct. IntelliJ contains everything that WebStorm does. Additionally WebStorm has Node.js and JsTestDriver plugins, but in IntelliJ IDEA (and other products) you can install these plugins for free from the Plugin Repository.
June 19th, 2012 at 11:34 am
Is it possible to have Rubymine (I assume is in the same boat as IntelliJ to have all the same webstorm features) use the jshint comment we place at the top of all of our javascript files for its linting rules?
July 1st, 2012 at 5:43 am
I can’t find JSLint in my settings - is there a plugin or something that I’m missing?
July 8th, 2012 at 1:56 am
It would be very nice to have the chance to enable the “smarttabs” option of jshint to avoid errors when doing a comment like the following:
/*
* JSHint will mark this as an error
* (mixed spaces and tabs)
* ———————————–
*/
Because the 2nd, 3rd, 4th and 5th lines begin with tab + 1 space.
Can you make more options available in the jshint config window (including smarttabs)?
Thank you.
July 8th, 2012 at 1:59 am
Ok the tabs and spaces were trimmed from my previous comment, but I assure you they were there!
In characters:
→/*
→ * JSHint will mark this as an error
→ * (mixed spaces and tabs)
→ * ———————————–
→ */
This should do the trick
July 9th, 2012 at 4:01 pm
Andrea, “smarttabs” support will be included in Idea 12 Leda.
July 9th, 2012 at 4:06 pm
Louis, make sure you have IntelliJ IDEA 11.1.2 Ultimate Edition.
Open Settings dialog and select “JavaScript” -> “Code Quality Tools”. There should be JSLint and JSHint items.
No additional plugins are required.
July 9th, 2012 at 4:13 pm
Sumit, you can configure “Ruby File Header”. Open Settings dialog, select “File Templates”, click “Includes” tab.
September 17th, 2012 at 4:15 am
We have several JS-Files that will be combined later to a single File. The Problem with Linting now is that he complains about not defined Varaibles/Namespaces that actualy are defined in another file.
Is there a way to tell jsLint to watch a complete Folder of Files?
September 25th, 2012 at 9:29 am
Is it possible to update the version of JSHint being used?
October 9th, 2012 at 6:18 am
Yes, same questions as Bryan. The version of JSHint in Webstorm is kind of old. Ho can we update it?
October 10th, 2012 at 2:17 pm
regarding the jshint question, you can disable the error message about mixed spaces and tabs on multi-line comments by doing
/*jshint smarttabs: true */at the top of your javascript file.