lint test code too, add JSCS code style checking

* enable JSHint for test code
* add JSCS for code style checks and jsdoc comment validation
* fix all the reported issues

The diff for this PR looks huge due to the large amount of syntactic
and stylistic modifications, but actually there are no substantial
code changes whatsoever.