Add JSHint rules, clean code