-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.stylelintrc.cjs
More file actions
216 lines (216 loc) · 5.49 KB
/
.stylelintrc.cjs
File metadata and controls
216 lines (216 loc) · 5.49 KB
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
// .stylelintrc.cjs
module.exports = {
extends: [
'stylelint-config-standard', // 标准规则
'stylelint-config-standard-vue', // Vue 适配
],
plugins: [
'stylelint-order', // CSS 属性排序插件
],
overrides: [
{
files: ['**/*.vue'],
customSyntax: 'postcss-html', // 解析 HTML/Vue 中的 <style>
},
{
files: ['**/*.css'],
customSyntax: 'postcss-less', // 支持 Less 语法
},
],
ignoreFiles: ['node_modules/**/*', 'dist/**/*', '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
rules: {
'no-empty-source': null, // 允许空样式文件
'selector-class-pattern': null, // 不强制类名模式 (如 BEM)
'selector-pseudo-element-no-unknown': [
true,
{
// 允许 Vue 的深度选择器
ignorePseudoElements: ['v-deep', 'deep', 'global'],
},
],
'property-no-vendor-prefix': null, // 允许浏览器前缀
'value-no-vendor-prefix': null,
'color-function-notation': 'modern', // 使用 rgb(0 0 0) 现代语法
'alpha-value-notation': 'number', // 使用 rgba(0 0 0 / 0.5) 现代语法
'function-no-unknown': [
true,
{
// 允许未知函数 (可能用于 CSS-in-JS 变量等)
ignoreFunctions: ['theme'], // 示例:忽略 theme() 函数
},
],
// CSS 属性排序规则 (一个推荐顺序,可自定义)
'order/properties-order': [
[
// 定位与布局
'position',
'z-index',
'top',
'right',
'bottom',
'left',
'display',
'visibility',
'float',
'clear',
'overflow',
'overflow-x',
'overflow-y',
'clip',
'zoom',
// Flexbox
'flex',
'flex-grow',
'flex-shrink',
'flex-basis',
'flex-flow',
'flex-direction',
'flex-wrap',
'justify-content',
'align-content',
'align-items',
'align-self',
'order',
// 盒模型
'box-sizing',
'width',
'min-width',
'max-width',
'height',
'min-height',
'max-height',
'margin',
'margin-top',
'margin-right',
'margin-bottom',
'margin-left',
'padding',
'padding-top',
'padding-right',
'padding-bottom',
'padding-left',
// 边框与轮廓
'border',
'border-width',
'border-style',
'border-color',
'border-radius',
'border-top',
'border-top-width',
'border-top-style',
'border-top-color',
'border-right',
'border-right-width',
'border-right-style',
'border-right-color',
'border-bottom',
'border-bottom-width',
'border-bottom-style',
'border-bottom-color',
'border-left',
'border-left-width',
'border-left-style',
'border-left-color',
'border-image',
'border-image-source',
'border-image-slice',
'border-image-width',
'border-image-outset',
'border-image-repeat',
'outline',
'outline-width',
'outline-style',
'outline-color',
'outline-offset',
// 背景
'background',
'background-color',
'background-image',
'background-repeat',
'background-attachment',
'background-position',
'background-position-x',
'background-position-y',
'background-clip',
'background-origin',
'background-size',
// 颜色与字体
'color',
'font',
'font-family',
'font-size',
'font-weight',
'font-style',
'font-variant',
'font-size-adjust',
'font-stretch',
'font-effect',
'font-emphasize',
'font-emphasize-position',
'font-emphasize-style',
'line-height',
// 文本
'text-align',
'text-align-last',
'vertical-align',
'text-decoration',
'text-emphasis',
'text-emphasis-color',
'text-emphasis-style',
'text-emphasis-position',
'text-indent',
'text-justify',
'text-outline',
'text-transform',
'text-wrap',
'text-overflow',
'text-overflow-ellipsis',
'text-overflow-mode',
'text-shadow',
'white-space',
'word-spacing',
'letter-spacing',
// 列表
'list-style',
'list-style-position',
'list-style-type',
'list-style-image',
// 表格
'table-layout',
'border-collapse',
'border-spacing',
'caption-side',
'empty-cells',
// 动画与过渡
'transition',
'transition-delay',
'transition-timing-function',
'transition-duration',
'transition-property',
'animation',
'animation-name',
'animation-duration',
'animation-play-state',
'animation-timing-function',
'animation-delay',
'animation-iteration-count',
'animation-direction',
// 其他
'opacity',
'filter',
'transform',
'transform-origin',
'cursor',
'pointer-events',
'user-select',
'content',
'quotes',
'counter-reset',
'counter-increment',
'resize',
'will-change',
],
{ unspecified: 'bottom' }, // 未指定的属性放在底部
],
},
};