I've noticed we don't have any PRESUBMIT rules that check for
violations of the JavaScript style guide. (
http://www.chromium.org/
developers/web-development-style-guide#TOC-JavaScript). I asked on IRC
if there were any good tools for checking your JavaScript style
(JSLint is good, but unfortunately the Chromium/Google style guide
differs from Crockford's in a lot of places) and was pointed to
gjslint, which is part of Closure Linter (
http://code.google.com/p/
closure-linter/). Since PRESUBMIT.py and Closure Linter are both
written in Python, it seems like it would make sense to use Closure
Linter as a library to check for JavaScript style guide violations,
and then we could filter out the errors that don't apply to us (for
example, use of |const| is okay since we don't have to worry about
cross-browser concerns). Based on a quick run of gjslint.py, it looks
like there is a lot of code already in place that Closure Linter
doesn't like, so we would probably want to check for errors only on
new lines of code.
I'd like to add this to our PRESUBMIT checks, so I wanted to see if
anyone had already attempted this or something like it before, or had
some words of wisdom about doing this kind of thing.