| 1 |
d2a8c3fd
|
Marc NICOLAS
|
jslint for java <http://code.google.com/p/jslint4java/>
|
| 2 |
|
|
=======================================================
|
| 3 |
|
|
|
| 4 |
|
|
This is a java wrapper around the fabulous tool by Douglas Crockford, jslint
|
| 5 |
|
|
(See <http://jslint.com/>). It provides a simple interface for detecting
|
| 6 |
|
|
potential problems in JavaScript code.
|
| 7 |
|
|
|
| 8 |
|
|
You can run it on the command line:
|
| 9 |
|
|
|
| 10 |
|
|
% java -jar jslint4java-2.0.3.jar application.js
|
| 11 |
|
|
jslint:application.js:11:9:Line breaking error ')'.
|
| 12 |
|
|
jslint:application.js:11:10:Missing semicolon.
|
| 13 |
|
|
|
| 14 |
|
|
There are a multitude of options; try `--help` for more details.
|
| 15 |
|
|
|
| 16 |
|
|
The output is colon separated fields. The fields are:
|
| 17 |
|
|
|
| 18 |
|
|
* "jslint"
|
| 19 |
|
|
* the file name
|
| 20 |
|
|
* the line number (starting at zero)
|
| 21 |
|
|
* the character number (starting at zero)
|
| 22 |
|
|
* the problem that was found
|
| 23 |
|
|
|
| 24 |
|
|
You may also use the jar as an ant task. The quickest way to get started is
|
| 25 |
|
|
to drop it in `~/.ant/lib`. See `docs/ant.html` for more details.
|
| 26 |
|
|
|
| 27 |
|
|
**NB:** The packaged jar file includes a builtin version of rhino (a JavaScript
|
| 28 |
|
|
engine). If this causes trouble, you can download a standalone version
|
| 29 |
|
|
through the maven repository.
|
| 30 |
|
|
|
| 31 |
|
|
If you wish to use jslint4java from within Java, please use a maven dependency:
|
| 32 |
|
|
|
| 33 |
|
|
<dependency>
|
| 34 |
|
|
<groupId>com.googlecode.jslint4java</groupId>
|
| 35 |
|
|
<artifactId>jslint4java</artifactId>
|
| 36 |
|
|
<version>2.0.3</version>
|
| 37 |
|
|
</dependency>
|
| 38 |
|
|
|
| 39 |
|
|
If you have any comments or queries, please send them to `dom [at] happygiraffe.net`.
|
| 40 |
|
|
|
| 41 |
|
|
This software is licenced under the BSD licence (see LICENCE.txt).
|
| 42 |
|
|
|
| 43 |
|
|
Patches
|
| 44 |
|
|
=======
|
| 45 |
|
|
|
| 46 |
|
|
If you'd like to change jslint4java, the best way to do so is via github. Fork the [main repository](https://github.com/happygiraffe/jslint4java), make your changes and submit a [pull request](http://help.github.com/pull-requests/).
|
| 47 |
|
|
|
| 48 |
|
|
If you don't wish to use github, just clone the repository and submit patches over email.
|
| 49 |
|
|
|
| 50 |
|
|
$ git clone git://github.com/happygiraffe/jslint4java.git
|
| 51 |
|
|
$ … hack, hack, hack …
|
| 52 |
|
|
$ git send-email origin
|
| 53 |
|
|
|
| 54 |
|
|
Please try to follow the existing code style when making changes.
|
| 55 |
|
|
|
| 56 |
|
|
You should ensure that the existing test and build works before submitting patches:
|
| 57 |
|
|
|
| 58 |
|
|
$ mvn -Pdist clean verify |