Générateur de configuration et playground Prettier

Chargement de Prettier latest…

Référence des options Prettier

Chaque option ci-dessous est disponible dans le générateur ci-dessus. Les valeurs par défaut proviennent de Prettier 3.9.6.

bracketSameLineBracket Same Line

where the closing angle bracket of a multi-line tag lands

Par défaut
false
Option CLI
--bracket-same-line

bracketSpacingBracket Spacing

the spaces inside object braces, and everywhere they follow

Par défaut
true
Option CLI
--no-bracket-spacing

objectWrapObject Wrap

Prettier's one deliberate escape hatch, and how to switch it off

Par défaut
"preserve"
Option CLI
--object-wrap
Valeurs autorisées
preservecollapse

proseWrapProse Wrap

how Markdown paragraphs are wrapped, and why the default leaves them alone

Par défaut
"preserve"
Option CLI
--prose-wrap
Valeurs autorisées
alwaysneverpreserve

singleAttributePerLineSingle Attribute Per Line

one attribute per line, for markup diffs that read like code diffs

Par défaut
false
Option CLI
--single-attribute-per-line

singleQuoteSingle Quote

a preference Prettier overrides whenever escaping would suffer

Par défaut
false
Option CLI
--single-quote

embeddedLanguageFormattingEmbedded Language Formatting

formatting the CSS, HTML and GraphQL hiding inside your template literals

Par défaut
"auto"
Option CLI
--embedded-language-formatting
Valeurs autorisées
autooff

endOfLineEnd Of Line

line endings, and the Windows diff problem this option was created to end

Par défaut
"lf"
Option CLI
--end-of-line
Valeurs autorisées
lfcrlfcrauto

printWidthPrint Width

the width Prettier aims for, not a hard limit

Par défaut
80
Option CLI
--print-width

tabWidthTab Width

how wide one indentation level is, in columns

Par défaut
2
Option CLI
--tab-width

useTabsUse Tabs

tabs for indentation, and why accessibility is the strongest argument

Par défaut
false
Option CLI
--use-tabs

htmlWhitespaceSensitivityHtml Whitespace Sensitivity

the option that stops Prettier changing how your page renders

Par défaut
"css"
Option CLI
--html-whitespace-sensitivity
Valeurs autorisées
cssstrictignore

vueIndentScriptAndStyleVue Indent Script And Style

whether a Vue SFC indents inside its script and style blocks

Par défaut
false
Option CLI
--vue-indent-script-and-style

arrowParensArrow Parens

parentheses around a lone arrow parameter, and the edit cost of leaving them off

Par défaut
"always"
Option CLI
--arrow-parens
Valeurs autorisées
alwaysavoid

experimentalOperatorPositionExperimental Operator Position

whether a wrapped operator trails the line above or leads the line below

Par défaut
"end"
Option CLI
--experimental-operator-position
Valeurs autorisées
startend

experimentalTernariesExperimental Ternaries

an opt-in answer to Prettier's longest-running formatting argument

Par défaut
false
Option CLI
--experimental-ternaries

jsxSingleQuoteJsx Single Quote

quote style for JSX attributes, kept separate from your JavaScript strings

Par défaut
false
Option CLI
--jsx-single-quote

quotePropsQuote Props

when object keys get quoted, and the consistency option most people want

Par défaut
"as-needed"
Option CLI
--quote-props
Valeurs autorisées
as-neededconsistentpreserve

semiSemi

semicolons, and the ASI hazards behind the default

Par défaut
true
Option CLI
--no-semi

trailingCommaTrailing Comma

the option that exists to make diffs smaller

Par défaut
"all"
Option CLI
--trailing-comma
Valeurs autorisées
alles5none

checkIgnorePragmaCheck Ignore Pragma

lets a file opt itself out of formatting entirely

Par défaut
false
Option CLI
--check-ignore-pragma

cursorOffsetCursor Offset

the option that stops format-on-save losing your place

Par défaut
-1
Option CLI
--cursor-offset

insertPragmaInsert Pragma

stamps a @format marker on every file Prettier formats

Par défaut
false
Option CLI
--insert-pragma

rangeEndRange End

the exclusive end of a partial format

Par défaut
Option CLI
--range-end

rangeStartRange Start

the start of a partial format, and how Format Selection actually works

Par défaut
0
Option CLI
--range-start

requirePragmaRequire Pragma

the option that lets a huge codebase adopt Prettier one file at a time

Par défaut
false
Option CLI
--require-pragma