Generatore di configurazione e playground Prettier

Caricamento Prettier latest…

Riferimento delle opzioni Prettier

Ogni opzione qui sotto è disponibile nel generatore in alto. I valori predefiniti mostrati provengono da Prettier 3.9.6.

bracketSameLineBracket Same Line

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

Predefinito
false
Flag CLI
--bracket-same-line

bracketSpacingBracket Spacing

the spaces inside object braces, and everywhere they follow

Predefinito
true
Flag CLI
--no-bracket-spacing

objectWrapObject Wrap

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

Predefinito
"preserve"
Flag CLI
--object-wrap
Valori ammessi
preservecollapse

proseWrapProse Wrap

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

Predefinito
"preserve"
Flag CLI
--prose-wrap
Valori ammessi
alwaysneverpreserve

singleAttributePerLineSingle Attribute Per Line

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

Predefinito
false
Flag CLI
--single-attribute-per-line

singleQuoteSingle Quote

a preference Prettier overrides whenever escaping would suffer

Predefinito
false
Flag CLI
--single-quote

embeddedLanguageFormattingEmbedded Language Formatting

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

Predefinito
"auto"
Flag CLI
--embedded-language-formatting
Valori ammessi
autooff

endOfLineEnd Of Line

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

Predefinito
"lf"
Flag CLI
--end-of-line
Valori ammessi
lfcrlfcrauto

printWidthPrint Width

the width Prettier aims for, not a hard limit

Predefinito
80
Flag CLI
--print-width

tabWidthTab Width

how wide one indentation level is, in columns

Predefinito
2
Flag CLI
--tab-width

useTabsUse Tabs

tabs for indentation, and why accessibility is the strongest argument

Predefinito
false
Flag CLI
--use-tabs

htmlWhitespaceSensitivityHtml Whitespace Sensitivity

the option that stops Prettier changing how your page renders

Predefinito
"css"
Flag CLI
--html-whitespace-sensitivity
Valori ammessi
cssstrictignore

vueIndentScriptAndStyleVue Indent Script And Style

whether a Vue SFC indents inside its script and style blocks

Predefinito
false
Flag CLI
--vue-indent-script-and-style

arrowParensArrow Parens

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

Predefinito
"always"
Flag CLI
--arrow-parens
Valori ammessi
alwaysavoid

experimentalOperatorPositionExperimental Operator Position

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

Predefinito
"end"
Flag CLI
--experimental-operator-position
Valori ammessi
startend

experimentalTernariesExperimental Ternaries

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

Predefinito
false
Flag CLI
--experimental-ternaries

jsxSingleQuoteJsx Single Quote

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

Predefinito
false
Flag CLI
--jsx-single-quote

quotePropsQuote Props

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

Predefinito
"as-needed"
Flag CLI
--quote-props
Valori ammessi
as-neededconsistentpreserve

semiSemi

semicolons, and the ASI hazards behind the default

Predefinito
true
Flag CLI
--no-semi

trailingCommaTrailing Comma

the option that exists to make diffs smaller

Predefinito
"all"
Flag CLI
--trailing-comma
Valori ammessi
alles5none

checkIgnorePragmaCheck Ignore Pragma

lets a file opt itself out of formatting entirely

Predefinito
false
Flag CLI
--check-ignore-pragma

cursorOffsetCursor Offset

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

Predefinito
-1
Flag CLI
--cursor-offset

insertPragmaInsert Pragma

stamps a @format marker on every file Prettier formats

Predefinito
false
Flag CLI
--insert-pragma

rangeEndRange End

the exclusive end of a partial format

Predefinito
Flag CLI
--range-end

rangeStartRange Start

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

Predefinito
0
Flag CLI
--range-start

requirePragmaRequire Pragma

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

Predefinito
false
Flag CLI
--require-pragma