Some simple steps to check your JavaScript Code with JSLint:
- download and install JSRhino
- make it somehow available, e.g. create a js.bat (one line: java -jar "path/to/rhino/js.jar" %* )
- download JSLint and put it in some folder, e.g. /path/to/jslint.js
- Add an external tool configuration in Eclipse:
Location: path/to/js.bat
Working Directory: ${workspace_loc}
Arguments: path/to/jslint.js ${resource_loc}
- you can now check your JavaScript code with JSLint by calling this external tool.
Enjoy.
P.S.: There is a very interessting talk by Douglas Crockford (creator of JSON and JSLint) at google tech talk that highlights the good and bad aspects of JavaScript. I liked that a lot.
3 comments:
You might also be interested in jslint4java. This allows you to validate your code directly. It also integrates nicely with an ant build script.
http://code.google.com/p/jslint4java/
Interesting. Especially the ant task. There might be an JsLint Eclipse Plugin . But I have not tried it yet.
I'd like to write an eclipse plugin, but I haven't gotten around to it yet. :)
Post a Comment