Hardening the JSHint config for tests
Breaking the JS into modular sections

Fixes #339.
Fixes #312.