Overview
Introduction
Prettier's whole pitch is that formatting stops being a discussion, but that only works once a team agrees on the handful of options it does expose, print width, tab width, semicolons, quote style, and trailing commas, and writes them down in a shared .prettierrc.
This tool generates that .prettierrc as valid JSON, plus a matching .prettierignore covering the paths Prettier shouldn't touch, from a simple options form.
What Is Prettier Config Generator?
A .prettierrc and .prettierignore generator covering Prettier's most commonly customized settings: printWidth, tabWidth, semi, singleQuote, and trailingComma.
The .prettierignore output is pre-populated with the standard exclusions almost every project needs: node_modules, build output directories, lockfiles, and minified files.
How Prettier Config Generator Works
Print width and tab width are validated as sensible integers (20-200 and 1-8 respectively) before being written into the config object alongside the boolean/enum settings.
The whole options object is serialized with JSON.stringify(config, null, 2), producing the same 2-space-indented JSON shape Prettier's own `--config` examples use.
When To Use Prettier Config Generator
Use it when adding Prettier to a project for the first time and you want a valid, team-agreed .prettierrc without hand-writing the JSON.
It's also useful for quickly producing a .prettierignore for a project that has Prettier installed but no ignore file yet, avoiding accidental reformatting of build output or lockfiles.
Often used alongside ESLint Flat Config Generator and package.json Generator.
Features
Advantages
- Validates printWidth/tabWidth ranges so the generated config can't contain a nonsensical value like printWidth: 0.
- Bundles a sensible .prettierignore alongside the config, covering the exclusions almost every project needs on day one.
- Output is exactly the JSON shape Prettier expects for .prettierrc, ready to save with no further editing.
Limitations
- Only covers the five most commonly customized options; less frequently changed settings (bracketSpacing, arrowParens, endOfLine) aren't exposed and default to Prettier's own defaults if omitted.
- Doesn't detect or resolve conflicts with an existing ESLint stylistic-rules configuration; that's a separate, manual coordination step.
Examples
Best Practices & Notes
Best Practices
- Commit .prettierrc and .prettierignore to the repository so every contributor's editor and CI format the same way, rather than relying on individual editor defaults.
- Disable ESLint's own formatting-related stylistic rules once Prettier is in place, so the two tools don't disagree over the same line.
- Run Prettier in CI (`prettier --check`) in addition to editor integrations, so unformatted code fails the build instead of only showing a squiggly underline locally.
Developer Notes
trailingComma defaults to Prettier's modern default of "all" in most current examples, since every JS/TS runtime Prettier targets today accepts trailing commas after the last function argument; "es5" remains available for teams whose toolchain still needs ES5-only trailing-comma placement. The .prettierignore list intentionally mirrors common .gitignore entries (node_modules, dist, build, out, coverage) plus lockfiles, since reformatting a lockfile can produce large, meaningless diffs.
Prettier Config Generator Use Cases
- Adding Prettier to a project for the first time with an agreed-on formatting style
- Standardizing .prettierrc settings across multiple repositories on a team
- Generating a .prettierignore for a project that has Prettier but no ignore file yet
Common Mistakes
- Running Prettier without a .prettierignore and having it reformat a committed lockfile or minified vendor file, producing a huge unreviewable diff.
- Leaving ESLint stylistic rules enabled alongside Prettier with conflicting settings, causing the two tools to repeatedly fight over the same lines on save.
Tips
- Use the ESLint Config Generator next and make sure any stylistic rules it might enable are turned off or delegated to Prettier.