@alma-oss/stylelint-config 10.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2020, LMC s.r.o.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # `@alma-oss/stylelint-config`
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@alma-oss/stylelint-config?label=npm%20package&logo=npm)](https://www.npmjs.org/package/@alma-oss/stylelint-config)
4
+ [![Node version](https://img.shields.io/node/v/@alma-oss/stylelint-config.svg?style=flat&logo=nodedotjs)](https://nodejs.org/download/)
5
+ [![Stylelint version](https://img.shields.io/npm/dependency-version/@alma-oss/stylelint-config/peer/stylelint?logo=stylelint)](https://github.com/stylelint/stylelint)
6
+
7
+ > Alma Career’s config for Stylelint
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ # Yarn:
13
+ yarn add --dev @alma-oss/stylelint-config stylelint-prettier
14
+
15
+ # npm:
16
+ npm install --save-dev @alma-oss/stylelint-config stylelint-prettier
17
+ ```
18
+
19
+ > We assume you are using Prettier. That’s why we also recommend adding
20
+ > `stylelint-prettier` above.
21
+
22
+ Configuration extends community maintained config [stylelint-config-standard-scss](https://github.com/stylelint-scss/stylelint-config-standard-scss).
23
+
24
+ This config:
25
+
26
+ - Extends the [`stylelint-config-recommended` shared config](https://github.com/stylelint/stylelint-config-recommended) and configures its rules for SCSS;
27
+ - extends the [`stylelint-config-recommended-scss` shared config](https://github.com/stylelint-scss/stylelint-config-recommended-scss) and configures its rules for SCSS;
28
+ - extends the [`stylelint-config-standard` shared config](https://github.com/stylelint/stylelint-config-standard) and configures its rules.
29
+
30
+ ## Configuration
31
+
32
+ - **`@alma-oss/stylelint-config`**
33
+
34
+ Use this ruleset to configure Stylelint to work with your code.
35
+
36
+ ## Recommended Stylelint Configuration
37
+
38
+ ```js
39
+ // .stylelintrc.mjs
40
+
41
+ export default {
42
+ extends: ['@alma-oss/stylelint-config', 'stylelint-prettier/recommended'],
43
+ };
44
+ ```
45
+
46
+ <details>
47
+ <summary><i>.stylelintrc</i> or <i>.stylelintrc.json</i></summary>
48
+
49
+ ```json
50
+ {
51
+ "extends": ["@alma-oss/stylelint-config", "stylelint-prettier/recommended"]
52
+ }
53
+ ```
54
+
55
+ </details>
56
+
57
+ <details>
58
+ <summary><i>package.json</i></summary>
59
+
60
+ ```json
61
+ {
62
+ "stylelint": {
63
+ "extends": ["@alma-oss/stylelint-config", "stylelint-prettier/recommended"]
64
+ }
65
+ }
66
+ ```
67
+
68
+ </details>
69
+
70
+ ## Checking Properties Order
71
+
72
+ To further extend control over coding style of your stylesheets, we are also
73
+ checking for properties order.
74
+
75
+ The `order` config enforces a consistent order of content in your declaration blocks:
76
+
77
+ 1. Sass variables,
78
+ 2. CSS custom properties,
79
+ 3. Sass `@extend`,
80
+ 4. single-line Sass `@include`,
81
+ 5. declarations,
82
+ 6. nested rules,
83
+
84
+ For better flexibility, block at-rules (like `@media`, `@supports`, and also Sass `@if`, `@each`, etc.) can be placed
85
+ anywhere in the declaration block.
86
+
87
+ Besides, properties in the declarations must be ordered by following categories:
88
+
89
+ 1. `all` properties,
90
+ 2. `content`,
91
+ 3. position,
92
+ 4. `appearance`,
93
+ 5. box model,
94
+ 6. typography,
95
+ 7. decorations,
96
+ 8. effects and transforms,
97
+ 9. interactions,
98
+ 10. transitions and animations.
99
+
100
+ 👉 To see the order of individual properties this config prescribes, please read
101
+ the [`order` config itself](./rules/order.js).
102
+
103
+ ## Stylistic Rules
104
+
105
+ Stylistic rules (like indentation etc.) [were dropped][stylelint-v16-stylistic-rules]
106
+ in Stylelint v16. To enforce them, you can use
107
+ [`stylelint-prettier`][stylelint-prettier]:
108
+
109
+ ```json
110
+ // `.stylelintrc`
111
+ {
112
+ "plugins": ["stylelint-prettier"],
113
+ "rules": {
114
+ "prettier/prettier": true
115
+ }
116
+ }
117
+ ```
118
+
119
+ ## FAQ
120
+
121
+ <details>
122
+ <summary>How do I change the indentation?</summary>
123
+ ### With Prettier
124
+
125
+ If using Prettier, you can configure the indentation in your Prettier config:
126
+
127
+ ```json
128
+ {
129
+ "tabWidth": 2
130
+ }
131
+ ```
132
+
133
+ Or in your [`.editorconfig`][editorconfig]:
134
+
135
+ ```ini
136
+ [*]
137
+ indent_size = 2
138
+ ```
139
+
140
+ 👉 See [Prettier][prettier] documentation for more options.
141
+
142
+ </details>
143
+
144
+ [prettier]: https://prettier.io
145
+ [stylelint-v16-stylistic-rules]: https://stylelint.io/migration-guide/to-16/#removed-deprecated-stylistic-rules
146
+ [stylelint-prettier]: https://github.com/prettier/stylelint-prettier
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export default {
2
+ customSyntax: 'postcss-scss',
3
+ extends: ['./rules/scss', './rules/extras', './rules/order'],
4
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@alma-oss/stylelint-config",
3
+ "version": "10.0.0-alpha.0",
4
+ "description": "Alma Career's config for Stylelint",
5
+ "keywords": [
6
+ "stylelint",
7
+ "config",
8
+ "alma",
9
+ "career",
10
+ "preset"
11
+ ],
12
+ "author": "Tomáš Litera <tomas.litera@almacareer.com>",
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "files": [
16
+ "index.js",
17
+ "rules/extras.js",
18
+ "rules/order.js",
19
+ "rules/scss.js"
20
+ ],
21
+ "exports": {
22
+ ".": "./index.js",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/lmc-eu/code-quality-tools",
31
+ "directory": "packages/stylelint-config"
32
+ },
33
+ "engines": {
34
+ "node": ">=20"
35
+ },
36
+ "scripts": {
37
+ "lint": "yarn lint:css",
38
+ "lint:css": "npm-run-all --serial lint:css:main lint:css:order lint:css:scss",
39
+ "lint:css:main": "stylelint --config index.js __tests__/__fixtures__/css-valid.css",
40
+ "lint:css:order": "stylelint --config rules/order.js __tests__/__fixtures__/css-valid.css",
41
+ "lint:css:scss": "stylelint --config rules/scss.js __tests__/__fixtures__/scss-valid.scss",
42
+ "test": "npm-run-all --serial lint test:unit",
43
+ "test:unit": "node --test"
44
+ },
45
+ "dependencies": {
46
+ "postcss-scss": "^4.0.3",
47
+ "stylelint-config-standard-scss": "^13.0.0",
48
+ "stylelint-order": "^6.0.0"
49
+ },
50
+ "devDependencies": {
51
+ "npm-run-all2": "9.0.3",
52
+ "stylelint": "16.26.1"
53
+ },
54
+ "peerDependencies": {
55
+ "stylelint": "^16.0.0"
56
+ },
57
+ "gitHead": "e0813802528e9cd92fd6c6a835058ad067f2d958"
58
+ }
@@ -0,0 +1,118 @@
1
+ export default {
2
+ rules: {
3
+ // No default value
4
+ // Reason: Color-named values disabled - desired lint should check for design system token values only.
5
+ // Docs: https://stylelint.io/user-guide/rules/list/color-named
6
+ 'color-named': 'never',
7
+
8
+ // Reason: Except for utility classes and third-party overrides, !important can be avoided.
9
+ // Docs: https://stylelint.io/user-guide/rules/list/declaration-no-important
10
+ 'declaration-no-important': true,
11
+
12
+ // Reasons:
13
+ // - Background images should be stored locally.
14
+ // - Lets make people think more about what actually needs to be animated. Only hardware-accelerable properties should be transitioned.
15
+ // Docs: https://stylelint.io/user-guide/rules/list/declaration-property-value-disallowed-list
16
+ 'declaration-property-value-disallowed-list': [
17
+ {
18
+ '/^background/': ['http:', 'https:'],
19
+ '/^transition/': ['/all/'],
20
+ },
21
+ {
22
+ message:
23
+ 'Transitioning all properties and absolute background URLs are not allowed (declaration-property-value-disallowed-list)',
24
+ },
25
+ ],
26
+
27
+ // No default value
28
+ // Reason: Declaring font weights in other ways is unsafe.
29
+ // Docs: https://stylelint.io/user-guide/rules/list/font-weight-notation
30
+ 'font-weight-notation': 'numeric',
31
+
32
+ // Reason: Selector maximum class count should be just one but especially form parts/components
33
+ // need more complex selectors to add styles when validation is applied.
34
+ // Setting rule to "1" would be uneasy to pass in almost all projects so "2" is clearly just fine.
35
+ // In case of inevitable more complex selector it is allowed and recommended to locally disable that rule.
36
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-max-class
37
+ 'selector-max-class': 2,
38
+
39
+ // Reason: Keep selector specificity as low as possible by default.
40
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-max-compound-selectors
41
+ 'selector-max-compound-selectors': 3,
42
+
43
+ // Reason: IDs are handy for Javascript, not for CSS anymore.
44
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-max-id
45
+ 'selector-max-id': 0,
46
+
47
+ // Reason: Keep selector specificity as low as possible by default.
48
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-max-specificity
49
+ 'selector-max-specificity': '0,4,0',
50
+
51
+ // Reason: Most of the time, we should know what elements or classes we are targeting.
52
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-max-universal
53
+ 'selector-max-universal': 0,
54
+
55
+ // Reason: Avoid compound selectors' creation using nested ampersand SASS syntax.
56
+ // Main reasons why use this pattern:
57
+ // - Unification with design system components code style
58
+ // - Look up easily for the selector using fulltext search in IDEs
59
+ // - Better orientation in longer component's code when scrolled down
60
+ // - Makes `no-descending-specificity` stylelint rule work correctly
61
+ // - IDE's support clicking through from selector usage to its source
62
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-nested-pattern/
63
+ 'selector-nested-pattern': [
64
+ '(^&:)|(^&\\[)|(^&\\.(is\\-|has\\-))',
65
+ {
66
+ message:
67
+ 'Only pseudo class selector, attribute selector and combination with state class is allowed (selector-nested-pattern)',
68
+ },
69
+ ],
70
+
71
+ // Reason: In most cases, it only needlessly increases selector specificity.
72
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-no-qualifying-type
73
+ 'selector-no-qualifying-type': true,
74
+
75
+ // Default value: 'always' with secondary options.
76
+ // Reason: Turned off to support grouping variables using empty lines.
77
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/dollar-variable-empty-line-before/README.md
78
+ 'scss/dollar-variable-empty-line-before': null,
79
+
80
+ // Default value: 'never'
81
+ // Reasons:
82
+ // - The aim is unified syntax;
83
+ // - mixin is a callable function;
84
+ // - will not be misunderstood with extended selector.
85
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-mixin-argumentless-call-parentheses/README.md
86
+ 'scss/at-mixin-argumentless-call-parentheses': 'always',
87
+
88
+ // Default value: true
89
+ // Reason: Since there is `max-line-length` rule se to max. 120 chars, it should be allowed to use a new line for better code readability.
90
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/operator-no-newline-after/README.md
91
+ 'scss/operator-no-newline-after': null,
92
+
93
+ // Default value: true
94
+ // Reason: Since there is `max-line-length` rule se to max. 120 chars, it should be allowed to use a new line for better code readability.
95
+ // (same reason for rule above)
96
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/operator-no-newline-before/README.md
97
+ 'scss/operator-no-newline-before': null,
98
+
99
+ // Default value: 'always'
100
+ // Reason: Support multi-line value definitions lets developer make code more readable.
101
+ // It is handy especially for uneasy math calculations.
102
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/dollar-variable-colon-space-after/README.md
103
+ 'scss/dollar-variable-colon-space-after': 'always-single-line',
104
+
105
+ // Default value `comment-no-empty`: null
106
+ // Default value `scss/comment-no-empty`: true
107
+ // Reason: Allow empty lines in structured block comments.
108
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/comment-no-empty/README.md
109
+ 'scss/comment-no-empty': null,
110
+
111
+ // Default value: true
112
+ // Reasons:
113
+ // - In some cases it is handy to use functions like `unquote`;
114
+ // - values come from Supernova, so you never know what you're going to get.
115
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/function-unquote-no-unquoted-strings-inside/README.md
116
+ 'scss/function-unquote-no-unquoted-strings-inside': null,
117
+ },
118
+ };
package/rules/order.js ADDED
@@ -0,0 +1,408 @@
1
+ export default {
2
+ plugins: ['stylelint-order'],
3
+ rules: {
4
+ 'order/order': [
5
+ 'dollar-variables',
6
+ 'custom-properties',
7
+ {
8
+ name: 'extend',
9
+ type: 'at-rule',
10
+ },
11
+ {
12
+ hasBlock: false,
13
+ name: 'include',
14
+ type: 'at-rule',
15
+ },
16
+ 'declarations',
17
+ 'rules',
18
+ ],
19
+ 'order/properties-order': [
20
+ // All properties
21
+ 'all',
22
+
23
+ // Content
24
+ 'content',
25
+
26
+ // Position
27
+ 'position',
28
+ 'inset',
29
+ 'inset-inline',
30
+ 'inset-inline-start',
31
+ 'inset-inline-end',
32
+ 'inset-block',
33
+ 'inset-block-start',
34
+ 'inset-block-end',
35
+ 'top',
36
+ 'right',
37
+ 'bottom',
38
+ 'left',
39
+ 'contain',
40
+ 'contain-intrinsic-size',
41
+ 'contain-intrinsic-inline-size',
42
+ 'contain-intrinsic-width',
43
+ 'contain-intrinsic-block-size',
44
+ 'contain-intrinsic-height',
45
+ 'isolation',
46
+ 'z-index',
47
+
48
+ // General appearance
49
+ 'appearance',
50
+
51
+ // Box model
52
+ 'direction',
53
+ 'container',
54
+ 'container-name',
55
+ 'container-type',
56
+ 'display',
57
+ 'flex',
58
+ 'flex-grow',
59
+ 'flex-shrink',
60
+ 'flex-basis',
61
+ 'flex-direction',
62
+ 'flex-flow',
63
+ 'flex-wrap',
64
+ 'grid',
65
+ 'grid-area',
66
+ 'grid-template',
67
+ 'grid-template-columns',
68
+ 'grid-template-rows',
69
+ 'grid-template-areas',
70
+ 'grid-column',
71
+ 'grid-column-start',
72
+ 'grid-column-end',
73
+ 'grid-row',
74
+ 'grid-row-start',
75
+ 'grid-row-end',
76
+ 'grid-auto-columns',
77
+ 'grid-auto-rows',
78
+ 'grid-auto-flow',
79
+ 'grid-gap',
80
+ 'grid-column-gap',
81
+ 'grid-row-gap',
82
+ 'columns',
83
+ 'column-count',
84
+ 'column-fill',
85
+ 'column-span',
86
+ 'column-width',
87
+ 'column-rule',
88
+ 'column-rule-width',
89
+ 'column-rule-style',
90
+ 'column-rule-color',
91
+ 'gap',
92
+ 'column-gap',
93
+ 'row-gap',
94
+ 'place-self',
95
+ 'place-content',
96
+ 'place-items',
97
+ 'align-self',
98
+ 'align-content',
99
+ 'align-items',
100
+ 'justify-self',
101
+ 'justify-content',
102
+ 'justify-items',
103
+ 'order',
104
+ 'table-layout',
105
+ 'empty-cells',
106
+ 'shape-outside',
107
+ 'shape-image-threshold',
108
+ 'shape-margin',
109
+ 'clip-path',
110
+ 'float',
111
+ 'clear',
112
+ 'box-sizing',
113
+ 'inline-size',
114
+ 'min-inline-size',
115
+ 'max-inline-size',
116
+ 'width',
117
+ 'min-width',
118
+ 'max-width',
119
+ 'block-size',
120
+ 'min-block-size',
121
+ 'max-block-size',
122
+ 'height',
123
+ 'min-height',
124
+ 'max-height',
125
+ 'aspect-ratio',
126
+ 'object-fit',
127
+ 'object-position',
128
+ 'padding',
129
+ 'padding-inline',
130
+ 'padding-inline-start',
131
+ 'padding-inline-end',
132
+ 'padding-block',
133
+ 'padding-block-start',
134
+ 'padding-block-end',
135
+ 'padding-top',
136
+ 'padding-right',
137
+ 'padding-bottom',
138
+ 'padding-left',
139
+ 'margin',
140
+ 'margin-inline',
141
+ 'margin-inline-start',
142
+ 'margin-inline-end',
143
+ 'margin-block',
144
+ 'margin-block-start',
145
+ 'margin-block-end',
146
+ 'margin-top',
147
+ 'margin-right',
148
+ 'margin-bottom',
149
+ 'margin-left',
150
+ 'overflow',
151
+ 'overflow-inline',
152
+ 'overflow-x',
153
+ 'overflow-block',
154
+ 'overflow-y',
155
+ 'overflow-anchor',
156
+
157
+ // Typography
158
+ 'font',
159
+ 'font-style',
160
+ 'font-weight',
161
+ 'font-size',
162
+ 'font-size-adjust',
163
+ 'line-height',
164
+ 'font-family',
165
+ 'font-variant',
166
+ 'font-variant-alternates',
167
+ 'font-variant-caps',
168
+ 'font-variant-east-asian',
169
+ 'font-variant-emoji',
170
+ 'font-variant-ligatures',
171
+ 'font-variant-numeric',
172
+ 'font-variant-position',
173
+ 'font-feature-settings',
174
+ 'font-stretch',
175
+ 'font-synthesis',
176
+ 'font-synthesis-weight',
177
+ 'font-synthesis-style',
178
+ 'font-synthesis-small-caps',
179
+ 'font-synthesis-position',
180
+ 'font-kerning',
181
+ 'font-optical-sizing',
182
+ 'font-palette',
183
+ 'font-display',
184
+ 'src',
185
+ 'letter-spacing',
186
+ 'quotes',
187
+ 'text-align',
188
+ 'text-align-last',
189
+ 'text-indent',
190
+ 'text-decoration',
191
+ 'text-decoration-color',
192
+ 'text-decoration-line',
193
+ 'text-decoration-style',
194
+ 'text-decoration-thickness',
195
+ 'text-decoration-skip-ink',
196
+ 'text-underline-offset',
197
+ 'text-underline-position',
198
+ 'text-overflow',
199
+ 'text-shadow',
200
+ 'text-rendering',
201
+ 'text-size-adjust',
202
+ 'text-transform',
203
+ 'text-wrap',
204
+ 'text-wrap-mode',
205
+ 'text-wrap-style',
206
+ 'writing-mode',
207
+ 'white-space',
208
+ 'white-space-collapse',
209
+ 'word-break',
210
+ 'word-spacing',
211
+ 'overflow-wrap',
212
+ 'hyphens',
213
+ 'vertical-align',
214
+ 'list-style',
215
+ 'list-style-image',
216
+ 'list-style-position',
217
+ 'list-style-type',
218
+ 'counter-increment',
219
+ 'counter-reset',
220
+ 'counter-set',
221
+
222
+ // Decorations
223
+ 'color-scheme',
224
+ 'color',
225
+ 'color-interpolation',
226
+ 'accent-color',
227
+ 'border',
228
+ 'border-width',
229
+ 'border-style',
230
+ 'border-color',
231
+ 'border-image',
232
+ 'border-image-outset',
233
+ 'border-image-repeat',
234
+ 'border-image-slice',
235
+ 'border-image-source',
236
+ 'border-image-width',
237
+ 'border-inline',
238
+ 'border-inline-width',
239
+ 'border-inline-style',
240
+ 'border-inline-color',
241
+ 'border-inline-start',
242
+ 'border-inline-start-width',
243
+ 'border-inline-start-style',
244
+ 'border-inline-start-color',
245
+ 'border-inline-end',
246
+ 'border-inline-end-width',
247
+ 'border-inline-end-style',
248
+ 'border-inline-end-color',
249
+ 'border-block',
250
+ 'border-block-width',
251
+ 'border-block-style',
252
+ 'border-block-color',
253
+ 'border-block-start',
254
+ 'border-block-start-width',
255
+ 'border-block-start-style',
256
+ 'border-block-start-color',
257
+ 'border-block-end',
258
+ 'border-block-end-width',
259
+ 'border-block-end-style',
260
+ 'border-block-end-color',
261
+ 'border-top',
262
+ 'border-top-width',
263
+ 'border-top-style',
264
+ 'border-top-color',
265
+ 'border-right',
266
+ 'border-right-width',
267
+ 'border-right-style',
268
+ 'border-right-color',
269
+ 'border-bottom',
270
+ 'border-bottom-width',
271
+ 'border-bottom-style',
272
+ 'border-bottom-color',
273
+ 'border-left',
274
+ 'border-left-width',
275
+ 'border-left-style',
276
+ 'border-left-color',
277
+ 'border-radius',
278
+ 'border-start-start-radius',
279
+ 'border-start-end-radius',
280
+ 'border-end-start-radius',
281
+ 'border-end-end-radius',
282
+ 'border-top-left-radius',
283
+ 'border-top-right-radius',
284
+ 'border-bottom-right-radius',
285
+ 'border-bottom-left-radius',
286
+ 'border-collapse',
287
+ 'border-spacing',
288
+ 'background',
289
+ 'background-image',
290
+ 'background-position',
291
+ 'background-position-x',
292
+ 'background-position-y',
293
+ 'background-size',
294
+ 'background-repeat',
295
+ 'background-attachment',
296
+ 'background-origin',
297
+ 'background-clip',
298
+ 'background-color',
299
+ 'background-blend-mode',
300
+ 'paint-order',
301
+ 'stroke',
302
+ 'fill',
303
+ 'outline',
304
+ 'outline-color',
305
+ 'outline-style',
306
+ 'outline-width',
307
+ 'outline-offset',
308
+ 'box-decoration-break',
309
+ 'box-shadow',
310
+
311
+ // Effects and transforms
312
+ 'visibility',
313
+ 'opacity',
314
+ 'mix-blend-mode',
315
+ 'filter',
316
+ 'backdrop-filter',
317
+ 'mask',
318
+ 'mask-clip',
319
+ 'mask-composite',
320
+ 'mask-image',
321
+ 'mask-mode',
322
+ 'mask-origin',
323
+ 'mask-position',
324
+ 'mask-repeat',
325
+ 'mask-size',
326
+ 'mark-border',
327
+ 'mask-border-mode',
328
+ 'mask-border-outset',
329
+ 'mask-border-repeat',
330
+ 'mask-border-slice',
331
+ 'mask-border-source',
332
+ 'mask-border-width',
333
+ 'mask-type',
334
+ 'translate',
335
+ 'rotate',
336
+ 'scale',
337
+ 'perspective',
338
+ 'perspective-origin',
339
+ 'transform',
340
+ 'transform-box',
341
+ 'transform-origin',
342
+ 'transform-style',
343
+ 'backface-visibility',
344
+ 'image-orientation',
345
+ 'image-rendering',
346
+
347
+ // Interactions
348
+ 'user-select',
349
+ 'pointer-events',
350
+ 'resize',
351
+ 'touch-action',
352
+ 'scroll-behavior',
353
+ 'scroll-snap-type',
354
+ 'scroll-padding',
355
+ 'scroll-padding-inline',
356
+ 'scroll-padding-inline-start',
357
+ 'scroll-padding-inline-end',
358
+ 'scroll-padding-block',
359
+ 'scroll-padding-block-start',
360
+ 'scroll-padding-block-end',
361
+ 'scroll-padding-top',
362
+ 'scroll-padding-right',
363
+ 'scroll-padding-bottom',
364
+ 'scroll-padding-left',
365
+ 'scroll-snap-align',
366
+ 'scroll-margin',
367
+ 'scroll-margin-inline',
368
+ 'scroll-margin-inline-start',
369
+ 'scroll-margin-inline-end',
370
+ 'scroll-margin-block',
371
+ 'scroll-margin-block-start',
372
+ 'scroll-margin-block-end',
373
+ 'scroll-margin-top',
374
+ 'scroll-margin-right',
375
+ 'scroll-margin-bottom',
376
+ 'scroll-margin-left',
377
+ 'scroll-snap-stop',
378
+ 'overscroll-behavior',
379
+ 'overscroll-behavior-inline',
380
+ 'overscroll-behavior-block',
381
+ 'overscroll-behavior-x',
382
+ 'overscroll-behavior-y',
383
+ 'caret-color',
384
+ 'cursor',
385
+ 'scrollbar-color',
386
+ 'scrollbar-gutter',
387
+ 'scrollbar-width',
388
+
389
+ // Transitions and animations
390
+ 'transition',
391
+ 'transition-property',
392
+ 'transition-duration',
393
+ 'transition-timing-function',
394
+ 'transition-delay',
395
+ 'transition-behavior',
396
+ 'animation',
397
+ 'animation-name',
398
+ 'animation-duration',
399
+ 'animation-timing-function',
400
+ 'animation-delay',
401
+ 'animation-iteration-count',
402
+ 'animation-direction',
403
+ 'animation-fill-mode',
404
+ 'animation-play-state',
405
+ 'will-change',
406
+ ],
407
+ },
408
+ };
package/rules/scss.js ADDED
@@ -0,0 +1,49 @@
1
+ export default {
2
+ extends: ['stylelint-config-standard-scss'],
3
+ rules: {
4
+ // Accept selector class pattern according to BEM methodology for general components
5
+ // and kebab-case for utility components.
6
+ // Docs: https://stylelint.io/user-guide/rules/list/selector-class-pattern
7
+ 'selector-class-pattern': [
8
+ '(^([A-Z][a-zA-Z0-9]*)((--|__)[a-z][a-zA-Z0-9]*)*$)|(^([a-z][a-z0-9]*)(-[a-z0-9]+)*$)',
9
+ {
10
+ message:
11
+ 'Expected class selector to be in format `MyComponent__myElement`, `MyComponent--modifier` ' +
12
+ 'or `kebab-case` for utility classes (selector-class-pattern)',
13
+ },
14
+ ],
15
+
16
+ // Default value: true
17
+ // Reason: Generally developers don't quite understand flexbox and CSS grid. Let's avoid shorthands to easier readability for everyone.
18
+ // Docs: https://stylelint.io/user-guide/rules/list/declaration-block-no-redundant-longhand-properties
19
+ 'declaration-block-no-redundant-longhand-properties': [
20
+ true,
21
+ {
22
+ ignoreShorthands: ['/^flex/', '/^grid/'],
23
+ },
24
+ ],
25
+
26
+ // All options remained as defaults except secondary option `blockless-after-blockless` that had changed to `blockless-after-same-name-blockless`.
27
+ // Reason: To keep `at rules` grouped.
28
+ // Docs: https://stylelint.io/user-guide/rules/list/at-rule-empty-line-before
29
+ 'at-rule-empty-line-before': [
30
+ 'always',
31
+ {
32
+ except: ['blockless-after-same-name-blockless', 'first-nested'],
33
+ ignore: ['after-comment'],
34
+ ignoreAtRules: ['else'],
35
+ },
36
+ ],
37
+
38
+ // Allow only kebab-case variables naming. For private variables also allow underscore prefix.
39
+ // Reason: To allow underscore prefix for private variables.
40
+ // Docs: https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/dollar-variable-pattern/README.md
41
+ 'scss/dollar-variable-pattern': [
42
+ '^(_?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',
43
+ {
44
+ message:
45
+ 'Expected variable to be kebab-case. Underscore prefix for private variables is allowed (scss/dollar-variable-pattern)',
46
+ },
47
+ ],
48
+ },
49
+ };