.prettierignore: Exclude Files From Formatting
.prettierignore tells Prettier which files and folders to leave untouched, using the same syntax as .gitignore.
Build output, vendored code, and generated files should not be formatted. A .prettierignore keeps them out of both --write and --check.
What it does
Prettier reads a .prettierignore file from the working directory and skips any matching path. Patterns follow gitignore rules: globs, directory names, negation with a leading exclamation mark, and comments with a leading hash. Prettier also ignores node_modules by default unless you pass --with-node-modules.
Common usage
# .prettierignore
dist/
build/
coverage/
*.min.js
package-lock.json
# keep formatting this one despite the rule above
!src/keep.min.jsOptions
| Pattern / flag | What it does |
|---|---|
| dist/ | Ignore an entire directory |
| *.min.js | Ignore by glob |
| !path | Re-include a path excluded by an earlier rule |
| --ignore-path <file> | Use a different ignore file (can repeat) |
| --with-node-modules | Do not auto-ignore node_modules |
In CI
Keep .prettierignore aligned with what your build generates so CI does not flag generated files. From Prettier 3, you can pass --ignore-path multiple times, for example to also honor .gitignore. Run the check from the repo root so the ignore file at the root applies.
Common errors in CI
If CI flags a file you meant to skip, the ignore file is usually not at the directory Prettier runs from, or the pattern does not match the path as Prettier sees it (relative to the ignore file). A negation that does not work often means a parent directory was excluded, which cannot be re-included by negating a file inside it.