Javascript code can be tough to maintain.
I am looking for tools that will help me ensure a reasonable quality level.
So far I have found JsUNit, a very nice unit test framework for javascript. Tests can be run automatically from ant on any browser available.
I have not found yet some javascript equivalent of PMD, checkstyle, Findbug...
Do you know any static code analysis tool for javascript ?
Wro4j-maven-plugin provides several goals for static code analysis for JavaScript and CSS resources as well, like: jslint, jshint and csslint
Here is a link to the official Wro4j-maven-plugin documentation.
I've used the following code to run JSLint as part of the COMPILE phase in Maven.
It downloads jslint4java from maven repository so you don't need anything else.
If JSLint found problems in javascript files, the build will fail.
jslint4java has been mentioned a few times, I can't recall which version they added it, but there's actually a built in Maven task.
Traditionally with jslint4java and Maven, folks have used the antrun plugin to run the jslint4java ant task, however you can now configure it all in Maven and avoid that extra step.
http://docs.jslint4java.googlecode.com/git/2.0.2/maven.html
A couple of plugins I've submitted at Codehaus may also be of interest:
http://mojo.codehaus.org/js-import-maven-plugin/
http://mojo.codehaus.org/jslint-maven-plugin/
The first one brings Maven dependency management to JavaScript. The second one allows the rapid and efficient invocation of JSLint.
I've worked on the SweetDEV RIA project which is a Java tag library composed of several "Web 2.0/Ajax/JavaScript" components.
The maven 2 build process includes some in-house plugins which launches JSLint (code verifier), JsMin (code minifier), JsDoc generation (JavaDoc like documentation), JsUnit (unit tests) and Selenium (in browser) tests .
You may take a look on the SweetDEV RIA maven plugins repository.
This project looks close:
http://dev.abiss.gr/mvn-jstools/index.html
It generates a report with JsLint. It doesn't look like it hooks into the test phase of the build lifecycle, so I don't think it will reject a build if jslint finds issues (which is what I'd like to do on my projects).