Configure and compare options for Prettier and Oxfmt. Preview real-time changes and export your configuration.
printWidthCLI: --print-width <int>API: printWidth: <int>Standard line width for readability
function example() {const message = "Hello";return message;}
tabWidthCLI: --tab-width <int>API: tabWidth: <int>function example() {if (true) {return "nested";}}
useTabsCLI: --use-tabsAPI: useTabs: <bool>Use spaces for indentation
function example() {return "spaces";}
semiCLI: --no-semiAPI: semi: <bool>Add a semicolon at the end of every statement
const greeting = "Hello";const name = "World";console.log(greeting, name);
singleQuoteCLI: --single-quoteAPI: singleQuote: <bool>Use double quotes
const greeting = "Hello";const message = "It's a nice day";
quotePropsCLI: --quote-props <as-needed|consistent|preserve>API: quoteProps: "<as-needed|consistent|preserve>"Only add quotes around object properties where required
const obj = {foo: "bar","foo-bar": "baz",123: "number"};
jsxSingleQuoteCLI: --jsx-single-quoteAPI: jsxSingleQuote: <bool>Use double quotes in JSX
<buttonclassName="btn"id="submit"onClick={handleClick}>Click Me</button>
trailingCommaCLI: --trailing-comma <all|es5|none>API: trailingComma: "<all|es5|none>"Trailing commas wherever possible (including function parameters)
const obj = {foo: "bar",baz: "qux",};function example(param1,param2,) {return [item1,item2,];}
bracketSpacingCLI: --no-bracket-spacingAPI: bracketSpacing: <bool>Spaces inside brackets
const obj = { foo: bar };import { useState } from "react";
objectWrapCLI: --object-wrap <preserve|collapse>API: objectWrap: "<preserve|collapse>"Keep as multi-line if there is a newline between opening brace and first property
const expanded = {foo: "bar",baz: "qux",};const compact = { foo: "bar", baz: "qux" };
bracketSameLineCLI: --bracket-same-lineAPI: bracketSameLine: <bool>Bracket on its own line
<buttonclassName="prettier-class"id="prettier-id"onClick={this.handleClick}>Click Here</button>
arrowParensCLI: --arrow-parens <always|avoid>API: arrowParens: "<always|avoid>"Always include parens
const add = (x) => x + 1;const multiply = (x) => (y) => x * y;const greet = (name) => `Hello, ${name}!`;
proseWrapCLI: --prose-wrap <always|never|preserve>API: proseWrap: "<always|never|preserve>"Do nothing, leave prose as-is
This is a long line of text that will remain on a single line regardless of the print width setting.This paragraphhas intentionalline breaks.
htmlWhitespaceSensitivityCLI: --html-whitespace-sensitivity <css|strict|ignore>API: htmlWhitespaceSensitivity: "<css|strict|ignore>"Respect the default value of CSS display property
<span class="dolorum atque aspernatur">Est molestiae sunt facilis qui rem.</span><div class="voluptatem architecto">Architecto rerum architecto.</div>
singleAttributePerLineCLI: --single-attribute-per-lineAPI: singleAttributePerLine: <bool>Do not enforce single attribute per line
<button className="btn" id="submit" type="button">Submit</button>
endOfLineCLI: --end-of-line <lf|crlf|cr|auto>API: endOfLine: "<lf|crlf|cr|auto>"Line Feed only (\n), common on Linux/macOS and in git repos
const a = 1;const b = 2;// Lines end with \n
embeddedLanguageFormattingCLI: --embedded-language-formatting=<off|auto>API: embeddedLanguageFormatting: "<off|auto>"Format embedded code if Prettier can automatically identify it
const html = /* html */ `<div class="container"><p>Formatted HTML</p></div>`;
experimentalTernariesCLI: --experimental-ternariesAPI: experimentalTernaries: <bool>Keep question marks on the same line as the consequent
const result = condition1? value1: condition2? value2: value3;
These options are exclusive to Oxfmt, a blazingly fast Rust-based JavaScript formatter.
objectWrapCLI: --object-wrap <preserve|collapse|always>API: objectWrap: "<preserve|collapse|always>"Keep as multi-line if there is a newline between opening brace and first property
const expanded = {foo: "bar",};
insertFinalNewlineCLI: --insert-final-newlineAPI: insertFinalNewline: <bool>Add a newline at the end of every file
const message = "Hello";export default message;// File ends with a newline ↵
experimentalSortImportsCLI: --experimental-sort-importsAPI: experimentalSortImports: { ... }Do not sort import statements
import { z } from 'Zod';import { client } from 'axios';import fs from 'node:fs';import path from 'node:path';import { theme } from '@/Beta/theme';import { cn } from '@/alpha/utils';
experimentalSortPackageJsonCLI: --experimental-sort-package-jsonAPI: experimentalSortPackageJson: <bool>Sort package.json keys in conventional order
{"name": "my-package","version": "1.0.0","description": "A package","main": "index.js","scripts": { ... },"dependencies": { ... },"devDependencies": { ... }}
experimentalTailwindcssCLI: --experimental-tailwindcssAPI: experimentalTailwindcss: { ... }Do not sort Tailwind CSS classes
<div className="text-red-500 p-4 flex items-center bg-white mt-2">Content</div>
ignorePatternsCLI: --ignore-pattern <glob>API: ignorePatterns: ["<glob>", ...]No files are ignored by default
// All files are formatted// src/index.ts ✓// dist/bundle.js ✓// node_modules/pkg/index.js ✓