prettier-eslint-cli
prettier-eslint-cli copied to clipboard
Is it possible to provide a `--check` option like prettier?
Right now there seems to be no way to use prettier-eslint-cli to report unformatted code. This makes it hard to apply it in CI checks. https://github.com/u3u/prettier-eslint-check solves this problem, but it's no longer maintained. It would be nice if the official CLI can support this feature.
I'd recommend trying the --list-different option. It gives a list of files that need to be formatted and returns a failure code.
E.g. prettier-eslint \"./**/*.js\" --list-different
…/src/light-async.js
…/src/prism-async.js
success formatting 2 files with prettier-eslint
7 files were unchanged
npm ERR! Lifecycle script `prettier` failed with error:
npm ERR! Error: command failed
The main drawback is the mixed messages about success and error, but people should be able to figure it out.
PR welcome to add this feature!