Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311150

Summary: Add Javascript syntax validation to our workflow
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RelengAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: holger.staudacher, stephan.leichtvogt
Version: 1.3   
Target Milestone: 1.5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Options for automatic JSLint check none

Description Ralf Sternberg CLA 2010-04-30 06:02:39 EDT
We should add a simple Javascript syntax / style checker to our tool chain.
JsLint and Rhino already prooved to work. If possible IP-wise, we should include the necessary scripts in our CVS.
Rhino is available in Orbit, JSLint is likely to get approval as the JSON parser with the same license did.
Comment 1 RĂ¼diger Herrmann CLA 2010-05-04 10:30:30 EDT
*** Bug 311545 has been marked as a duplicate of this bug. ***
Comment 2 Holger Staudacher CLA 2010-05-04 10:38:53 EDT
I opened two Ipzilla CQs for this bug. The CQs are: 
- 4050 for JsLint
- 4051 for Rhino
Comment 3 Stephan Leicht Vogt CLA 2011-12-19 03:08:13 EST
For starter you could use the Rockstar JSLint-Plugin for the Development-IDE-Eclipse. Just install it from: http://update.rockstarapps.com/site.xml
I used it while searching for the source of bug367053. Found a whole lot of missing ";" which weren't the source of the bug.
Comment 4 Ralf Sternberg CLA 2011-12-19 06:15:46 EST
Thanks for the tip, Stephan. I had tried the rockstar add-on before and just installed it again, but it still doesn't seem very usable to me. It doesn't generate warnings automatically, but has to be executed (and configured) manually for every single file :(
Also, this project seems to be dead, isn't it?
Comment 5 Stephan Leicht Vogt CLA 2011-12-19 07:03:05 EST
Created attachment 208543 [details]
Options for automatic JSLint check

When you right-click on a js-file and configure the option for a JSLint-Check you can configure it to check for every file in the project after every save on the second Wizard-Page (Screenshot). 
That the project is dead may be, but for the basic JSLint-Checks it works imho pretty ok.
Comment 6 Ralf Sternberg CLA 2012-01-07 19:57:08 EST
Thanks Stefan, but I didn't seem to become friends with this plug-in. Even if auto-build can be made to work, it produces gazillions of warnings, most of them false positives. Customizability doesn't seem to be the strong point of JSLint itself [1] and there's a fork named JSHint [2] to overcome this problem. From what I've read, JSHint seems to be the smarter alternative today.

I decided to start working on a simple Eclipse integration [3]. It runs JSHint on top of Rhino. It's still very basic but already allows to adjust JSHint as needed and seems to do a good job on our JavaScript files.

In the next time, I'll use this tool to eliminate the obvious warnings. Then we should come up with a set of options that constitute our JavaScript conventions. Once we have the warnings down to zero, we can add JSHint validation to our builds.

[1] http://anton.kovalyov.net/2011/02/20/why-i-forked-jslint-to-jshint/
[2] http://www.jshint.com/
[3] https://github.com/ralfstx/jshint-eclipse
Comment 7 Stephan Leicht Vogt CLA 2012-01-09 02:58:15 EST
Hi Ralf. That looks great. I also stumbled over those "gazillions of warnings", but didn't took the time to search and investigate in alternatives. JSHint and your eclipse integration seem to be the right solution. Thanks.
Comment 8 Ralf Sternberg CLA 2012-01-27 10:41:08 EST
The jshint-eclipse integration is now hosted at http://github.eclipsesource.com/jshint-eclipse/
Comment 9 Ivan Furnadjiev CLA 2012-08-02 09:25:33 EDT
(In reply to comment #8)
> The jshint-eclipse integration is now hosted at http://github.eclipsesource.com/jshint-eclipse/
With JSHint Eclipse Integration in place I think we can close this bug as fixed.