-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.stylelintrc.js
executable file
·76 lines (74 loc) · 2.11 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
/**
* This file is part of react-boilerplate.
* @link : https://zhaiyiming.com/
* @author : Emil Zhai ([email protected])
* @modifier : Emil Zhai ([email protected])
* @copyright: Copyright (c) 2018 TINYMINS.
*/
const selectorClassPatternBEM = [
// Matches class name likes this: block__elem--mod or block1__elem1--mod1-block2__elem2--mod2-...
/^(?:(weui|ant|BraftEditor)-[a-zA-Z-_]+|(?:(?:(?:^|(?!^)-)[a-z]+\d*|-[a-z]*\d+)(?:__[a-z]+\d*|__[a-z]*\d+){0,1}(?:--[a-z]+\d*|--[a-z]*\d+){0,1})*)$/u,
{
severity: 'error',
resolveNestedSelectors: true,
message: 'Selector should be written in BEM style (selector-class-pattern)',
},
];
module.exports = {
extends: 'stylelint-config-standard',
plugins: ['stylelint-less'],
ignoreDisables: true,
rules: {
'at-rule-empty-line-before': [
'always',
{
except: [
'inside-block',
'blockless-after-same-name-blockless',
'first-nested',
],
ignore: ['blockless-after-blockless'],
ignoreAtRules: ['array', 'of', 'at-rules', 'at-root'],
},
],
'at-rule-no-unknown': null,
'color-hex-length': 'long',
'color-no-invalid-hex': true,
'comment-empty-line-before': [
'always',
{
ignore: ['after-comment', 'stylelint-commands'],
},
],
'function-no-unknown': null,
'max-nesting-depth': null,
'no-empty-source': null,
'no-descending-specificity': null,
'number-leading-zero': 'never',
'selector-class-pattern': selectorClassPatternBEM,
'selector-id-pattern': /^\$?[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u,
'selector-max-compound-selectors': null,
'selector-no-qualifying-type': null,
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
},
],
},
overrides: [
{
files: ['*.less', '**/*.less'],
customSyntax: 'postcss-less',
rules: {
'selector-class-pattern': null,
},
},
{
files: ['src/styles/*.less', 'src/styles/**/*.less'],
rules: {
'selector-class-pattern': selectorClassPatternBEM,
},
},
],
};