Skip to content
Latchkey

Prettier CLI Options You Use in CI

The Prettier CLI takes file globs plus flags that control checking, writing, config, and logging.

You only need a handful of flags in CI. This page collects the ones that decide whether a job passes, writes, or stays quiet.

What it does

The Prettier CLI takes one or more file or glob arguments and formats them according to the resolved config and ignore files. Flags switch between checking and writing, pick an explicit config, point at ignore files, and set how loud the output is. Unknown flags produce a warning, not a hard failure, in many cases.

Common usage

Terminal
prettier --check . --log-level warn
prettier --write "src/**/*.{ts,css,md}"
prettier --check . --config ./config/.prettierrc --ignore-path .gitignore

Flags

FlagWhat it does
--check / -cCheck formatting; exit 1 if any file differs
--write / -wFormat files in place
--config <path>Use a specific config file
--ignore-path <path>Use a specific ignore file (repeatable)
--log-level <level>silent | error | warn | log | debug
--no-error-on-unmatched-patternExit 0 even if a glob matches no files
--cacheSkip files unchanged since the last run

In CI

Use --log-level warn to cut the per-file noise while still surfacing problems. Quote every glob so the shell does not pre-expand it. Add --no-error-on-unmatched-pattern when a workspace may legitimately have no matching files for a given extension.

Common errors in CI

An unrecognized flag prints "[warn] Ignored unknown option --foo." and continues, which can silently skip behavior you intended. "[error] No parser could be inferred for file ..." comes from a file with no known extension; pair --check with --ignore-unknown or a plugin. "No matching files. Patterns: ..." exits 2 when a glob resolves to nothing.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →