-
Notifications
You must be signed in to change notification settings - Fork 0
/
stylelint.config.js
78 lines (78 loc) · 2.54 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
module.exports = {
root: true,
defaultSeverity: 'error',
plugins: ['stylelint-order', 'stylelint-less'],
extends: [
'stylelint-config-standard', // the standard shareable config for Stylelint
'stylelint-config-html/html', // the shareable html config for Stylelint.
'stylelint-config-html/vue', // the shareable vue config for Stylelint.
'stylelint-config-recess-order', // use the clean order for properties
'stylelint-config-prettier', // turn off any rules that conflict with Prettier
],
rules: {
// 禁止在覆盖高特异性选择器之后出现低特异性选择器
'no-descending-specificity': null,
// 禁止空源码
'no-empty-source': null,
// 禁止字体族中缺少泛型族关键字
'font-family-no-missing-generic-family-keyword': null,
// 禁止未知的@规则
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'variants',
'responsive',
'screen',
'function',
'if',
'each',
'include',
'mixin',
],
},
],
// 不允许未知函数
'function-no-unknown': null,
// 不允许未知单位
'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
// 不允许选择器使用供应商前缀
'selector-no-vendor-prefix': null,
// 指定关键帧名称的模式
'keyframes-name-pattern': null,
// 指定类选择器的模式
'selector-class-pattern': null,
// 不允许值使用供应商前缀
'value-no-vendor-prefix': null,
// 要求或禁止在规则之前的空行
'rule-empty-line-before': ['always', { ignore: ['after-comment', 'first-nested'] }],
// 指定字符串使用单引号
'string-quotes': 'single',
// 指定@规则名的大小写
'at-rule-name-case': 'lower',
// 指定缩进
indentation: [2, { severity: 'warning' }],
},
overrides: [
{
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
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',
rules: {
'less/color-no-invalid-hex': true,
'less/no-duplicate-variables': true,
},
},
],
};