-
Notifications
You must be signed in to change notification settings - Fork 22
/
options.js
251 lines (248 loc) · 7.81 KB
/
options.js
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
"use strict";
const commonOptions = require("../common/common-options");
const CATEGORY_JAVASCRIPT = "JavaScript";
// format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
module.exports = {
arrowParens: {
since: "1.9.0",
category: CATEGORY_JAVASCRIPT,
type: "choice",
default: [
{ since: "1.9.0", value: "avoid" },
{ since: "2.0.0", value: "always" },
],
description: "Include parentheses around a sole arrow function parameter.",
choices: [
{
value: "always",
description: "Always include parens. Example: `(x) => x`",
},
{
value: "avoid",
description: "Omit parens when possible. Example: `x => x`",
},
],
},
// [prettierx ...]
arrayBracketSpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces between array brackets (similar to the corresponding eslint option). Status: experimental, with limited testing.",
},
computedPropertySpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces between computed property brackets (similar to the corresponding eslint option). Status: experimental, with limited testing.",
},
indentChains: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: true,
description: "Put indents at the start of chained calls.",
oppositeDescription: "Disable indents at the start of chained calls.",
},
importFormatting: {
category: CATEGORY_JAVASCRIPT,
type: "choice",
default: "auto",
description:
"Formatting of import statements, may be `oneline` to avoid conflict with" +
' VSCode "Organize Imports" feature.',
choices: [
{
value: "auto",
description: "automatic formatting, like Prettier",
},
{
value: "oneline",
description: "keep import statements on one line",
},
],
},
spaceInParens: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
'Print spaces in between parens, WordPress style (similar to the corresponding eslint option). Not recommended in combination with the default `arrowParens: "always"` option. Status: experimental, with limited testing.',
},
spaceUnaryOps: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces after unary operator symbols, except in the middle of `!!` (similar to the corresponding eslint option). Status: experimental, with limited testing.",
},
templateCurlySpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces between template curly brackets (similar to the corresponding eslint option). Status: experimental, with limited testing.",
},
typeAngleBracketSpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces between type angle brackets. Status: experimental, with limited testing.",
},
typeBracketSpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Print spaces between type brackets. Status: experimental, with limited testing.",
},
exportCurlySpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: true,
description: "Put spaces between export curly braces.",
oppositeDescription: "Disable spaces between export curly braces.",
},
importCurlySpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: true,
description: "Put spaces between import curly braces.",
oppositeDescription: "Disable spaces between import curly braces.",
},
objectCurlySpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: true,
description:
"Put spaces between object curly braces (similar to the corresponding eslint option).",
oppositeDescription: "Disable spaces between object curly braces.",
},
typeCurlySpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: true,
description: "Put spaces between type curly braces.",
oppositeDescription: "Disable spaces between type curly braces.",
},
jsxBracketSameLine: {
since: "0.17.0",
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description: "Put > on the last line instead of at a new line.",
},
semi: {
since: "1.0.0",
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: true,
description: "Print semicolons.",
oppositeDescription:
"Do not print semicolons, except at the beginning of lines which may need them.",
},
// [prettierx ...]
alignObjectProperties: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description: "Align colons in multiline object literals.",
},
offsetTernaryExpressions: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
'Indent and align ternary expression branches more consistently with "Standard JS" (similar to the corresponding eslint option).',
},
generatorStarSpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces around the star (`*`) in generator functions (before and after - similar to the corresponding eslint option). (Default is after only.)",
},
yieldStarSpacing: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put spaces around the star (`*`) in `yield*` expressions (before and after - similar to the corresponding eslint option). (Default is after only.)",
},
spaceBeforeFunctionParen: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Put a space before function parenthesis in all declarations (similar to the corresponding eslint option). (Default is to put a space before function parenthesis for untyped anonymous functions only.)",
},
breakBeforeElse: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description: "Always add a line break before else.",
},
breakLongMethodChains: {
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description:
"Break method chains with more than 3 method calls, like Prettier 1.x.",
},
singleQuote: commonOptions.singleQuote,
jsxSingleQuote: {
since: "1.15.0",
category: CATEGORY_JAVASCRIPT,
type: "boolean",
default: false,
description: "Use single quotes in JSX.",
},
quoteProps: {
since: "1.17.0",
category: CATEGORY_JAVASCRIPT,
type: "choice",
default: "as-needed",
description: "Change when properties in objects are quoted.",
choices: [
{
value: "as-needed",
description: "Only add quotes around object properties where required.",
},
{
value: "consistent",
description:
"If at least one property in an object requires quotes, quote all properties.",
},
{
value: "preserve",
description: "Respect the input use of quotes in object properties.",
},
],
},
trailingComma: {
since: "0.0.0",
category: CATEGORY_JAVASCRIPT,
type: "choice",
default: [
{ since: "0.0.0", value: false },
{ since: "0.19.0", value: "none" },
{ since: "2.0.0", value: "es5" },
],
description: "Print trailing commas wherever possible when multi-line.",
choices: [
{
value: "es5",
description:
"Trailing commas where valid in ES5 (objects, arrays, etc.)",
},
{ value: "none", description: "No trailing commas." },
{
value: "all",
description:
"Trailing commas wherever possible (including function arguments).",
},
],
},
};