Wednesday, September 1, 2010

Google’s Style Guide and JavaScript Lint tool

Last year, Google has open-sourced the JavaScript tool Closure. Google has been contributing actively to the Closure project and the latest addition to the project is a JavaScript Lint tool (A code checker that checks for common mistakes in scripts). The tool has been named as ‘Closure Linter’ and it works on the basis of Google’s JavaScript style guide.

Google’s Style guide

Google has published style guide for different languages part of the Google’s open source projects. The Style Guide project also include few tools to enforce that these guides are followed. Here are the available style guides and tools:

Closure Linter

Closure Linter is available as a command line utility and can be downloaded from here. After installing the tool, just execute the tool “gjslint path/to/myfile.js”. This will check your code for any common errors. Your script will be checked for the style guide compliance. To fix the style problems reported using gjslint, use “fixjsstyle path/to/file1.js path/to/file2.js”

-- Varun

No comments:

Post a Comment

google-site-verification: googlea4d68ed16ed2eea6.html