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:
- CPPLint, a C++ Lint tool
- google-c-style.el, an Emacs settings file for Google Style
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