.prettierrc Builder

Generate a Prettier config with your preferred formatting rules

Build a .prettierrc JSON with printWidth, tabWidth, useTabs, semi, singleQuote, quoteProps, trailingComma, bracketSpacing, arrowParens, and endOfLine — with a live preview of how your settings format code.

What does printWidth actually control?

printWidth is the line length Prettier tries to stay under, defaulting to 80. It is a target, not a hard limit — Prettier will exceed it when breaking a line would be worse, such as inside a long string. Many teams set it to 100 or 120.

Build a .prettierrc that matches your team’s style

Prettier is an opinionated formatter, but it still exposes a handful of options that teams disagree on — line width, quotes, semicolons, trailing commas. A .prettierrc file pins those choices so every contributor’s editor formats identically. This builder lets you set each option and shows a live preview of how a sample snippet reformats, then emits clean JSON.

How it works

Prettier reformats code by parsing it into an abstract syntax tree and re-printing it, discarding your original whitespace entirely. Your .prettierrc only tweaks the printer’s decisions. The most impactful option is printWidth: Prettier tries to keep each line under that width and breaks long expressions onto multiple lines when they would exceed it. A typical config looks like:

{
  "printWidth": 100,
  "tabWidth": 2,
  "singleQuote": true,
  "semi": true,
  "trailingComma": "all",
  "arrowParens": "always"
}

trailingComma: "all" is preferred today because adding a new line to an array or argument list touches only that one line in git, instead of also editing the previous line to add a comma. The live preview in this tool runs the same decisions Prettier would make on a small sample so you can sanity-check before committing.

Tips and notes

  • Wider printWidth (100–120) reduces awkward line breaks on modern displays; 80 remains the conservative default.
  • Pair Prettier with eslint-config-prettier so ESLint stops reporting formatting issues Prettier already handles.
  • Add a .prettierignore for build output and vendored files so Prettier does not rewrite generated code.
  • Run prettier --write . once to reformat the whole repo, then commit that as a single “apply prettier” change so future diffs stay clean.