-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.stylelintrc.js
134 lines (116 loc) · 4 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
module.exports = {
defaultSeverity: 'error',
extends: ['stylelint-config-standard', 'stylelint-config-prettier'],
plugins: ['stylelint-scss'],
rules: {
indentation: [2],
'selector-type-no-unknown': [
true,
{
ignoreTypes: ['page', 'checkbox', 'scroll-view'],
},
],
'selector-no-qualifying-type': null,
// 不要使用已被 autoprefixer 支持的浏览器前缀
'media-feature-name-no-vendor-prefix': true,
'at-rule-no-vendor-prefix': true,
'selector-no-vendor-prefix': true,
'property-no-vendor-prefix': true,
'comment-empty-line-before': null,
'function-name-case': [
'lower',
{
ignoreFunctions: ['/colorPalette/'],
},
],
'no-invalid-double-slash-comments': null,
'no-descending-specificity': null,
'declaration-empty-line-before': null,
'unit-no-unknown': [
true,
{
ignoreUnits: ['upx', 'rpx'],
},
],
// SASS
// All @includes after properties
// Nested selectors after properties
// Variables dash-dashed
// This regexp matches:
// $button-text-background-color--hover-hola
// regex under construction
// 'scss/dollar-variable-pattern': '\b[a-z]+(?:-)+(\b[a-z]+(?:-))*',
// forbid extend
// 'at-rule-blacklist': ['extend'],
'at-rule-disallowed-list': ['extend'],
// Nesting depth
'max-nesting-depth': 3,
/* ==========================================================================
Best practices
========================================================================== */
// Specificity
// https://gist.github.com/angelzou/dbd70b78242043f4d479f2a15fc0b341
// To learn more about this:
// http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/
// "id,class,type",
// selector-max-specificity
// 'declaration-no-important': true,
'selector-max-compound-selectors': 3,
'selector-no-qualifying-type': true,
// Selectors
'no-duplicate-selectors': true,
// Blocks
'block-no-empty': true,
// 每个样式规则前后都有空行,除了第一条规则与规则前有注释
'at-rule-empty-line-before': null,
// More styling rules for more consistency
'at-rule-name-case': 'lower',
// Colors
'color-hex-case': 'lower',
'color-hex-length': 'short',
'color-no-invalid-hex': true,
//Font//字体家族的
'font-family-no-duplicate-names':true,
"font-family-no-missing-generic-family-keyword": true,
// strings
'string-quotes': 'single',
'selector-pseudo-element-colon-notation': 'single',
// Values
// Disallow vendor prefix, they are added by autoprefixer
'value-no-vendor-prefix': true,
'value-list-comma-space-after': 'always-single-line',
// Disallows margin: 1px 1px 1px 1px;
'shorthand-property-no-redundant-values': true,
'function-comma-space-before': 'never',
// Numbers
// 属性值 0 后面不加单位
'length-zero-no-unit': true,
'number-no-trailing-zeros': true,
// 每个属性声明末尾都要加分号
'declaration-block-trailing-semicolon': 'always',
// Declaration blocks//重复申明的
// 'declaration-block-no-duplicate-properties': false,
// Prevents adding unnecesary Specificity or complicated sass stuff
'scss/selector-no-redundant-nesting-selector': true,
// 空格
// 注释 "/*" 后和 "*/" 前必须有空格
'comment-whitespace-inside': 'always',
// 属性名 ":" 后必须有空格
'declaration-colon-space-after': 'always',
// 属性名 ":" 前不能有空格
'declaration-colon-space-before': 'never',
// 声明属性末尾 ";" 前不能有空格
'declaration-block-semicolon-space-before': 'never',
// 属性值中的 "," 后必须有空格
'function-comma-space-after': 'always',
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': true,
'value-keyword-case': [
'lower',
{
ignoreKeywords: ['/--qui-/'],
},
],
'no-empty-source':null,
},
};