Setting up JSHint and fixing JS errors