-
Notifications
You must be signed in to change notification settings - Fork 14
/
stylelint.config.js
95 lines (95 loc) · 2.31 KB
/
stylelint.config.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
/** @type {import("stylelint").Config} */
export default {
defaultSeverity: 'warning',
extends: [
'stylelint-config-standard',
'stylelint-config-html/vue',
'stylelint-config-recess-order',
],
plugins: ['stylelint-order', 'stylelint-less', 'stylelint-prettier'],
rules: {
// 禁止空代码
'no-empty-source': null,
// 禁止在覆盖高特异性选择器之后出现低特异性选择器
'no-descending-specificity': null,
// 不允许未知单位
'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
// 禁止小于 1 的小数有一个前导零
// "number-leading-zero": "never",
'media-query-no-invalid': null,
// 禁止空注释
'comment-no-empty': true,
// 未知的 @ 规则
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'plugin',
'apply',
'screen',
'function',
'if',
'each',
'include',
'mixin',
'extend',
'content',
'use',
],
},
],
// 空行规则
'rule-empty-line-before': [
'always',
{
ignore: ['after-comment', 'first-nested'],
},
],
'order/order': [
[
'dollar-variables',
'custom-properties',
'at-rules',
'declarations',
{
type: 'at-rule',
name: 'supports',
},
{
type: 'at-rule',
name: 'media',
},
'rules',
],
{ severity: 'warning' },
],
},
overrides: [
{
files: ['**/*.(css|html|vue)'],
customSyntax: 'postcss-html',
rules: {
// 禁止未知的伪类选择器
'selector-pseudo-class-no-unknown': [
true,
{ ignorePseudoClasses: ['deep', 'global'] },
],
// 禁止未知的伪元素选择器
'selector-pseudo-element-no-unknown': [
true,
{ ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted'] },
],
},
},
{
files: ['*.less', '**/*.less'],
customSyntax: 'postcss-less',
extends: ['stylelint-config-standard-less'],
rules: {
'less/color-no-invalid-hex': true,
'less/no-duplicate-variables': true,
},
},
],
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
};