-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.prettierrc.json5
83 lines (69 loc) · 1.52 KB
/
.prettierrc.json5
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
{
// 换行符 \r\n
endOfLine: "crlf",
// 每行最大字符数
printWidth: 120,
// 使用 tab 缩进
useTabs: true,
// tab 长度
tabWidth: 4,
// 分号
semi: true,
// 属性引号 (按需)
quoteProps: "as-needed",
// 重写默认配置
overrides: [
{
// 所有 js 文件, html 和 md 中的 js
files: "*.{js,html,md,ts}",
options: {
// 在对象前后括号加空格 { foo: bar }
bracketSpacing: true,
// 单引号
singleQuote: true,
// 箭头函数参数带小括号 (x) => x * x
arrowParens: "always",
// 对象最后一个属性后是否加逗号
trailingComma: "es5",
},
},
{
// 所有 php 文件
files: "*.php",
options: {
parser: "php",
// php 版本
phpVersion: "8.1",
// php 尾部逗号, 走默认配置, 默认为 true, 即保留尾部逗号
// trailingCommaPHP: false,
// PHP, 纯字符串使用单引号,模版字符串使用双引号
singleQuote: true,
},
},
{
// 所有 xml 文件 --> 使用 XML Tools 插件格式化
files: "*.xml",
options: {
parser: "xml",
// 行首缩进, 由于 xml 语法的特殊性, 空格或tab缩进可能会导致解析错误
xmlWhitespaceSensitivity: "ignore",
// 在自闭合标签后加空格 <br />
xmlSelfClosingSpace: true,
},
},
{
// 所有 sh 文件
files: "*.sh",
options: {
parser: "sh",
},
},
{
files: "*.json5",
options: {
// 对象最后一个属性后是否加逗号
trailingComma: "es5",
},
},
],
}