-
Notifications
You must be signed in to change notification settings - Fork 10
/
stylelint.config.js
225 lines (179 loc) · 9.37 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
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
217
218
219
220
221
222
223
224
225
// https://stylelint.io/user-guide/rules/
module.exports = {
// Default <stylelint-processor-html> sometimes shows wrong number of the line
// that has an error, so we use this add-on
processors: '@mapbox/stylelint-processor-arbitrary-tags',
plugins: [
'stylelint-scss',
'stylelint-declaration-strict-value',
],
// css also is a valid scss so we don't need to use both - scss is enough
syntax: 'scss',
rules: {
'color-no-invalid-hex': [true, { severity: 'warning' }],
'font-family-no-duplicate-names': [true, { severity: 'warning' }],
'font-family-no-missing-generic-family-keyword': [true, { severity: 'warning' }],
'function-calc-no-unspaced-operator': [true, { severity: 'warning' }],
'function-linear-gradient-no-nonstandard-direction': [true, { severity: 'warning' }],
'string-no-newline': [true, { severity: 'warning' }],
'unit-no-unknown': [true, { severity: 'warning' }],
'property-no-unknown': [true, {
severity: 'warning',
checkPrefixed: true,
}],
'keyframe-declaration-no-important': [true, { severity: 'warning' }],
'declaration-block-no-duplicate-properties': [true, { severity: 'warning' }],
'declaration-block-no-shorthand-property-overrides': [true, { severity: 'warning' }],
'block-no-empty': [true, { severity: 'warning' }],
'selector-pseudo-class-no-unknown': [true, { severity: 'warning' }],
'selector-pseudo-element-no-unknown': [true, { severity: 'warning' }],
'selector-type-no-unknown': [true, { severity: 'warning' }],
'media-feature-name-no-unknown': [true, { severity: 'warning' }],
'comment-no-empty': [true, { severity: 'warning' }],
'no-duplicate-at-import-rules': [true, { severity: 'warning' }],
'no-duplicate-selectors': [true, { severity: 'warning' }],
'no-extra-semicolons': [true, { severity: 'warning' }],
'no-descending-specificity': [true, { severity: 'warning' }],
'number-max-precision': [6, { severity: 'warning' }],
'time-min-milliseconds': [100, { severity: 'warning' }],
'unit-blacklist': [['px', 'cm', 'mm', 'pt', 'in', 'pc'], {
severity: 'warning',
/**
* it's not working with '["px", "dpi"]' syntax as in example in the docs
* so we need to use this hack with regex.
*/
ignoreMediaFeatureNames: {
'px': [/a-zA-Z0-9/],
'dpi': [/a-zA-Z0-9/],
},
/**
* allow to use 'px' and 'dpi' in variables that has prefix 'media-'
*
* we need to use "." (dot) at the beginning of the regex to prevent
* handle variables values because linter doesn't read '$' value in the
* "/^\$media-/" regex, so we try not to match the first character
*/
ignoreProperties: {
'px': ['/^.media-/'],
'dpi': ['/^.media-/'],
},
}],
'shorthand-property-no-redundant-values': [true, { severity: 'warning' }],
'value-no-vendor-prefix': [true, { severity: 'warning' }],
'property-no-vendor-prefix': [true, { severity: 'warning' }],
'declaration-block-no-redundant-longhand-properties': [true, { severity: 'warning' }],
'declaration-no-important': [true, { severity: 'warning' }],
'declaration-block-single-line-max-declarations': [1, { severity: 'warning' }],
'selector-max-empty-lines': [0, { severity: 'warning' }],
'at-rule-no-vendor-prefix': [true, { severity: 'warning' }],
'no-unknown-animations': [true, { severity: 'warning' }],
'color-hex-case': ['lower', { severity: 'warning' }],
'color-hex-length': ['long', { severity: 'warning' }],
'font-family-name-quotes': ['always-unless-keyword', { severity: 'warning' }],
'font-weight-notation': ['numeric', { severity: 'warning' }],
'function-comma-newline-after': ['always-multi-line', { severity: 'warning' }],
'function-comma-newline-before': ['never-multi-line', { severity: 'warning' }],
'function-comma-space-after': ['always-single-line', { severity: 'warning' }],
'function-comma-space-before': ['never', { severity: 'warning' }],
'function-max-empty-lines': [0, { severity: 'warning' }],
'function-name-case': ['lower', { severity: 'warning' }],
'function-parentheses-newline-inside': ['always-multi-line', { severity: 'warning' }],
'function-parentheses-space-inside': ['never-single-line', { severity: 'warning' }],
'function-url-quotes': ['always', { severity: 'warning' }],
'function-whitespace-after': ['always', { severity: 'warning' }],
'number-leading-zero': ['always', { severity: 'warning' }],
'number-no-trailing-zeros': [true, { severity: 'warning' }],
'string-quotes': ['single', { severity: 'warning' }],
'length-zero-no-unit': [true, { severity: 'warning' }],
'unit-case': ['lower', { severity: 'warning' }],
'value-keyword-case': ['lower', { severity: 'warning' }],
'value-list-comma-space-after': ['always-single-line', { severity: 'warning' }],
'value-list-comma-space-before': ['never', { severity: 'warning' }],
'value-list-max-empty-lines': [0, { severity: 'warning' }],
'property-case': ['lower', { severity: 'warning' }],
'declaration-bang-space-after': ['never', { severity: 'warning' }],
'declaration-bang-space-before': ['always', { severity: 'warning' }],
'declaration-colon-space-after': ['always-single-line', { severity: 'warning' }],
'declaration-colon-space-before': ['never', { severity: 'warning' }],
'declaration-block-semicolon-newline-after': ['always-multi-line', { severity: 'warning' }],
'declaration-block-semicolon-space-after': ['always-single-line', { severity: 'warning' }],
'declaration-block-trailing-semicolon': ['always', { severity: 'warning' }],
'block-closing-brace-empty-line-before': ['never', { severity: 'warning' }],
'block-closing-brace-newline-after': ['always', { severity: 'warning' }],
'block-closing-brace-space-before': ['always-single-line', { severity: 'warning' }],
'block-opening-brace-newline-after': ['always-multi-line', { severity: 'warning' }],
'block-opening-brace-space-after': ['always-single-line', { severity: 'warning' }],
'block-opening-brace-space-before': ['always', { severity: 'warning' }],
'selector-attribute-brackets-space-inside': ['never', { severity: 'warning' }],
'selector-attribute-operator-space-after': ['never', { severity: 'warning' }],
'selector-attribute-operator-space-before': ['never', { severity: 'warning' }],
'selector-attribute-quotes': ['always', { severity: 'warning' }],
'selector-combinator-space-after': ['always', { severity: 'warning' }],
'selector-combinator-space-before': ['always', { severity: 'warning' }],
'selector-pseudo-class-case': ['lower', { severity: 'warning' }],
'selector-pseudo-class-parentheses-space-inside': ['never', { severity: 'warning' }],
'selector-pseudo-element-case': ['lower', { severity: 'warning' }],
'selector-pseudo-element-colon-notation': ['single', { severity: 'warning' }],
'selector-type-case': ['lower', { severity: 'warning' }],
'selector-list-comma-newline-after': ['always', { severity: 'warning' }],
'selector-list-comma-space-after': ['always-single-line', { severity: 'warning' }],
'selector-list-comma-space-before': ['never', { severity: 'warning' }],
'rule-empty-line-before': ['always-multi-line', {
severity: 'warning',
ignore: ['after-comment', 'first-nested'],
}],
'media-feature-colon-space-after': ['always', { severity: 'warning' }],
'media-feature-colon-space-before': ['never', { severity: 'warning' }],
'media-feature-name-case': ['lower', { severity: 'warning' }],
'media-feature-parentheses-space-inside': ['never', { severity: 'warning' }],
'media-feature-range-operator-space-after': ['always', { severity: 'warning' }],
'media-feature-range-operator-space-before': ['always', { severity: 'warning' }],
'media-query-list-comma-newline-after': ['always-multi-line', { severity: 'warning' }],
'media-query-list-comma-space-after': ['always-single-line', { severity: 'warning' }],
'at-rule-empty-line-before': ['always', {
severity: 'warning',
except: ['after-same-name', 'blockless-after-same-name-blockless', 'first-nested'],
ignore: ['after-comment', 'first-nested'],
}],
'at-rule-name-case': ['lower', { severity: 'warning' }],
'at-rule-name-space-after': ['always', { severity: 'warning' }],
'at-rule-semicolon-newline-after': ['always', { severity: 'warning' }],
'at-rule-semicolon-space-before': ['never', { severity: 'warning' }],
'comment-whitespace-inside': ['always', { severity: 'warning' }],
'indentation': [2, {
severity: 'warning',
baseIndentLevel: 0,
ignore: ['param'],
}],
'linebreaks': ['unix', { severity: 'warning' }],
'max-empty-lines': [1, {
severity: 'warning',
ignore: ['comments'],
}],
'max-line-length': [80, {
severity: 'warning',
ignore: ['comments'],
}],
'no-eol-whitespace': [true, { severity: 'warning' }],
/**
* disallow to use defined properties without variables
*/
'scale-unlimited/declaration-strict-value': [
[
'/color/',
'z-index',
'fill',
'stroke',
],
{
ignoreFunctions: false,
ignoreKeywords: {
// '' means default, for all
'': ['currentColor', 'transparent', 'inherit', 'initial'],
'fill': ['none'],
'stroke': ['none'],
},
},
],
},
}