Added linting and ensured that exceptions aren't erroneously silenced + tweaked tests

Because why not do everything in one huge pull request if you can?

It's the "Call the callback outside the Promise" commit that's the important fix in this, the rest is just cleanup and tweaks.