Prettier "Code style issues found" with --check in CI
Prettier --check lists files whose formatting differs from Prettier's output, then exits 1. It does not change files; it only reports that they are not formatted.
What this error means
The format check prints "Checking formatting..." then "[warn] Code style issues found in the above file(s). Run Prettier with --write to fix." and exits with code 1.
Checking formatting...
[warn] src/app.tsx
[warn] src/utils/format.ts
[warn] Code style issues found in the above file(s). Run Prettier with --write to fix.Common causes
Files were committed without running Prettier
The listed files differ from Prettier's canonical output, so --check flags them and fails the job.
A Prettier version or config change shifted formatting
A different Prettier version or a changed setting (printWidth, singleQuote) reformats code differently than what is committed.
How to fix it
Format the files and commit
- Run Prettier with
--writeacross the repo. - Commit the reformatted files.
- Re-run
--checkto confirm a clean exit 0.
npx prettier --write .
npx prettier --check .Pin the Prettier version across local and CI
Lock Prettier so local --write and CI --check agree on formatting.
npm install --save-dev --save-exact prettier@3.3.3How to prevent it
- Run
prettier --writein a pre-commit hook. - Pin Prettier to an exact version in devDependencies.
- Keep one
.prettierrcshared by local and CI.