prettier --list-different: Names Only
prettier --list-different prints just the filenames that are not formatted and exits 1 when there are any.
When you want a clean, parseable list of offending files rather than the friendly --check banner, --list-different gives you exactly that.
What it does
prettier --list-different (alias -l) formats each file in memory and prints only the paths that would change, one per line, with no extra prose. It writes nothing and exits 1 if any file differs, 0 if none do. It predates --check and is handy when you need to pipe the list into another command.
Common usage
prettier --list-different "src/**/*.ts"
# format only the files Prettier reports as different
prettier -l . | xargs prettier --writeFlags
| Flag | What it does |
|---|---|
| --list-different / -l | Print only paths of unformatted files; exit 1 if any |
| --check / -c | Same exit behavior but with a human-readable banner |
| --no-error-on-unmatched-pattern | Exit 0 when the glob matches nothing |
In CI
Use --check for the readable gate and --list-different when a later step consumes the list of files. Both exit 1 on mismatch, so either gates a pull request; the difference is purely the output format.
Common errors in CI
Piping -l output into xargs prettier --write breaks on paths with spaces; use --list-different with a null separator approach or run --write directly. As with --check, an unmatched glob exits 2 with "No matching files. Patterns: ..." unless you add --no-error-on-unmatched-pattern.