I would like to lint (and perhaps even automatically) beautify whitespace in JavaScript. The question is whether there are any tools that can do this.

I know that JSLint and JSHint, e.g., can check indentation and trailing spaces, and that's both fine, but these are not the only kinds of whitespace you may have.

What I would like to check as well is:

  • Are there empty lines before or after certain constructs?
  • Is there more than one empty line?
  • Are single spaces between certain things (this is partially checked by JSLint / JSHint)?
  • ...

Basically, I'd like to have everything what a modern IDE such as Visual Studio plus Resharper can do, but as a command-line tool that can be embedded into Grunt.

The only thing I found which does something in this direction is esformatter, but according to its website it

is still on early development and is missing support for many important features.

Of course it would be great if there was something more mature.

Any ideas?

Edit
Report