Prettier Config Builder
Prettier Config Builder
Build .prettierrc with options and a live formatted-code preview showing how each option affects sample code.
Width & Indentation
Quotes & Semicolons
Punctuation & Style
Output Format
Sample Code
Edit to see how your settings affect different patterns.
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"jsxSingleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"endOfLine": "lf",
"proseWrap": "preserve",
"embeddedLanguageFormatting": "auto",
"quoteProps": "as-needed",
"htmlWhitespaceSensitivity": "css",
"singleAttributePerLine": false
}import { useState, useEffect, useCallback } from "react";
function Counter({ initial = 0, step = 1, onChange }) {
const [count, setCount] = useState(initial);
useEffect(() => { onChange?.(count); }, [count, onChange]);
const increment = useCallback(() => setCount((c) => c + step), [step]);
const items = [
"apple",
"banana",
"cherry",
"date",
"elderberry",
"fig",
"grape"
];
return (
<div className={count > 10 ? "high" : "low"}>
<button onClick={increment}>+{step}</button>
<span>{count}</span>
{items.map((it) => <li key={it}>{it}</li>)}
</div>
);
}
export default Counter;What This Tool Does
Prettier Config Builder is built for deterministic developer and agent workflows.
Build .prettierrc with options (printWidth, tabWidth, semi, singleQuote, trailingComma, etc.) and a live formatted-code preview showing how each option affects sample code.
Use How to Use for execution steps and FAQ for constraints, policies, and edge cases.
Last updated:
This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.
Agent Invocation
Best Path For Builders
Browser workflow
Runs instantly in the browser with private local processing and copy/export-ready output.
Browser Workflow
This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.
/prettier-config-builder/
For automation planning, fetch the canonical contract at /api/tool/prettier-config-builder.json.
How to Use Prettier Config Builder
- 1
Set print width and indentation
Adjust printWidth, tabWidth, and useTabs. The live preview reflows the sample code instantly so you can see how lines break under your chosen width.
- 2
Configure quotes and semicolons
Toggle semi, singleQuote, jsxSingleQuote, bracketSpacing, and bracketSameLine. The preview rewrites string literals and JSX brackets as you flip each option.
- 3
Pick punctuation rules
Choose trailingComma (all, es5, none), arrowParens, endOfLine, proseWrap, quoteProps, and htmlWhitespaceSensitivity. Each affects how Prettier reformats specific syntax.
- 4
Edit the sample code
Replace the default React snippet with your own code to see how your settings handle real patterns from your codebase, including JSX, arrays, and arrow functions.
- 5
Choose output format and copy
Pick .prettierrc (JSON), YAML, package.json field, or prettier.config.js (ESM). Copy the file and commit it to your project root.