This repository has been archived by the owner on Mar 26, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
157 lines (135 loc) · 4.46 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
/**
* Copyright (c) 2018-present, wemake.services
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict'
const namePattern = '[a-z]+([a-z0-9-]+[a-z0-9]+)?$'
const publicNamePattern = `^${namePattern}`
const privateNamePattern = `^[_]?${namePattern}`
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-recommended-scss'
],
plugins: [
'stylelint-order',
'stylelint-declaration-strict-value',
'stylelint-declaration-block-no-ignored-properties',
'stylelint-color-format'
],
rules: {
// base
'max-nesting-depth': 3, // just google 'the-inception-rule'
'max-line-length': 80,
'string-quotes': 'single',
// order
'order/order': [
[
'custom-properties',
'dollar-variables',
{
type: 'at-rule',
name: 'extend'
},
{
type: 'at-rule',
name: 'include',
hasBlock: false
},
'declarations',
{
type: 'at-rule',
name: 'include',
hasBlock: true
},
'rules',
'at-rules'
]
],
// url() function
'function-url-no-scheme-relative': true, // use explicit https
'function-url-quotes': 'always',
// fonts
'font-weight-notation': 'numeric',
// media queries
'media-feature-name-no-unknown': true,
'media-query-list-comma-newline-before': 'never-multi-line',
'scss/media-feature-value-dollar-variable': 'always',
// vendor prefixes are forbidden, use autoprefixer
'at-rule-no-vendor-prefix': true,
'media-feature-name-no-vendor-prefix': true,
'property-no-vendor-prefix': true,
'value-no-vendor-prefix': true,
'selector-no-vendor-prefix': true,
// comments
'scss/double-slash-comment-whitespace-inside': 'always',
// scss declarations
'scss/declaration-nested-properties': 'never',
'plugin/declaration-block-no-ignored-properties': true,
'scale-unlimited/declaration-strict-value': [
['/color/', 'z-index', 'font-size', 'font-family'],
{
ignoreKeywords: {
'': ['inherit'],
'/color/': ['currentColor', 'transparent', 'inherit']
}
}
],
// scss variables
'scss/dollar-variable-no-missing-interpolation': true,
'scss/dollar-variable-colon-space-after': 'always',
'scss/dollar-variable-colon-space-before': 'never',
'scss/dollar-variable-pattern': privateNamePattern,
'scss/no-duplicate-dollar-variables': true,
// scss placeholders
'scss/percent-placeholder-pattern': publicNamePattern,
'scss/at-extend-no-missing-placeholder': true,
// scss mixins
'scss/at-mixin-named-arguments': 'always',
'scss/at-mixin-parentheses-space-before': 'always',
'scss/at-mixin-argumentless-call-parentheses': 'always',
'scss/at-mixin-pattern': publicNamePattern,
// scss functions
'scss/at-function-named-arguments': 'always',
'scss/at-function-parentheses-space-before': 'always',
'scss/at-function-pattern': publicNamePattern,
// scss operators
'scss/operator-no-newline-before': true,
'scss/operator-no-newline-after': true,
'scss/operator-no-unspaced': true,
// scss selectors
'selector-attribute-quotes': 'always',
'selector-max-universal': 1,
'selector-max-specificity': '1,3,3', // id,class,type
'selector-max-compound-selectors': 3,
'scss/selector-no-redundant-nesting-selector': true,
// scss imports
'scss/at-import-no-partial-leading-underscore': true,
'scss/at-import-partial-extension-blacklist': ['scss'],
// scss if-else
'at-rule-empty-line-before': [
'always', {
ignoreAtRules: ['else'],
except: [
'blockless-after-same-name-blockless',
'first-nested'
],
ignore: ['after-comment']
}
],
'block-closing-brace-newline-after': [
'always', { ignoreAtRules: ['if', 'else'] }
],
'scss/at-else-closing-brace-newline-after': 'always-last-in-chain',
'scss/at-else-closing-brace-space-after': 'always-intermediate',
'scss/at-else-empty-line-before': 'never',
'scss/at-else-if-parentheses-space-before': 'always',
'scss/at-if-closing-brace-newline-after': 'always-last-in-chain',
'scss/at-if-closing-brace-space-after': 'always-intermediate',
// using only rgb colors
'color-named': 'never',
'color-format/format': { format: 'rgb' }
}
}