Discover modules > cue.dev/x/npmjs/prettier
v0.2.0
#Schema:
click to see definition
{
	@jsonschema(schema="http://json-schema.org/draft-07/schema#")
	@jsonschema(id="https://www.schemastore.org/prettierrc.json")
	matchN(1, [matchN(2, [#optionsDefinition & {...}, #overridesDefinition & {...}]), string])
	#optionsDefinition: {
		arrowParens?:                  matchN(1, ["always", "avoid"])
		bracketSameLine?:              bool
		bracketSpacing?:               bool
		checkIgnorePragma?:            bool
		cursorOffset?:                 int
		embeddedLanguageFormatting?:   matchN(1, ["auto", "off"])
		endOfLine?:                    matchN(1, ["lf", "crlf", "cr", "auto"])
		experimentalOperatorPosition?: matchN(1, ["start", "end"])
		experimentalTernaries?:        bool
		filepath?:                     string
		htmlWhitespaceSensitivity?:    matchN(1, ["css", "strict", "ignore"])
		insertPragma?:                 bool
		jsxSingleQuote?:               bool
		objectWrap?:                   matchN(1, ["preserve", "collapse"])
		parser?: matchN(
			>=1,
			[
				"flow",
				"babel",
				"babel-flow",
				"babel-ts",
				"typescript",
				"acorn",
				"espree",
				"meriyah",
				"css",
				"less",
				"scss",
				"json",
				"json5",
				"jsonc",
				"json-stringify",
				"graphql",
				"markdown",
				"mdx",
				"vue",
				"yaml",
				"glimmer",
				"html",
				"angular",
				"lwc",
				"mjml",
				string,
			],
		)
		plugins?:                 [...string]
		printWidth?:              int
		proseWrap?:               matchN(1, ["always", "never", "preserve"])
		quoteProps?:              matchN(1, ["as-needed", "consistent", "preserve"])
		rangeEnd?:                int
		rangeStart?:              int
		requirePragma?:           bool
		semi?:                    bool
		singleAttributePerLine?:  bool
		singleQuote?:             bool
		tabWidth?:                int
		trailingComma?:           matchN(1, ["all", "es5", "none"])
		useTabs?:                 bool
		vueIndentScriptAndStyle?: bool
		...
	}
	#overridesDefinition: {
		overrides?: [...close({
			files!:        matchN(1, [string, [...string]])
			excludeFiles?: matchN(1, [string, [...string]])
			options?:      #optionsDefinition
		})]
		...
	}
}
¶

Schema for .prettierrc

#optionsDefinition: ¶
arrowParens?: matchN(1, ["always", "avoid"]) ¶

Include parentheses around a sole arrow function parameter.

bracketSameLine?: bool ¶

Put > of opening tags on the last line instead of on a new line.

bracketSpacing?: bool ¶

Print spaces between brackets.

checkIgnorePragma?: bool ¶

Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.

cursorOffset?: int ¶

Print (to stderr) where a cursor at the given position would move to after formatting.

embeddedLanguageFormatting?: matchN(1, ["auto", "off"]) ¶

Control how Prettier formats quoted code embedded in the file.

endOfLine?: matchN(1, ["lf", "crlf", "cr", "auto"]) ¶

Which end of line characters to apply.

experimentalOperatorPosition?: matchN(1, ["start", "end"]) ¶

Where to print operators when binary expressions wrap lines.

experimentalTernaries?: bool ¶

Use curious ternaries, with the question mark after the condition.

filepath?: string ¶

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

htmlWhitespaceSensitivity?: matchN(1, ["css", "strict", "ignore"]) ¶

How to handle whitespaces in HTML.

insertPragma?: bool ¶

Insert @format pragma into file's first docblock comment.

jsxSingleQuote?: bool ¶

Use single quotes in JSX.

objectWrap?: matchN(1, ["preserve", "collapse"]) ¶

How to wrap object literals.

parser?:
click to see definition
matchN(
	>=1,
	[
		"flow",
		"babel",
		"babel-flow",
		"babel-ts",
		"typescript",
		"acorn",
		"espree",
		"meriyah",
		"css",
		"less",
		"scss",
		"json",
		"json5",
		"jsonc",
		"json-stringify",
		"graphql",
		"markdown",
		"mdx",
		"vue",
		"yaml",
		"glimmer",
		"html",
		"angular",
		"lwc",
		"mjml",
		string,
	],
)
¶

Which parser to use.

plugins?: [...string] ¶

Add a plugin. Multiple plugins can be passed as separate `--plugin`s.

printWidth?: int ¶

The line length where Prettier will try wrap.

proseWrap?: matchN(1, ["always", "never", "preserve"]) ¶

How to wrap prose.

quoteProps?: matchN(1, ["as-needed", "consistent", "preserve"]) ¶

Change when properties in objects are quoted.

rangeEnd?: int ¶

Format code ending at a given character offset (exclusive). The range will extend forwards to the end of the selected statement.

rangeStart?: int ¶

Format code starting at a given character offset. The range will extend backwards to the start of the first line containing the selected statement.

requirePragma?: bool ¶

Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.

semi?: bool ¶

Print semicolons.

singleAttributePerLine?: bool ¶

Enforce single attribute per line in HTML, Vue and JSX.

singleQuote?: bool ¶

Use single quotes instead of double quotes.

tabWidth?: int ¶

Number of spaces per indentation level.

trailingComma?: matchN(1, ["all", "es5", "none"]) ¶

Print trailing commas wherever possible when multi-line.

useTabs?: bool ¶

Indent with tabs instead of spaces.

vueIndentScriptAndStyle?: bool ¶

Indent script and style tags in Vue files.

#overridesDefinition: ¶
overrides?:
click to see definition
[...close({
	files!:        matchN(1, [string, [...string]])
	excludeFiles?: matchN(1, [string, [...string]])
	options?:      #optionsDefinition
})]
¶

Provide a list of patterns to override prettier configuration.

Source files

  • schema.cue