FixMyJS (by Josh Perez) was created to try solving this problem. It aims to automatically fix linting errors in a non-destructive way. To an extent, it achieves this goal.
Under the hood the module uses Esprima for source parsing and Escodegen (from the Mozilla Parser API AST) to generate it back. While any form of automation code transformation should be approached with a healthy dose of skepticism, FixMyJS is able to handle fixing basic JSHint errors fairly well. Some of what it supports includes:
- Adding missing semicolons
- Enforcing camelCase and snake_case conventions
- Adding curly braces to statements
- Removing debugger statements
- Enforcing single and double quite styles
- Adding the radix parameter to parseInt
- Dot notation conversion
- Handling extra trailing commas
and a few other common linting issues.