HTMLMinifier is a Javascript-based HTML minifier (duh), with lint-like capabilities.
Installing with npm:
npm install html-minifier
See corresponding blog post for all the gory details of how it works, description of each option, testing results and conclusions.