-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstylelint.config.cjs
More file actions
105 lines (86 loc) · 3.28 KB
/
Copy pathstylelint.config.cjs
File metadata and controls
105 lines (86 loc) · 3.28 KB
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
module.exports = {
extends: [
'stylelint-config-recommended-scss'
],
ignoreFiles: [
'**/*.js', '**/*.md'
],
rules: {
// Naming
'selector-class-pattern': "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
'selector-id-pattern': "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
/* FROM Airbnb config */
// CSS formatting
'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,
'rule-empty-line-before': ['always', {
ignore: ['after-comment', 'first-nested'],
}],
// Comments
'comment-empty-line-before': ['always', {
ignore: ['stylelint-commands'],
}],
// 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-disallowed-list': ['extend'],
/* ==========================================================================
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-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
ignoreAtRules: ['import', 'use', 'forward', '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,
},
};