-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.stylelintrc.js
159 lines (159 loc) · 4.76 KB
/
.stylelintrc.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
module.exports = {
extends: [
// stylelint的推荐基础配置
'stylelint-config-standard',
// 支持css-module
'stylelint-config-css-modules',
// 关闭和格式化风格冲突的规则
'stylelint-config-prettier'
],
plugins: ['stylelint-order'], // 指定css属性的排列顺序
/*
stylelint规则
https://stylelint.docschina.org/user-guide/rules/
*/
rules: {
// 关闭对calc写法的校验
/*
class 类名的风格
短横线命名(kebab-case): ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$
小驼峰命名(lowerCamelCase): ^[a-z][a-zA-Z0-9]+$
蛇形命名(snake_case): ^([a-z][a-z0-9]*)(_[a-z0-9]+)*$
大驼峰命名(UpperCamelCase): ^[A-Z][a-zA-Z0-9]+$
*/
// 小驼峰
'selector-class-pattern': [
// 支持短横线命名 或者 小驼峰命名
'(^[a-z][a-zA-Z0-9]+$)|(^([a-z][a-z0-9]*)(-[a-z0-9]+)*$)',
{
message: 'Naming problem'
}
],
// 兼容rgba写法
'color-function-notation': 'legacy',
// 颜色指定大写
'color-hex-case': null,
// 禁止空块
'block-no-empty': true,
// 颜色6位长度
'color-hex-length': 'long',
// 兼容自定义标签名
'selector-type-no-unknown': [
true,
{
ignoreTypes: []
}
],
// 忽略伪元素选择器 ::v-deep
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep']
}
],
// 忽略禁止未知的伪类选择器。:global
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global']
}
],
// 禁止低优先级的选择器出现在高优先级的选择器之后。
'no-descending-specificity': null,
// 禁止声明重复的属性
'declaration-block-no-duplicate-properties': true,
// 不验证@未知的名字,为了兼容scss的函数
'at-rule-no-unknown': null,
// 禁止空注释
'comment-no-empty': true,
// 禁止简写属性的冗余值
'shorthand-property-no-redundant-values': true,
// 禁止值的浏览器引擎前缀
'value-no-vendor-prefix': true,
// property-no-vendor-prefix
'property-no-vendor-prefix': true,
// 禁止小于 1 的小数有一个前导零
'number-leading-zero': null,
// 禁止空第一行
'no-empty-first-line': null,
// 属性的排序
'order/properties-order': [
'position',
'top',
'right',
'bottom',
'left',
'z-index',
'display',
'justify-content',
'align-items',
'float',
'clear',
'overflow',
'overflow-x',
'overflow-y',
'margin',
'margin-top',
'margin-right',
'margin-bottom',
'margin-left',
'border',
'border-style',
'border-width',
'border-color',
'border-top',
'border-top-style',
'border-top-width',
'border-top-color',
'border-right',
'border-right-style',
'border-right-width',
'border-right-color',
'border-bottom',
'border-bottom-style',
'border-bottom-width',
'border-bottom-color',
'border-left',
'border-left-style',
'border-left-width',
'border-left-color',
'border-radius',
'padding',
'padding-top',
'padding-right',
'padding-bottom',
'padding-left',
'width',
'min-width',
'max-width',
'height',
'min-height',
'max-height',
'font-size',
'font-family',
'font-weight',
'text-align',
'text-justify',
'text-indent',
'text-overflow',
'text-decoration',
'white-space',
'color',
'background',
'background-position',
'background-repeat',
'background-size',
'background-color',
'background-clip',
'opacity',
'filter',
'list-style',
'outline',
'visibility',
'box-shadow',
'text-shadow',
'resize',
'transition'
]
}
}