forked from Tencent/tdesign-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.prettierrc
351 lines (351 loc) · 10.8 KB
/
.prettierrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Schema for .prettierrc",
"definitions": {
"optionsDefinition": {
"type": "object",
"properties": {
"arrowParens": {
"description": "Include parentheses around a sole arrow function parameter.",
"default": "avoid",
"oneOf": [
{
"enum": ["avoid"],
"description": "Omit parens when possible. Example: `x => x`"
},
{
"enum": ["always"],
"description": "Always include parens. Example: `(x) => x`"
}
]
},
"bracketSpacing": {
"description": "Print spaces between brackets.",
"default": true,
"type": "boolean"
},
"cursorOffset": {
"description": "Print (to stderr) where a cursor at the given position would move to after formatting.\nThis option cannot be used with --range-start and --range-end.",
"default": -1,
"type": "integer"
},
"endOfLine": {
"description": "Which end of line characters to apply.",
"default": "auto",
"oneOf": [
{
"enum": ["auto"],
"description": "Maintain existing\n(mixed values within one file are normalised by looking at what's used after the first line)"
},
{
"enum": ["lf"],
"description": "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
},
{
"enum": ["crlf"],
"description": "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
},
{
"enum": ["cr"],
"description": "Carriage Return character only (\\r), used very rarely"
}
]
},
"filepath": {
"description": "Specify the input filepath. This will be used to do parser inference.",
"type": "string"
},
"htmlWhitespaceSensitivity": {
"description": "How to handle whitespaces in HTML.",
"default": "css",
"oneOf": [
{
"enum": ["css"],
"description": "Respect the default value of CSS display property."
},
{
"enum": ["strict"],
"description": "Whitespaces are considered sensitive."
},
{
"enum": ["ignore"],
"description": "Whitespaces are considered insensitive."
}
]
},
"insertPragma": {
"description": "Insert @format pragma into file's first docblock comment.",
"default": false,
"type": "boolean"
},
"jsxBracketSameLine": {
"description": "Put > on the last line instead of at a new line.",
"default": false,
"type": "boolean"
},
"jsxSingleQuote": {
"description": "Use single quotes in JSX.",
"default": false,
"type": "boolean"
},
"parser": {
"description": "Which parser to use.",
"oneOf": [
{
"enum": ["flow"],
"description": "Flow"
},
{
"enum": ["babel"],
"description": "JavaScript"
},
{
"enum": ["babel-flow"],
"description": "Flow"
},
{
"enum": ["typescript"],
"description": "TypeScript"
},
{
"enum": ["css"],
"description": "CSS"
},
{
"enum": ["less"],
"description": "Less"
},
{
"enum": ["scss"],
"description": "SCSS"
},
{
"enum": ["json"],
"description": "JSON"
},
{
"enum": ["json5"],
"description": "JSON5"
},
{
"enum": ["json-stringify"],
"description": "JSON.stringify"
},
{
"enum": ["graphql"],
"description": "GraphQL"
},
{
"enum": ["markdown"],
"description": "Markdown"
},
{
"enum": ["mdx"],
"description": "MDX"
},
{
"enum": ["vue"],
"description": "Vue"
},
{
"enum": ["yaml"],
"description": "YAML"
},
{
"enum": ["html"],
"description": "HTML"
},
{
"enum": ["angular"],
"description": "Angular"
},
{
"enum": ["lwc"],
"description": "Lightning Web Components"
}
]
},
"pluginSearchDirs": {
"description": "Custom directory that contains prettier plugins in node_modules subdirectory.\nOverrides default behavior when plugins are searched relatively to the location of Prettier.\nMultiple values are accepted.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"plugins": {
"description": "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
"default": [],
"type": "array",
"items": {
"type": "string"
}
},
"printWidth": {
"description": "The line length where Prettier will try wrap.",
"default": 80,
"type": "integer"
},
"proseWrap": {
"description": "How to wrap prose.",
"default": "preserve",
"oneOf": [
{
"enum": ["always"],
"description": "Wrap prose if it exceeds the print width."
},
{
"enum": ["never"],
"description": "Do not wrap prose."
},
{
"enum": ["preserve"],
"description": "Wrap prose as-is."
}
]
},
"quoteProps": {
"description": "Change when properties in objects are quoted.",
"default": "as-needed",
"oneOf": [
{
"enum": ["as-needed"],
"description": "Only add quotes around object properties where required."
},
{
"enum": ["consistent"],
"description": "If at least one property in an object requires quotes, quote all properties."
},
{
"enum": ["preserve"],
"description": "Respect the input use of quotes in object properties."
}
]
},
"rangeEnd": {
"description": "Format code ending at a given character offset (exclusive).\nThe range will extend forwards to the end of the selected statement.\nThis option cannot be used with --cursor-offset.",
"default": null,
"type": "integer"
},
"rangeStart": {
"description": "Format code starting at a given character offset.\nThe range will extend backwards to the start of the first line containing the selected statement.\nThis option cannot be used with --cursor-offset.",
"default": 0,
"type": "integer"
},
"requirePragma": {
"description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment\nin order for it to be formatted.",
"default": false,
"type": "boolean"
},
"semi": {
"description": "Print semicolons.",
"default": true,
"type": "boolean"
},
"singleQuote": {
"description": "Use single quotes instead of double quotes.",
"default": true,
"type": "boolean"
},
"tabWidth": {
"description": "Number of spaces per indentation level.",
"default": 2,
"type": "integer"
},
"trailingComma": {
"description": "Print trailing commas wherever possible when multi-line.",
"default": "none",
"oneOf": [
{
"enum": ["none"],
"description": "No trailing commas."
},
{
"enum": ["es5"],
"description": "Trailing commas where valid in ES5 (objects, arrays, etc.)"
},
{
"enum": ["all"],
"description": "Trailing commas wherever possible (including function arguments)."
}
]
},
"useTabs": {
"description": "Indent with tabs instead of spaces.",
"default": false,
"type": "boolean"
},
"vueIndentScriptAndStyle": {
"description": "Indent script and style tags in Vue files.",
"default": false,
"type": "boolean"
}
}
},
"overridesDefinition": {
"type": "object",
"properties": {
"overrides": {
"type": "array",
"description": "Provide a list of patterns to override prettier configuration.",
"items": {
"type": "object",
"required": ["files"],
"properties": {
"files": {
"description": "Include these files in this override.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"excludeFiles": {
"description": "Exclude these files from this override.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"options": {
"type": "object",
"description": "The options to apply for this override.",
"$ref": "#/definitions/optionsDefinition"
}
},
"additionalProperties": false
}
}
}
}
},
"oneOf": [
{
"type": "object",
"allOf": [
{
"$ref": "#/definitions/optionsDefinition"
},
{
"$ref": "#/definitions/overridesDefinition"
}
]
},
{
"type": "string"
}
]
}