Enable JSHint for src/ and fix errors.

It appears that JSHint was not running on the `src/` directory. It looks like this resulted in global variable leaks going unnoticed (among other things). This change enables JSHint and addresses the existing issues.