By default, import and export declarations can only appear at a program's top level. Setting this option to true allows them anywhere where a statement is allowed.
By default, a return statement at the top level raises an error. Set this to true to accept such code.
By default, exported identifiers must refer to a declared variable. Set this to true to allow export statements to reference undeclared variables.
Include parentheses around a sole arrow function parameter.
Print spaces between brackets in object literals.
By default, the parser adds information about parentheses by setting
extra.parenthesized
to true
as needed.
When this option is true
the parser creates ParenthesizedExpression
AST nodes instead of using the extra
property.
Control whether Prettier formats quoted code embedded in the file.
Which end of line characters to apply.
Specify the input filepath. This will be used to do parser inference.
How to handle whitespaces in HTML.
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.
Put the >
of a multi-line JSX element at the end of the last line instead of being alone on the next line.
Use single quotes in JSX.
Specify which parser to use.
Array containing the plugins that you want to enable.
Specify the line length that the printer will wrap on.
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.
Change when properties in objects are quoted.
Format only a segment of a file.
Format only a segment of a file.
Adds a ranges property to each node: [node.start, node.end]
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.
Print semicolons at the ends of statements.
Use single quotes instead of double quotes.
Correlate output AST nodes with their source filename. Useful when generating code and source maps from the ASTs of multiple input files.
Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". Defaults to "script". "unambiguous" will make @babel/parser attempt to guess, based on the presence of ES6 import or export statements. Files with ES6 imports and exports are considered "module" and are otherwise "script".
By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful for integration with other source tools.
Should the parser work in strict mode. Defaults to true if sourceType === 'module'. Otherwise, false.
Specify the number of spaces per indentation-level.
Adds all parsed tokens to a tokens property on the File node.
Print trailing commas wherever possible.
Indent lines with tabs instead of spaces
Whether or not to indent the code inside
By default, await use is not allowed outside of an async function. Set this to true to accept such code.