I've been using https://www.npmjs.com/package/grunt-jsbeautifier in the past, but the project has some major outstanding issues and the project seems to be dead.
One nice feature, however, was a "VERIFY_ONLY" mode for simply checking for formatting as opposed to destructively reformatting files. In the verify mode, t simply outputs to console a list of files that are not prettified, which is super useful as a pre-commit check.