Keep consistent Javascript style

* Added .jshintrc with my preferred settings, adapted to the style of the code base
* Auto run linting before testing, prepublishing and travis run
* Cleaned up code to match settings and put specific block ignores around things that I consider workarounds or hacks