-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.stylelintrc
executable file
·340 lines (321 loc) · 11.8 KB
/
.stylelintrc
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
/**
* 样式代码规范
* 配置文档地址: http://stylelint.io/user-guide/rules/
*/
module.exports = {
"rules": {
// at 的黑名单
// "at-rule-blacklist": [],
// at 之前必须换行
"at-rule-empty-line-before": "always",
// at 名字必须小写
"at-rule-name-case": "lower",
// at 名字后不换行
// "at-rule-name-newline-after": "always",
// at 名字后空格
"at-rule-name-space-after": "always",
// at 不能无效
"at-rule-no-unknown": true,
// at 不写第三方前缀
"at-rule-no-vendor-prefix": true,
// at 引号后必须换行
"at-rule-semicolon-newline-after": "always",
// at 白名单
// "at-rule-whitelist": [],
// 关闭符号后换新行
"block-closing-brace-newline-after": "never-single-line",
// 关闭符号前换新行
"block-closing-brace-newline-before": "always",
// 关闭符号后有空格
"block-closing-brace-space-after": "always",
// 关闭符号后有空格
"block-closing-brace-space-before": "never-single-line",
// 没有空块
"block-no-empty": true,
// 块需要换行
"block-no-single-line": true,
// 开始符号之后必须换行
"block-opening-brace-newline-after": "always",
// 开始符号之前必须换行
"block-opening-brace-newline-before": "never-single-line",
// 开始符号之后必须空格
"block-opening-brace-space-after": "never-single-line",
// 开始符号之前必须空格
"block-opening-brace-space-before": "always",
// hex用小写
"color-hex-case": "lower",
// hex用尽量短
"color-hex-length": "short",
// 禁止使用 color 样式 green == #0f0, 使用 #0f0
"color-named": "never",
// 不允许 hex
// "color-no-hex": true,
// hex 不许正确
"color-no-invalid-hex": true,
// 空备注前需要换行
"comment-empty-line-before": "always",
// 备注间需要留空格
"comment-whitespace-inside": "never",
// 不能出现的黑名单
"comment-word-blacklist": [
"style"
],
// 自定义 meida 类型命名
"custom-media-pattern": "/[a-z0-9]+(?:-[a-z0-9]+)+/",
// root 之外的选择器都不能使用自定义属性
"custom-property-no-outside-root": true,
// 自定义属性命名
"custom-property-pattern": "/[a-z0-9]+(?:-[a-z0-9]+)+/",
// !import 之后的空格
"declaration-bang-space-after": "never",
// !import 之前的空格
"declaration-bang-space-before": "always",
// 禁止重复属性
"declaration-block-no-duplicate-properties": true,
// 某些情况忽略属性可以忽略
"declaration-block-no-ignored-properties": true,
// 不允许多余重写
"declaration-block-no-shorthand-property-overrides": true,
// 属性排列方式
"declaration-block-properties-order": [],
// 分号之后必须换行
"declaration-block-semicolon-newline-after": "always",
// 分号之前必须换行
"declaration-block-semicolon-newline-before": "never-multi-line",
// 分号后必须空格
"declaration-block-semicolon-space-after": "always-single-line",
// 分号前必须空格
"declaration-block-semicolon-space-before": "never",
// 一行最多多少个属性
"declaration-block-single-line-max-declarations": 0,
// 必须写分号
"declaration-block-trailing-semicolon": "always",
// 有逗号的都必须在之后必须换行
"declaration-colon-newline-after": "always-multi-line",
// 冒号之后必须空格
"declaration-colon-space-after": "always",
// 冒号之前必须空格
"declaration-colon-space-before": "never",
// 不能使用 !important
// "declaration-no-important": true,
// 单位黑名单
"declaration-property-unit-blacklist": {},
// 单位白名单
"declaration-property-unit-whitelist": {},
// 属性值黑名单
"declaration-property-value-blacklist": {
"/^border/": ["none"],
},
// 属性值白名单
"declaration-property-value-whitelist": {},
// keyword 之外都必须用引号
"font-family-name-quotes": "always-unless-keyword",
// 字体宽度用数字
"font-weight-notation": "numeric",
// 方法黑名单
"function-blacklist": [],
// 加减乘除之间要空格
"function-calc-no-unspaced-operator": true,
// 逗号后面不能换行
"function-comma-newline-after": "always",
// 逗号前面不能换行
"function-comma-newline-before": "never-multi-line",
// 逗号后面必须空格
"function-comma-space-after": "always",
// 逗号前面不能空格
"function-comma-space-before": "never",
// 必须加上 to
"function-linear-gradient-no-nonstandard-direction": true,
// 最多空行
"function-max-empty-lines": 0,
// 名字必须小写
"function-name-case": "lower",
// 多行必须都多行
"function-parentheses-newline-inside": "always-multi-line",
// 括号内不能空格
"function-parentheses-space-inside": "never",
// 不能使用 baseurl
// "function-url-data-uris": "never",
"function-url-no-scheme-relative": true,
// url 必须引号
"function-url-quotes": "always",
// 白名单
// "function-whitelist": [],
// 方法后必须空格
"function-whitespace-after": "always",
// tab大小
"indentation": 2,
// keyframes 中不能有 !important
"keyframe-declaration-no-important": true,
// 0没有单位
"length-zero-no-unit": true,
// 最大的空行
"max-empty-lines": 2,
// 一行最长字符
"max-line-length": 60,
// 最大深度
"max-nesting-depth": 4,
// 冒号后加空格
"media-feature-colon-space-after": "always",
// 冒号前加空格
"media-feature-colon-space-before": "never",
// 不能加前缀
"media-feature-name-no-vendor-prefix": true,
// 不能缺失符号
"media-feature-no-missing-punctuation": true,
// 括号不能有空格
"media-feature-parentheses-space-inside": "never",
// 判断符号后必须空格
"media-feature-range-operator-space-after": "always",
// 判断符号前必须空格
"media-feature-range-operator-space-before": "always",
// 逗号后必须空格或换行
"media-query-list-comma-newline-after": "always",
// 逗号前不能空格或换行
"media-query-list-comma-newline-before": "never-multi-line",
// 逗号后必须空格
"media-query-list-comma-space-after": "always",
// 逗号前不能空格
"media-query-list-comma-space-before": "never",
// 不能有 hack
"no-browser-hacks": true,
// 优先级低的先排前面
"no-descending-specificity": true,
// 不能有重复选择器
"no-duplicate-selectors": true,
// 不允许空选择器
"no-empty-source": true,
// 不能有多余空格
"no-eol-whitespace": true,
// 不能有多余分号
"no-extra-semicolons": true,
// 难以分辨的颜色组合会报错
"no-indistinguishable-colors": true,
// 不能 // 注释
"no-invalid-double-slash-comments": true,
// 最后的最后要加换行
"no-missing-end-of-source-newline": true,
// 没定义的 animations 不能使用
"no-unknown-animations": true,
// 关闭 不兼容特性不能使用 https://github.com/ai/browserslist
// "no-unsupported-browser-features": true,
// 小数点钱的0去掉
"number-leading-zero": "always",
// 小数点不能小与2位
"number-max-precision": 2,
// 去除多余0
"number-no-trailing-zeros": true,
// 属性黑名单
"property-blacklist": [],
// 属性不许小写
"property-case": "lower",
// 不允许未知属性
"property-no-unknown": true,
// 属性不能加前缀
"property-no-vendor-prefix": true,
// 属性白名单
// "property-whitelist": [],
// root 无常规属性
// "root-no-standard-properties": true,
// 内嵌块为空, 不换行
"rule-nested-empty-line-before": "always-multi-line",
// 块为空, 不换行
"rule-non-nested-empty-line-before": "always",
// 属性选择器不能有空格
"selector-attribute-brackets-space-inside": "always",
// 属性选择器操作符黑名单
// "selector-attribute-operator-blacklist": [],
// 属性选择器操作符后空格
"selector-attribute-operator-space-after": "never",
// 属性选择器操作符前空格
"selector-attribute-operator-space-before": "never",
// 属性选择器操作符白名单
// "selector-attribute-operator-whitelist": [],
// 属性选择器必须用引号
"selector-attribute-quotes": "always",
// 类选择器命名规范
"selector-class-pattern": "/[a-z0-9]+(?:-[a-z0-9]+)+/",
// 链接选择器操作符后面必须加空格
"selector-combinator-space-after": "always",
// 链接选择器操作符前面必须加空格
"selector-combinator-space-before": "always",
// ID 选择器规范
"selector-id-pattern": "/[a-z0-9]+(?:-[a-z0-9]+)+/",
// 选择器逗号后面必须换行
"selector-list-comma-newline-after": "always",
// 选择器逗号前面必须换行
"selector-list-comma-newline-before": "never-multi-line",
// 选择器逗号后面必须空格
"selector-list-comma-space-after": "always",
// 选择器逗号前面必须空格
"selector-list-comma-space-before": "never",
// 选择器最多空行
"selector-max-empty-lines": 0,
// 选择器后最大深度
"selector-max-compound-selectors": 4,
// 层数与深度
"selector-max-specificity": "2,4,4",
// 关闭 不能用属性选择器
// "selector-no-attribute": true,
// 不明觉厉
// "selector-no-combinator": true,
// 不能使用ID选择器
"selector-no-id": true,
// 当有选择器的时候不能使用元素选择器
"selector-no-qualifying-type": true,
// 关闭 不能使用元素选择器
// "selector-no-type": true,
// 不能使用 * 选择器
"selector-no-universal": true,
// 不能使用前缀选择器
"selector-no-vendor-prefix": true,
// 伪元素选择器必须小写
"selector-pseudo-class-case": "lower",
// 不能使用不知名伪元素选择器
"selector-pseudo-class-no-unknown": true,
// 伪选择器括号不能有空格
"selector-pseudo-class-parentheses-space-inside": "never",
// 必须小写
"selector-pseudo-element-case": "lower",
// 伪元素选择器用单个冒号
"selector-pseudo-element-colon-notation": "double",
// 不能使用不知名选择器
"selector-pseudo-element-no-unknown": true,
// root 选择器必须单个定义
"selector-root-no-composition": true,
// 必须小写
"selector-type-case": "lower",
// 不能使用未知类型选择器
"selector-type-no-unknown": true,
// 尽可能压缩属性值
"shorthand-property-no-redundant-values": true,
// 字符串不能换行
"string-no-newline": true,
// 字符串使用单引号
"string-quotes": "double",
// 可以备注强制使用某冲突的规范, 必须带上原因
"stylelint-disable-reason": "always-before",
// 能省则省3
"time-no-imperceptible": true,
// 单位黑名单
"unit-blacklist": [],
// 单位小写
"unit-case": "lower",
// 不能出现未知单位
"unit-no-unknown": true,
// 单位白名单
// "unit-whitelist": [],
// 小写
"value-keyword-case": "lower",
// 属性值列表逗号后面必须换行
"value-list-comma-newline-after": "always",
// 属性值列表逗号前面必须换行
"value-list-comma-newline-before": "never-multi-line",
// 属性值列表逗号后面必须空格
"value-list-comma-space-after": "always",
// 属性值列表逗号前面必须空格
"value-list-comma-space-before": "never",
// 属性值不能加前缀
"value-no-vendor-prefix": true
}
}