[discussion] add a precommit hook to prevent errors

so, this is possibly contentious and divisive so we can kill it if we can't come to some agreement.

basically what this does is adds a pre-commit hook to `git`. so when you type `git commit` it will lint your code, give you hints about fixing silly bugs and typos and then run the test suite before actually committing the code.

I generally think it's a good idea but it's likely that the settings in `.jshintrc` are not to everyone's liking.

cc/ @hkrishna how do you feel about this and the settings in ` .jshintrc`?

the rest of the commit is just me fixing up the repo so it passes `jshint`.