-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstylelint.config.js
137 lines (116 loc) · 3.88 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
/**
* Default configuration to lint
* the airbnb css style-guide.
* This file is taken from a pull request to Airbnb/css repo
* which intends to create a default preset that can be used
* in the future. Until it is merged, we will have the config here.
* https://github.com/airbnb/css/pull/23
* Add more rules: http://stylelint.io/user-guide/rules/
* Also, to understand better who the rules are named:
* http://stylelint.io/user-guide/about-rules/
* For an extended sample of config, check this out
* http://stylelint.io/user-guide/example-config/
*/
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-sass-guidelines',
'stylelint-prettier/recommended',
],
plugins: ['stylelint-scss'],
rules: {
/* ==========================================================================
Airbnb config
========================================================================== */
// CSS formatting
'selector-max-id': 0,
indentation: 2,
'selector-list-comma-newline-after': 'always',
'declaration-colon-space-after': 'always',
'declaration-colon-space-before': 'never',
'block-opening-brace-space-before': 'always',
'declaration-block-single-line-max-declarations': 1,
// Comments
'comment-empty-line-before': [
'always',
{
ignore: ['stylelint-commands'],
},
],
// Border
'declaration-property-value-blacklist': {
'/^border/': ['none'],
},
// 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'],
// Nesting depth
'max-nesting-depth': 3,
/* ==========================================================================
Best practices
========================================================================== */
// Specificity
// 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': [
'always',
{
// Allow mixins to have an empty line before
except: ['first-nested'],
ignoreAtRules: ['import', 'first-nested'],
},
],
// More styling rules for more consistency
'at-rule-name-case': 'lower',
// Colors
'color-hex-case': 'lower',
'color-hex-length': 'long',
'color-no-invalid-hex': true,
// strings
'string-quotes': '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,
// Comments
'comment-whitespace-inside': 'always',
// Functions
'function-comma-space-after': 'always-single-line',
'function-comma-space-before': 'never',
// Numbers
// unitless zero and no trailing zeros
'length-zero-no-unit': true,
'number-no-trailing-zeros': true,
// Syntax
'declaration-block-trailing-semicolon': 'always',
// Declaration blocks
'declaration-block-no-duplicate-properties': true,
// Prevents adding unnecesary Specificity or complicated sass stuff
'scss/selector-no-redundant-nesting-selector': true,
// pass css-modules :global selector
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['/^global$/'],
},
],
},
};