-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstylelint.config.js
161 lines (143 loc) · 5.35 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
// Usage instructions:
//
// `npm i -D` the following:
//
// stylelint
// stylelint-config-standard
// stylelint-declaration-block-no-ignored-properties
// stylelint-declaration-strict-value
// stylelint-scss
//
// For more info:
// https://stylelint.io/user-guide/configuration/
module.exports = {
// using standard config...
// https://github.com/stylelint/stylelint-config-standard
extends: [
'stylelint-config-standard'
],
plugins: [
'stylelint-declaration-block-no-ignored-properties',
'stylelint-declaration-strict-value',
'stylelint-scss'
],
// ...with custom rule overrides
rules: {
'at-rule-no-unknown': [
true,
{
// valid css and scss at-rules
ignoreAtRules: [
'content',
'each',
'else',
'error',
'extend',
'for',
'function',
'if',
'import',
'include',
'keyframes',
'media',
'mixin',
'return',
'warn',
'while'
]
}
],
'at-rule-empty-line-before': [
'always', {
ignoreAtRules: ['else', 'import', 'return'],
ignore: ['after-comment'],
except: [
'blockless-after-blockless',
'first-nested'
]
}
],
'at-rule-name-space-after': 'always',
'block-opening-brace-space-before': 'always',
'block-closing-brace-newline-after': [
'always', {
ignoreAtRules: ['if', 'else']
}
],
'comment-empty-line-before': [
'always',
{
except: ['first-nested'],
ignore: [
'after-comment',
'stylelint-commands'
]
}
],
// no empty lines before declarations.
'declaration-empty-line-before': 'never',
// 4 spaces please
indentation: 4,
// over-nesting is confusing! max 3 levels
'max-nesting-depth': 3,
// one selector per line when the rule is multiline.
'selector-list-comma-newline-after': 'always-multi-line',
// remove 'double' requirement, which exists only for backwards
// compatibility with IE. use single colons instead: `p:before`
'selector-pseudo-element-colon-notation': null,
// enforce class selector pattern; example: `.some-component`.
'selector-class-pattern': [
'^[a-z0-9\\-]+$',
{
message:
'Selector should be written in lowercase with hyphens ' +
'(selector-class-pattern)'
}
],
// compound selectors can have at most 3 parts, e.g. `.foo .bar > .baz`.
'selector-max-compound-selectors': 3,
// no id selectors allowed.
'selector-max-id': 0,
// disallow selectors like `p.large` (<p class="large" />).
'selector-no-qualifying-type': true,
// disable vendor prefixes like `input::-moz-placeholder` in selectors.
// use autoprefixer if vendor prefixing is needed.
'selector-no-vendor-prefix': true,
// strings are single quoted.
'string-quotes': 'single',
// disable vendor prefixes like `-webkit-flex` in values.
// use autoprefixer if vendor prefixing is needed.
'value-no-vendor-prefix': true,
// warn about useless rule usage.
'plugin/declaration-block-no-ignored-properties': true,
// enforce variable usage for colors.
'scale-unlimited/declaration-strict-value': [
['color', 'font-family'],
{
ignoreKeywords: 'currentColor',
}
],
// scss plugin rules
'scss/at-else-closing-brace-newline-after': 'always-last-in-chain',
'scss/at-else-closing-brace-space-after': 'always-intermediate',
'scss/at-else-if-parentheses-space-before': 'always',
'scss/at-else-empty-line-before': 'never',
'scss/at-extend-no-missing-placeholder': true,
'scss/at-function-parentheses-space-before': 'never',
'scss/at-function-pattern': '^[_]?[a-z]+([a-z0-9-]*[a-z0-9]+)?$',
'scss/at-if-closing-brace-newline-after': 'always-last-in-chain',
'scss/at-if-closing-brace-space-after': 'always-intermediate',
'scss/at-import-no-partial-leading-underscore': true,
'scss/at-import-partial-extension-blacklist': ['scss'],
'scss/at-mixin-parentheses-space-before': 'never',
'scss/at-mixin-pattern': '^[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-colon-space-before': 'never',
'scss/dollar-variable-pattern': '^[_]?[a-z]+([a-z0-9-]*[a-z0-9]+)?$',
'scss/double-slash-comment-whitespace-inside': 'always',
'scss/percent-placeholder-pattern': '^[a-z]+([a-z0-9-]*[a-z0-9]+)?$',
'scss/operator-no-newline-before': true,
'scss/operator-no-unspaced': true,
'scss/selector-no-redundant-nesting-selector': true
}
};