|
| 1 | +# https://prettier.io/docs/en/options.html |
| 2 | + |
| 3 | +# -------------------------------------------------------------------------------------- |
| 4 | +# Try prettier's new ternary formatting before it becomes the |
| 5 | +# default behavior. |
| 6 | +# |
| 7 | +# only in prettier v3.x |
| 8 | +# |
| 9 | +# Moves the ? in multiline ternaries to the end of the first line |
| 10 | +# instead of the start of the second, along with several related |
| 11 | +# changes. |
| 12 | +# |
| 13 | +# @default : false |
| 14 | +# @ref : https://prettier.io/docs/en/options.html#experimental-ternaries |
| 15 | +# https://github.com/prettier/prettier/pull/13183 |
| 16 | +# -------------------------------------------------------------------------------------- |
| 17 | +# experimentalTernaries: false |
| 18 | + |
| 19 | +# -------------------------------------------------------------------------------------- |
| 20 | +# Specify the line length that the printer will wrap on. |
| 21 | +# |
| 22 | +# @default : 80 |
| 23 | +# @ref : https://prettier.io/docs/en/options.html#print-width |
| 24 | +# -------------------------------------------------------------------------------------- |
| 25 | +printWidth: 120 |
| 26 | + |
| 27 | +# -------------------------------------------------------------------------------------- |
| 28 | +# Specify the number of spaces per indentation-level. |
| 29 | +# |
| 30 | +# @default : 2 |
| 31 | +# @ref : https://prettier.io/docs/en/options.html#tab-width |
| 32 | +# -------------------------------------------------------------------------------------- |
| 33 | +tabWidth: 4 |
| 34 | + |
| 35 | +# -------------------------------------------------------------------------------------- |
| 36 | +# Indent lines with tabs instead of spaces. |
| 37 | +# |
| 38 | +# @default : false |
| 39 | +# @ref : https://prettier.io/docs/en/options.html#tabs |
| 40 | +# -------------------------------------------------------------------------------------- |
| 41 | +useTabs: false |
| 42 | + |
| 43 | +# -------------------------------------------------------------------------------------- |
| 44 | +# Print semicolons at the ends of statements. |
| 45 | +# |
| 46 | +# true : Add a semicolon at the end of every statement. |
| 47 | +# false : Only add semicolons at the beginning of lines that |
| 48 | +# may introduce ASI failures. |
| 49 | +# |
| 50 | +# @default : true |
| 51 | +# @ref : https://prettier.io/docs/en/options.html#semicolons |
| 52 | +# -------------------------------------------------------------------------------------- |
| 53 | +semi: true |
| 54 | + |
| 55 | +# -------------------------------------------------------------------------------------- |
| 56 | +# Use single quotes instead of double quotes. |
| 57 | +# |
| 58 | +# @default : false |
| 59 | +# @ref : https://prettier.io/docs/en/options.html#quotes |
| 60 | +# -------------------------------------------------------------------------------------- |
| 61 | +singleQuote: true |
| 62 | + |
| 63 | +# -------------------------------------------------------------------------------------- |
| 64 | +# Change when properties in objects are quoted. |
| 65 | +# |
| 66 | +# "as-needed" : Only add quotes around object properties where required. |
| 67 | +# "consistent" : If at least one property in an object requires quotes, quote all properties. |
| 68 | +# "preserve" : Respect the input use of quotes in object properties. |
| 69 | +# |
| 70 | +# |
| 71 | +# @default : "as-needed" |
| 72 | +# @ref : https://prettier.io/docs/en/options.html#quote-props |
| 73 | +# -------------------------------------------------------------------------------------- |
| 74 | +quoteProps: 'preserve' |
| 75 | + |
| 76 | +# -------------------------------------------------------------------------------------- |
| 77 | +# Use single quotes instead of double quotes in JSX. |
| 78 | +# |
| 79 | +# @default : false |
| 80 | +# @ref : https://prettier.io/docs/en/options.html#jsx-quotes |
| 81 | +# -------------------------------------------------------------------------------------- |
| 82 | +jsxSingleQuote: true |
| 83 | + |
| 84 | +# -------------------------------------------------------------------------------------- |
| 85 | +# Print trailing commas wherever possible in multi-line comma-separated |
| 86 | +# syntactic structures. |
| 87 | +# |
| 88 | +# (A single-line array, for example, never gets trailing commas.) |
| 89 | +# |
| 90 | +# Default value changed from es5 to all in v3.0.0 |
| 91 | +# |
| 92 | +# "all" : Trailing commas wherever possible (including |
| 93 | +# function parameters and calls). To run, JavaScript |
| 94 | +# code formatted this way needs an engine that |
| 95 | +# supports ES2017 (Node.js 8+ or a modern browser) |
| 96 | +# or downlevel compilation. This also enables |
| 97 | +# trailing commas in type parameters in TypeScript |
| 98 | +# (supported since TypeScript 2.7 released in January 2018). |
| 99 | +# |
| 100 | +# "es5" : Trailing commas where valid in ES5 (objects, arrays, etc.). |
| 101 | +# |
| 102 | +# Trailing commas in type parameters in TypeScript and Flow. |
| 103 | +# "none" : No trailing commas. |
| 104 | +# |
| 105 | +# |
| 106 | +# @default : "all" |
| 107 | +# @ref : https://prettier.io/docs/en/options.html#trailing-commas |
| 108 | +# -------------------------------------------------------------------------------------- |
| 109 | +trailingComma: none |
| 110 | + |
| 111 | +# -------------------------------------------------------------------------------------- |
| 112 | +# Print spaces between brackets in object literals. |
| 113 | +# |
| 114 | +# true : Example: { foo: bar }. |
| 115 | +# false : Example: {foo: bar}. |
| 116 | +# |
| 117 | +# @default : true |
| 118 | +# @ref : https://prettier.io/docs/en/options.html#bracket-spacing |
| 119 | +# -------------------------------------------------------------------------------------- |
| 120 | +bracketSpacing: true |
| 121 | + |
| 122 | +# -------------------------------------------------------------------------------------- |
| 123 | +# Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the |
| 124 | +# last line instead of being alone on the next line (does not apply to self closing |
| 125 | +# elements). |
| 126 | +# |
| 127 | +# true : Example: |
| 128 | +# |
| 129 | +# <button |
| 130 | +# className="prettier-class" |
| 131 | +# id="prettier-id" |
| 132 | +# onClick={this.handleClick}> |
| 133 | +# Click Here |
| 134 | +# </button> |
| 135 | +# |
| 136 | +# false : Example: |
| 137 | +# |
| 138 | +# <button |
| 139 | +# className="prettier-class" |
| 140 | +# id="prettier-id" |
| 141 | +# onClick={this.handleClick} |
| 142 | +# > |
| 143 | +# Click Here |
| 144 | +# </button> |
| 145 | +# |
| 146 | +# @default : false |
| 147 | +# @ref : https://prettier.io/docs/en/options.html#bracket-line |
| 148 | +# -------------------------------------------------------------------------------------- |
| 149 | +bracketSameLine: false |
| 150 | + |
| 151 | +# -------------------------------------------------------------------------------------- |
| 152 | +# Include parentheses around a sole arrow function parameter. |
| 153 | +# |
| 154 | +# First available in v1.9.0, default value changed from avoid to always in v2.0.0 |
| 155 | +# |
| 156 | +# "always" : Always include parens. Example: (x) => x |
| 157 | +# "avoid" : Omit parens when possible. Example: x => x |
| 158 | +# |
| 159 | +# |
| 160 | +# @default : "always" |
| 161 | +# @ref : https://prettier.io/docs/en/options.html#arrow-function-parentheses |
| 162 | +# -------------------------------------------------------------------------------------- |
| 163 | +arrowParens: always |
| 164 | + |
| 165 | +# -------------------------------------------------------------------------------------- |
| 166 | +# By default, Prettier will not change wrapping in markdown text since some services |
| 167 | +# use a linebreak-sensitive renderer, e.g. GitHub comments and BitBucket. To have |
| 168 | +# Prettier wrap prose to the print width, change this option to "always". If you want |
| 169 | +# Prettier to force all prose blocks to be on a single line and rely on editor/viewer |
| 170 | +# soft wrapping instead, you can use "never". |
| 171 | +# |
| 172 | +# First available in v1.8.2 |
| 173 | +# |
| 174 | +# "always" : Wrap prose if it exceeds the print width. |
| 175 | +# "never" : Un-wrap each block of prose into one line. |
| 176 | +# "preserve" : Do nothing, leave prose as-is. First available in v1.9.0 |
| 177 | +# |
| 178 | +# |
| 179 | +# @default : "preserve" |
| 180 | +# @ref : https://prettier.io/docs/en/options.html#prose-wrap |
| 181 | +# -------------------------------------------------------------------------------------- |
| 182 | +proseWrap: 'preserve' |
| 183 | + |
| 184 | +# -------------------------------------------------------------------------------------- |
| 185 | +# Specify the global whitespace sensitivity for HTML, Vue, Angular, and Handlebars. |
| 186 | +# See whitespace-sensitive formatting for more info. |
| 187 | +# |
| 188 | +# First available in v1.15.0. First available for Handlebars in 2.3.0 |
| 189 | +# |
| 190 | +# "css" : Respect the default value of CSS display property. |
| 191 | +# For Handlebars treated same as strict. |
| 192 | +# "strict" : Whitespace (or the lack of it) around all tags is considered significant. |
| 193 | +# "ignore" : Whitespace (or the lack of it) around all tags is considered insignificant. |
| 194 | +# |
| 195 | +# |
| 196 | +# @default : "css" |
| 197 | +# @ref : https://prettier.io/docs/en/options.html#html-whitespace-sensitivity |
| 198 | +# https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting |
| 199 | +# -------------------------------------------------------------------------------------- |
| 200 | +htmlWhitespaceSensitivity: 'ignore' |
| 201 | + |
| 202 | +# -------------------------------------------------------------------------------------- |
| 203 | +# For historical reasons, there exist two common flavors of line endings in text |
| 204 | +# files. That is: |
| 205 | +# - \n (or LF for Line Feed) |
| 206 | +# - \r\n (or CRLF for Carriage Return + Line Feed). |
| 207 | +# |
| 208 | +# The former is common on Linux and macOS, while the latter is prevalent on Windows. |
| 209 | +# Some details explaining why it is so can be found on Wikipedia. |
| 210 | +# |
| 211 | +# When people collaborate on a project from different operating systems, it becomes |
| 212 | +# easy to end up with mixed line endings in a shared git repository. It is also possible |
| 213 | +# for Windows users to accidentally change line endings in a previously committed file |
| 214 | +# from LF to CRLF. Doing so produces a large git diff and thus makes the line-by-line |
| 215 | +# history for a file (git blame) harder to explore. |
| 216 | +# |
| 217 | +# All modern text editors in all operating systems are able to correctly display line |
| 218 | +# endings when \n (LF) is used. However, old versions of Notepad for Windows will visually |
| 219 | +# squash such lines into one as they can only deal with \r\n (CRLF). |
| 220 | +# |
| 221 | +# First available in v1.15.0, default value changed from auto to lf in v2.0.0 |
| 222 | +# |
| 223 | +# "lf" : Line Feed only (\n), common on Linux and macOS as well as inside git repos |
| 224 | +# "crlf" : Carriage Return + Line Feed characters (\r\n), common on Windows |
| 225 | +# "cr" : Carriage Return character only (\r), used very rarely |
| 226 | +# "auto" : Maintain existing line endings (mixed values within one file are normalised |
| 227 | +# by looking at what’s used after the first line) |
| 228 | +# |
| 229 | +# @default : "lf" |
| 230 | +# @ref : https://prettier.io/docs/en/options.html#end-of-line |
| 231 | +# -------------------------------------------------------------------------------------- |
| 232 | +endOfLine: 'auto' |
| 233 | + |
| 234 | +# -------------------------------------------------------------------------------------- |
| 235 | +# Control whether Prettier formats quoted code embedded in the file. |
| 236 | +# |
| 237 | +# When Prettier identifies cases where it looks like you've placed some code it knows |
| 238 | +# how to format within a string in another file, like in a tagged template in |
| 239 | +# JavaScript with a tag named html or in code blocks in Markdown, it will by default try |
| 240 | +# to format that code. |
| 241 | +# |
| 242 | +# Sometimes this behavior is undesirable, particularly in cases where you might not have |
| 243 | +# intended the string to be interpreted as code. This option allows you to switch between |
| 244 | +# the default behavior (auto) and disabling this feature entirely (off). |
| 245 | +# |
| 246 | +# First available in v2.1.0 |
| 247 | +# |
| 248 | +# "auto" : Format embedded code if Prettier can automatically identify it. |
| 249 | +# "off" : Never automatically format embedded code. |
| 250 | +# |
| 251 | +# @default : "auto" |
| 252 | +# @ref : https://prettier.io/docs/en/options.html#embedded-language-formatting |
| 253 | +# -------------------------------------------------------------------------------------- |
| 254 | +embeddedLanguageFormatting: 'auto' |
| 255 | + |
| 256 | +# -------------------------------------------------------------------------------------- |
| 257 | +# Enforce single attribute per line in HTML, Vue and JSX. |
| 258 | +# |
| 259 | +# true : Enforce single attribute per line. |
| 260 | +# false : Do not enforce single attribute per line. |
| 261 | +# |
| 262 | +# @default : false |
| 263 | +# @ref : https://prettier.io/docs/en/options.html#single-attribute-per-line |
| 264 | +# -------------------------------------------------------------------------------------- |
| 265 | +singleAttributePerLine: false |
0 commit comments