Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface RequiredOptions

Hierarchy

Index

Properties

arrowParens

arrowParens: "avoid" | "always"

Include parentheses around a sole arrow function parameter.

default

'always'

bracketSpacing

bracketSpacing: boolean

Print spaces between brackets in object literals.

default

true

embeddedLanguageFormatting

embeddedLanguageFormatting: "auto" | "off"

Control whether Prettier formats quoted code embedded in the file.

default

'auto'

endOfLine

endOfLine: "auto" | "lf" | "crlf" | "cr"

Which end of line characters to apply.

default

'lf'

filepath

filepath: string

Specify the input filepath. This will be used to do parser inference.

htmlWhitespaceSensitivity

htmlWhitespaceSensitivity: "css" | "strict" | "ignore"

How to handle whitespaces in HTML.

default

'css'

insertPragma

insertPragma: boolean

Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier. This works well when used in tandem with the --require-pragma option. If there is already a docblock at the top of the file then this option will add a newline to it with the @format marker.

default

false

jsxBracketSameLine

jsxBracketSameLine: boolean

Put the > of a multi-line JSX element at the end of the last line instead of being alone on the next line.

default

false

jsxSingleQuote

jsxSingleQuote: boolean

Use single quotes in JSX.

default

false

parser

Specify which parser to use.

plugins

plugins: Array<string | Plugin>

The plugin API is in a beta state.

printWidth

printWidth: number

Specify the line length that the printer will wrap on.

default

80

proseWrap

proseWrap: "always" | "never" | "preserve"

By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer. In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.

default

'preserve'

quoteProps

quoteProps: "as-needed" | "consistent" | "preserve"

Change when properties in objects are quoted.

default

'as-needed'

rangeEnd

rangeEnd: number

Format only a segment of a file.

default

Infinity

rangeStart

rangeStart: number

Format only a segment of a file.

default

0

requirePragma

requirePragma: boolean

Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. This is very useful when gradually transitioning large, unformatted codebases to prettier.

default

false

semi

semi: boolean

Print semicolons at the ends of statements.

default

true

singleQuote

singleQuote: boolean

Use single quotes instead of double quotes.

default

false

tabWidth

tabWidth: number

Specify the number of spaces per indentation-level.

default

2

trailingComma

trailingComma: "none" | "es5" | "all"

Print trailing commas wherever possible.

default

'es5'

useTabs

useTabs: boolean

Indent lines with tabs instead of spaces

default

false

vueIndentScriptAndStyle

vueIndentScriptAndStyle: boolean

Whether or not to indent the code inside