Tuesday, April 04, 2006

Javascript Syntax Validation

I am real fan of AJAX (not the cleaning product - I think my wife is a fan of that!). The really annoying thing about producing an AJAX front end for a web application is the lack of good free tools for Javascript. I recently stumbled upon the Web tool project (WTP) of the Eclipse foundation, who's goal is to produce a plugin for Eclipse (the greatest editor) to handle all AJAX languages like HTML, Javascript, CSS etc. Although the WTP plugin adds syntax highlighting functionality for Javascript, it does not perform any of the useful features that Eclipse has been synonymous for Java like Syntax checking, highlighting variable occurrences etc.

I searched on the web for a syntax checker for Javascript. I know that Firefox has a plugin which outlines syntax errors while running the script. However, I wanted to eradicate syntax errors before running a script, because there are other errors to worry about when running a script.

I came across Javascript Lint, which has a really neat utility for checking for Javascript syntax errors. It also provide a downloadable little app that can check the syntax of scripts as a command line utility or even as a right click option in the windows file explorer.

Javascript Lint uses Firefoxe's Javascript engine to check for syntax errors. I came across this article which seems to say that the Firefox JS engine was very strict. However, my experiences with it have been ok so far.


Stephen Souness said...

There is a javascript plugin for Eclipse (though separate from Web Standard Tools)

Look for JSEclipse from InterAKT Online.

I avoid Javascript like the plauge, but you may find that plugin useful (pretty colours, some completion...)

Pramudi said...

Thanks for the suggestion. I do know about JSEclipse. Only problem is that I'm not really prepared to fork out how ever much they are charging for it. Its a commercial plugin.