-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
193 lines (188 loc) · 4.99 KB
/
index.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
'use strict';
module.exports = {
extends: [
'stylelint-config-standard',
// Needed to be able to parse vue files, see https://github.com/ota-meshi/stylelint-config-html#book-usage
'stylelint-config-html/vue'
],
overrides: [
{
// Needed to be able to parse scss files, as we don't want to use the stylelint-config-standard-scss
// see https://stylelint.io/migration-guide/to-14/
files: '**/*.scss',
customSyntax: "postcss-scss",
},
],
plugins: [
'stylelint-scss',
'stylelint-order',
],
rules: {
'at-rule-empty-line-before': [
'always',
{
ignoreAtRules: 'else',
except: ['blockless-after-blockless', 'first-nested'],
ignore: ['after-comment'],
},
],
'at-rule-no-unknown': null, // Handled by stylelint-scss at-rule-no-unknown,
'color-hex-length': 'long',
'color-named': 'never',
'declaration-block-no-redundant-longhand-properties': [
true,
{
ignoreShorthands: ['grid-template']
}
],
'declaration-no-important': true,
'function-no-unknown': null, // Accept SCSS functions.
'length-zero-no-unit': [
true,
{
ignore: ["custom-properties"], // Allow 0px for variables and calc().
},
],
'max-nesting-depth': 4,
'no-descending-specificity': null,
'no-irregular-whitespace': true,
'selector-attribute-quotes': 'always',
'selector-class-pattern': [
/^((row)|(col-.*)|(spacing(-.*|$))|(typo--.*)|(align(--.*|$))|(container)|(container-fluid)|(focus)|((\.?[a-z][a-z]*-)([a-z][a-z]+(-([a-z]+|[0-9]+))*)(__[a-z][a-z]+(-([a-z0-9]+))*)?(--([a-z][a-z]+|h[1-6]|i)(-[a-z0-9]+)*)?(:{1,2}[a-z][a-z]+(-[a-z0-9]+)*(\(["a-z0-9]+\))?)?))+$/m,
{
resolveNestedSelectors: true,
},
],
'selector-max-id': 0,
'selector-not-notation': null, // IE11 does not support selector list in :not().
'selector-type-no-unknown': [
true,
{
ignore: ["custom-elements"],
},
],
'scss/at-rule-no-unknown': [
true,
{
ignoreAtRules: ['property']
}
],
'scss/double-slash-comment-whitespace-inside': 'always',
'order/order': [
'dollar-variables',
'custom-properties',
{
type: 'at-rule',
name: 'extend',
},
{
type: 'at-rule',
name: 'include',
hasBlock: false,
},
'declarations',
{
type: 'at-rule',
name: 'media',
hasBlock: true,
},
{
type: 'at-rule',
name: 'include',
hasBlock: true,
},
'rules',
],
'value-keyword-case': null,
'color-function-notation': 'legacy',
'value-no-vendor-prefix': [
true,
{
ignoreValues: ['box']
}
],
'property-no-vendor-prefix': [
true,
{
ignoreProperties: ['appearance', 'text-decoration-skip']
}
],
'selector-no-vendor-prefix': [
true,
{
ignoreSelectors: ['::-webkit-input-placeholder', ':-moz-placeholder', 'box']
}
],
'custom-property-pattern': null,
},
};
/**
* BEM pattern
*
* fixedValue = .row | .col-.* | .spacing$ | .spacing-.* | .align$ | .align--.*
* bemName = Namespace Block (Element)? (MODIFIER)? (Pseudo)? | Fixed-Value
* Pattern = fixedValue | bemName
* Namespace = .[cel]-
* Block = [a-z]char+(-charOrNum+)*
* Element = __Block (BEM Name)?
* Modifier = --Block
* Pseudo = :Block(\([":a-z0-9]+\))?
* char = [a-z0-9]
* charOrNum = ([a-z]+|[0-9]+)
*
* ^((row)|(col.*)|((\.?[cel]-)([a-z][a-z]+(-([a-z]+|[0-9]+))*)(__[a-z][a-z]+(-([a-z]+|[0-9]+))*)?(--[a-z][a-z]+(-([a-z]+|[0-9]+))*)?(:{1,2}[a-z][a-z]+(-[a-z0-9]+)*(\(["a-z0-9]+\))?)?))+$
*
*
* valid
c-block
c-block:hover
c-block-foo
c-block-foo:first-child
c-block--foo
c-block--foo:focus
c-block__element
c-block__element:nth-child(5)
c-block__element--modifier
c-block__element--modifier-foo
c-block__element--modifier-foo-baa
c-block.c-block
c-block__element.c-block
c-block__element.c-block__element
c-block__element--modifier.c-block
c-block__element--modifier.c-block__element
c-block__element--modifier.c-block__element--modifier
c-block-name-foo-baa
c-block__element-name-foo
c-block-name-foo-baa__element-name-foo
c-main-content__content.c-main-content__content--main-navigation-open
c-advertisement-1
c-advertisement__element-1
c-advertisement__element--modifier-1
c-advertisement-1__element
c-advertisement__element-1--modifier
c-advertisement-1__element-1--modifier-1
c-advertisement-1121__element-111--modifier-689
cc-foo
row
col-6
align--left
align
c-heading--h1
c-heading--h6
c-icon--i-icon
* invalid
alignment
foo
c-block---foo
c-block--element--foo
c-block__element__element
c-block__element__element.c-block
c-block__element.c-block__element__element
c-block__element--modifier--modifier.c-block
c-block__element--modifier.c-block__element--modifier--modifier
c-advertisement1
c-advertisement__element1
c-advertisement__element--modifier1
c-heading--h9
*
**/