cue.dev/x/npmjs/prettier@v0.1.0

schema.cue raw

  1package prettier
  2
  3// Schema for .prettierrc
  4#Schema: {
  5	@jsonschema(schema="http://json-schema.org/draft-07/schema#")
  6	@jsonschema(id="https://json.schemastore.org/prettierrc.json")
  7	matchN(1, [matchN(2, [#optionsDefinition & {
  8		...
  9	}, #overridesDefinition & {
 10		...
 11	}]), string])
 12
 13	#optionsDefinition: {
 14		// Include parentheses around a sole arrow function parameter.
 15		"arrowParens"?: matchN(1, ["always", "avoid"])
 16
 17		// Put > of opening tags on the last line instead of on a new
 18		// line.
 19		"bracketSameLine"?: bool
 20
 21		// Print spaces between brackets.
 22		"bracketSpacing"?: bool
 23
 24		// Check whether the file's first docblock comment contains
 25		// '@noprettier' or '@noformat' to determine if it should be
 26		// formatted.
 27		"checkIgnorePragma"?: bool
 28
 29		// Print (to stderr) where a cursor at the given position would
 30		// move to after formatting.
 31		"cursorOffset"?: int
 32
 33		// Control how Prettier formats quoted code embedded in the file.
 34		"embeddedLanguageFormatting"?: matchN(1, ["auto", "off"])
 35
 36		// Which end of line characters to apply.
 37		"endOfLine"?: matchN(1, ["lf", "crlf", "cr", "auto"])
 38
 39		// Where to print operators when binary expressions wrap lines.
 40		"experimentalOperatorPosition"?: matchN(1, ["start", "end"])
 41
 42		// Use curious ternaries, with the question mark after the
 43		// condition.
 44		"experimentalTernaries"?: bool
 45
 46		// Specify the input filepath. This will be used to do parser
 47		// inference.
 48		"filepath"?: string
 49
 50		// How to handle whitespaces in HTML.
 51		"htmlWhitespaceSensitivity"?: matchN(1, ["css", "strict", "ignore"])
 52
 53		// Insert @format pragma into file's first docblock comment.
 54		"insertPragma"?: bool
 55
 56		// Use single quotes in JSX.
 57		"jsxSingleQuote"?: bool
 58
 59		// How to wrap object literals.
 60		"objectWrap"?: matchN(1, ["preserve", "collapse"])
 61
 62		// Which parser to use.
 63		"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])
 64
 65		// Add a plugin. Multiple plugins can be passed as separate
 66		// `--plugin`s.
 67		"plugins"?: [...string]
 68
 69		// The line length where Prettier will try wrap.
 70		"printWidth"?: int
 71
 72		// How to wrap prose.
 73		"proseWrap"?: matchN(1, ["always", "never", "preserve"])
 74
 75		// Change when properties in objects are quoted.
 76		"quoteProps"?: matchN(1, ["as-needed", "consistent", "preserve"])
 77
 78		// Format code ending at a given character offset (exclusive).
 79		// The range will extend forwards to the end of the selected
 80		// statement.
 81		"rangeEnd"?: int
 82
 83		// Format code starting at a given character offset.
 84		// The range will extend backwards to the start of the first line
 85		// containing the selected statement.
 86		"rangeStart"?: int
 87
 88		// Require either '@prettier' or '@format' to be present in the
 89		// file's first docblock comment in order for it to be formatted.
 90		"requirePragma"?: bool
 91
 92		// Print semicolons.
 93		"semi"?: bool
 94
 95		// Enforce single attribute per line in HTML, Vue and JSX.
 96		"singleAttributePerLine"?: bool
 97
 98		// Use single quotes instead of double quotes.
 99		"singleQuote"?: bool
100
101		// Number of spaces per indentation level.
102		"tabWidth"?: int
103
104		// Print trailing commas wherever possible when multi-line.
105		"trailingComma"?: matchN(1, ["all", "es5", "none"])
106
107		// Indent with tabs instead of spaces.
108		"useTabs"?: bool
109
110		// Indent script and style tags in Vue files.
111		"vueIndentScriptAndStyle"?: bool
112		...
113	}
114
115	#overridesDefinition: {
116		// Provide a list of patterns to override prettier configuration.
117		"overrides"?: [...close({
118			// Include these files in this override.
119			"files"!: matchN(1, [string, [...string]])
120
121			// Exclude these files from this override.
122			"excludeFiles"?: matchN(1, [string, [...string]])
123			"options"?: #optionsDefinition
124		})]
125		...
126	}
127}