Boneyard Tools

Minimal Prettier Config Explained

Why a short .prettierrc beats a long one, what each exposed option controls, and how to place the file so Prettier and your editor both find it.

Why smaller configs age better

It is tempting to write out every Prettier option so the config looks complete, but a long file quietly pins you to today's defaults. When Prettier changes a default in a future version, an explicit value blocks the update while a smaller file inherits it. This generator leans on that idea by omitting any option that already matches the default, so your .prettierrc records only genuine decisions. The result is easier to review, because every line represents a choice the team actually made.

What the common options do

Print width sets the line length Prettier tries to stay under before it wraps, defaulting to 80. Tab width and use tabs decide how deep each indent is and whether it uses spaces or tab characters. Semicolons and single quotes control statement endings and quote style, the two settings teams debate most. Trailing comma, bracket spacing and arrow parens shape the finer punctuation of objects, arrays and single-argument arrow functions.

End of line and cross-platform teams

The end of line option decides which line ending Prettier writes: lf for Unix and macOS, crlf for Windows, cr for legacy systems, or auto to keep whatever the file already uses. Setting it to lf and pairing that with a .gitattributes rule is a reliable way to stop Windows and macOS contributors from trading noisy line-ending diffs. If you would rather not enforce a choice, auto lets each file keep its existing convention.

Where to put the file

Prettier searches from the file being formatted up toward the project root, so a .prettierrc at the root covers the whole repository. You can also embed the same object under a prettier key in package.json to keep configuration in one place, or use .prettierrc.json and prettier.config.js when you prefer an explicit extension or need comments. Whichever you choose, install the Prettier editor extension so formatting on save reads the same file your command line does.

Frequently asked questions

Should I commit the .prettierrc to version control?

Yes. Committing it means every contributor and every continuous integration run formats code the same way, which removes style churn from pull requests. Pair it with a format check in CI so a misformatted file fails fast rather than slipping into the main branch.

Does an empty config disable Prettier?

No. An empty object simply tells Prettier to use all of its defaults. Prettier still formats your files fully; it just does so with the standard 80-column width, double quotes, semicolons and the rest of the built-in rules.