-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
common.ts
225 lines (216 loc) · 5.25 KB
/
common.ts
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
import type { ChoiceSupportOption, IntSupportOption } from 'prettier';
import { CATEGORY_PUG } from './constants';
/** Pug print width option. */
export const PUG_PRINT_WIDTH_OPTION: IntSupportOption = {
// since: '1.6.0',
category: CATEGORY_PUG,
type: 'int',
default: -1,
description: 'The line length where Prettier will try wrap.',
range: { start: -1, end: Number.POSITIVE_INFINITY, step: 1 },
};
/** Pug single quote option. */
export const PUG_SINGLE_QUOTE_OPTION: ChoiceSupportOption<
boolean | 'true' | null
> = {
// since: '1.6.0',
category: CATEGORY_PUG,
type: 'choice',
default: null,
description: '',
choices: [
{
value: null,
description: 'Use `singleQuote` value.',
},
{
value: true,
description: 'Use single quotes instead of double quotes.',
},
{
// Workaround, because prettier doesn't accept just `true` as choice value in CLI
value: 'true',
description: 'Use single quotes instead of double quotes.',
},
{
value: false,
description: 'Use double quotes instead of double quotes.',
},
],
};
/** Pug tab width option. */
export const PUG_TAB_WIDTH_OPTION: IntSupportOption = {
// since: '1.6.0',
category: CATEGORY_PUG,
type: 'int',
default: -1,
description: 'Number of spaces per indentation level.',
range: { start: -1, end: Number.POSITIVE_INFINITY, step: 1 },
};
/** Pug use tabs option. */
export const PUG_USE_TABS_OPTION: ChoiceSupportOption<boolean | 'true' | null> =
{
// since: '1.6.0',
category: CATEGORY_PUG,
type: 'choice',
default: null,
description: '',
choices: [
{
value: null,
description: 'Use `useTabs` value.',
},
{
value: true,
description: 'Indent with tabs instead of spaces.',
},
{
// Workaround, because prettier doesn't accept just `true` as choice value in CLI
value: 'true',
description: 'Indent with tabs instead of spaces.',
},
{
value: false,
description: 'Indent with spaces instead of tabs.',
},
],
};
/** Pug bracket spacing option. */
export const PUG_BRACKET_SPACING_OPTION: ChoiceSupportOption<
boolean | 'true' | null
> = {
// since: '1.6.0',
category: CATEGORY_PUG,
type: 'choice',
default: null,
description: '',
choices: [
{
value: null,
description: 'Use `bracketSpacing` value.',
},
{
value: true,
description: 'Print spaces between brackets.',
},
{
// Workaround, because prettier doesn't accept just `true` as choice value in CLI
value: 'true',
description: 'Print spaces between brackets.',
},
{
value: false,
description: 'Do not print spaces between brackets.',
},
],
};
/** Pug semi option. */
export const PUG_SEMI_OPTION: ChoiceSupportOption<boolean | 'true' | null> = {
// since: '1.6.0',
category: CATEGORY_PUG,
type: 'choice',
default: null,
description: '',
choices: [
{
value: null,
description: 'Use `bracketSpacing` value.',
},
{
value: true,
description: 'Print semicolons.',
},
{
// Workaround, because prettier doesn't accept just `true` as choice value in CLI
value: 'true',
description: 'Print semicolons.',
},
{
value: false,
description:
'Do not print semicolons, except at the beginning of lines which may need them.',
},
],
};
/** Pug arrow parens option. */
export const PUG_ARROW_PARENS_OPTION: ChoiceSupportOption<ArrowParens | null> =
{
// since: '1.7.0',
category: CATEGORY_PUG,
type: 'choice',
default: null,
description: 'Include parentheses around a sole arrow function parameter.',
choices: [
{
value: null,
description: 'Use `arrowParens` value.',
},
{
value: 'always',
description: 'Always add parens. Example: `(x) => x`',
},
{
value: 'avoid',
description: 'Omit parens when possible. Example: `x => x`',
},
],
};
/** Arrow parens. */
export type ArrowParens = 'avoid' | 'always';
/** Pug bracket same line option. */
export const PUG_BRACKET_SAME_LINE_OPTION: ChoiceSupportOption<
boolean | 'true' | null
> = {
// since: '1.17.0',
category: CATEGORY_PUG,
type: 'choice',
default: null,
description: 'Determines position of closing bracket which wraps attributes.',
choices: [
{
value: null,
description: 'Use `bracketSameLine` value.',
},
{
value: true,
description: `
Closing bracket remains with last attribute's line.
Example:
input(
type='text',
value='my_value',
name='my_name',
alt='my_alt',
autocomplete='on')
`,
},
{
// Workaround, because prettier doesn't accept just `true` as choice value in CLI
value: 'true',
description: `
Closing bracket remains with last attribute's line.
Example:
input(
type='text',
value='my_value',
name='my_name',
alt='my_alt',
autocomplete='on')
`,
},
{
value: false,
description: `
Closing bracket ends with a new line.
Example:
input(
type='text',
value='my_value',
name='my_name',
alt='my_alt',
autocomplete='on'
)
`,
},
],
};