Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to provide a --check option like prettier? #382

Open
laike9m opened this issue Apr 3, 2021 · 2 comments
Open

Is it possible to provide a --check option like prettier? #382

laike9m opened this issue Apr 3, 2021 · 2 comments

Comments

@laike9m
Copy link

laike9m commented Apr 3, 2021

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.

@fredvisser
Copy link

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.

@JounQin
Copy link
Member

JounQin commented Aug 13, 2022

PR welcome to add this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants