@alexlit/config-stylelint 45.0.1 → 45.0.2
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/index.js +145 -27
- package/package.json +1 -2
- package/config.js +0 -126
package/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/* eslint-disable no-console, import/extensions */
|
|
2
|
-
|
|
3
|
-
import { config } from './config.js';
|
|
1
|
+
/* eslint-disable no-console, import/extensions, sonarjs/no-duplicate-string, unicorn/no-null */
|
|
4
2
|
|
|
5
3
|
const ADDITIONAL_PLUGINS = {
|
|
6
4
|
/** @see [stylelint-a11y](https://github.com/double-great/stylelint-a11y) */
|
|
@@ -68,45 +66,165 @@ const PLUGINS = {
|
|
|
68
66
|
/**
|
|
69
67
|
* Create "extends" field
|
|
70
68
|
*
|
|
71
|
-
* @param {PLUGINS}
|
|
69
|
+
* @param {PLUGINS} plugins Enabled/disabled plugins list
|
|
72
70
|
*/
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
Object.entries({ ...PLUGINS, ...
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return extendsPlugins;
|
|
71
|
+
const createPluginsList = (plugins = {}) => {
|
|
72
|
+
const pluginsList = [];
|
|
73
|
+
|
|
74
|
+
Object.entries({ ...PLUGINS, ...plugins })?.forEach(([name, isActive]) => {
|
|
75
|
+
if (isActive) {
|
|
76
|
+
pluginsList.push(`@alexlit/config-stylelint/plugins/${name}`);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return pluginsList;
|
|
85
81
|
};
|
|
86
82
|
|
|
87
83
|
/**
|
|
88
84
|
* Create stylelint config
|
|
89
85
|
*
|
|
90
|
-
* @param {PLUGINS}
|
|
91
|
-
* @param {import('stylelint').Config}
|
|
86
|
+
* @param {PLUGINS} plugins Enabled/disabled plugins list
|
|
87
|
+
* @param {import('stylelint').Config} options Stylelint config
|
|
92
88
|
*/
|
|
93
|
-
const createConfig = (
|
|
94
|
-
...
|
|
89
|
+
const createConfig = (plugins = {}, options = {}) => ({
|
|
90
|
+
...options,
|
|
95
91
|
|
|
96
92
|
extends: [
|
|
97
93
|
'stylelint-config-standard',
|
|
98
|
-
|
|
99
|
-
...(
|
|
94
|
+
|
|
95
|
+
...createPluginsList(plugins),
|
|
96
|
+
|
|
97
|
+
...(options.extends ?? []),
|
|
100
98
|
],
|
|
101
99
|
|
|
102
100
|
ignoreFiles: [
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
'.*/**',
|
|
102
|
+
'build/**',
|
|
103
|
+
'dist/**',
|
|
104
|
+
'docs/**',
|
|
105
|
+
'node_modules/**',
|
|
106
|
+
'storybook-*/**',
|
|
107
|
+
|
|
108
|
+
...(options.ignoreFiles ?? []),
|
|
105
109
|
],
|
|
106
110
|
|
|
107
|
-
plugins:
|
|
108
|
-
|
|
109
|
-
rules: {
|
|
111
|
+
plugins: options.plugins ?? [],
|
|
112
|
+
|
|
113
|
+
rules: {
|
|
114
|
+
'alpha-value-notation': 'number',
|
|
115
|
+
'annotation-no-unknown': [true, { ignoreAnnotations: ['default'] }],
|
|
116
|
+
'at-rule-disallowed-list': ['debug'],
|
|
117
|
+
|
|
118
|
+
'at-rule-empty-line-before': [
|
|
119
|
+
'always',
|
|
120
|
+
{
|
|
121
|
+
except: ['blockless-after-same-name-blockless', 'first-nested'],
|
|
122
|
+
ignoreAtRules: ['else'],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
|
|
126
|
+
'at-rule-no-unknown': null,
|
|
127
|
+
'at-rule-no-vendor-prefix': true,
|
|
128
|
+
'block-no-empty': null,
|
|
129
|
+
'color-function-notation': 'modern',
|
|
130
|
+
'color-hex-length': 'short',
|
|
131
|
+
'color-no-hex': true,
|
|
132
|
+
'color-no-invalid-hex': true,
|
|
133
|
+
|
|
134
|
+
'custom-property-empty-line-before': [
|
|
135
|
+
'always',
|
|
136
|
+
{
|
|
137
|
+
except: ['after-comment', 'after-custom-property', 'first-nested'],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
|
|
141
|
+
'custom-property-pattern': '^_?[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
|
|
142
|
+
'declaration-block-no-redundant-longhand-properties': null,
|
|
143
|
+
|
|
144
|
+
'declaration-property-value-no-unknown': [
|
|
145
|
+
true,
|
|
146
|
+
{
|
|
147
|
+
ignoreProperties: {
|
|
148
|
+
'/.+/': /^(v-(bind|deep|global|slotted)|theme|view)|\$/,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
|
|
153
|
+
'font-family-name-quotes': 'always-unless-keyword',
|
|
154
|
+
'function-no-unknown': null, // delegate to scss/function-no-unknown
|
|
155
|
+
'function-url-quotes': 'always',
|
|
156
|
+
'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
|
|
157
|
+
'hue-degree-notation': 'angle',
|
|
158
|
+
'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*$',
|
|
159
|
+
|
|
160
|
+
'max-nesting-depth': [
|
|
161
|
+
6,
|
|
162
|
+
{
|
|
163
|
+
ignoreAtRules: ['each', 'media', 'supports', 'include'],
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
|
|
167
|
+
'media-feature-name-no-unknown': [
|
|
168
|
+
true,
|
|
169
|
+
{ ignoreMediaFeatureNames: ['screen'] },
|
|
170
|
+
],
|
|
171
|
+
|
|
172
|
+
'media-feature-name-no-vendor-prefix': true,
|
|
173
|
+
'no-descending-specificity': null,
|
|
174
|
+
'no-empty-source': null,
|
|
175
|
+
'no-unknown-animations': true,
|
|
176
|
+
'number-max-precision': 3,
|
|
177
|
+
|
|
178
|
+
'property-no-unknown': [
|
|
179
|
+
true,
|
|
180
|
+
{ ignoreProperties: ['align-tracks', 'animation-timeline'] },
|
|
181
|
+
],
|
|
182
|
+
|
|
183
|
+
'property-no-vendor-prefix': true,
|
|
184
|
+
|
|
185
|
+
'rule-empty-line-before': [
|
|
186
|
+
'always',
|
|
187
|
+
{
|
|
188
|
+
except: ['first-nested'],
|
|
189
|
+
ignore: [],
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
|
|
193
|
+
'selector-class-pattern': [
|
|
194
|
+
'^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
|
|
195
|
+
{
|
|
196
|
+
message:
|
|
197
|
+
'Selector should be written as BEM "block__element--modifier--value" (selector-class-pattern)',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
|
|
201
|
+
'selector-combinator-disallowed-list': ['>>>', '/deep/'],
|
|
202
|
+
|
|
203
|
+
'selector-max-compound-selectors': 6,
|
|
204
|
+
'selector-max-id': 0,
|
|
205
|
+
'selector-no-qualifying-type': null,
|
|
206
|
+
'selector-no-vendor-prefix': true,
|
|
207
|
+
'selector-pseudo-element-disallowed-list': ['shadow'],
|
|
208
|
+
|
|
209
|
+
'selector-pseudo-element-no-unknown': [
|
|
210
|
+
true,
|
|
211
|
+
{ ignorePseudoElements: ['v-deep', 'file-selector-button'] },
|
|
212
|
+
],
|
|
213
|
+
|
|
214
|
+
'selector-type-no-unknown': [true, { ignoreTypes: ['ymaps'] }],
|
|
215
|
+
'shorthand-property-no-redundant-values': true,
|
|
216
|
+
'string-no-newline': null,
|
|
217
|
+
'time-min-milliseconds': 16,
|
|
218
|
+
|
|
219
|
+
'value-keyword-case': [
|
|
220
|
+
'lower',
|
|
221
|
+
{ camelCaseSvgKeywords: true, ignoreFunctions: ['v-bind'] },
|
|
222
|
+
],
|
|
223
|
+
|
|
224
|
+
'value-no-vendor-prefix': true,
|
|
225
|
+
|
|
226
|
+
...options.rules,
|
|
227
|
+
},
|
|
110
228
|
});
|
|
111
229
|
|
|
112
230
|
export { createConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexlit/config-stylelint",
|
|
3
|
-
"version": "45.0.
|
|
3
|
+
"version": "45.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Stylelint config",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"main": "index.js",
|
|
26
26
|
"files": [
|
|
27
27
|
"README.md",
|
|
28
|
-
"config.js",
|
|
29
28
|
"index.js",
|
|
30
29
|
"plugins"
|
|
31
30
|
],
|
package/config.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/* eslint-disable sonarjs/no-duplicate-string, unicorn/no-null */
|
|
2
|
-
|
|
3
|
-
export const config = {
|
|
4
|
-
ignoreFiles: [
|
|
5
|
-
'.*/**',
|
|
6
|
-
'build/**',
|
|
7
|
-
'dist/**',
|
|
8
|
-
'docs/**',
|
|
9
|
-
'node_modules/**',
|
|
10
|
-
'storybook-*/**',
|
|
11
|
-
],
|
|
12
|
-
|
|
13
|
-
rules: {
|
|
14
|
-
'alpha-value-notation': 'number',
|
|
15
|
-
'annotation-no-unknown': [true, { ignoreAnnotations: ['default'] }],
|
|
16
|
-
'at-rule-disallowed-list': ['debug'],
|
|
17
|
-
|
|
18
|
-
'at-rule-empty-line-before': [
|
|
19
|
-
'always',
|
|
20
|
-
{
|
|
21
|
-
except: ['blockless-after-same-name-blockless', 'first-nested'],
|
|
22
|
-
ignoreAtRules: ['else'],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
'at-rule-no-unknown': null,
|
|
27
|
-
'at-rule-no-vendor-prefix': true,
|
|
28
|
-
'block-no-empty': null,
|
|
29
|
-
'color-function-notation': 'modern',
|
|
30
|
-
'color-hex-length': 'short',
|
|
31
|
-
'color-no-hex': true,
|
|
32
|
-
'color-no-invalid-hex': true,
|
|
33
|
-
|
|
34
|
-
'custom-property-empty-line-before': [
|
|
35
|
-
'always',
|
|
36
|
-
{
|
|
37
|
-
except: ['after-comment', 'after-custom-property', 'first-nested'],
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
'custom-property-pattern': '^_?[a-z]+([a-z0-9-]+[a-z0-9]+)?$',
|
|
42
|
-
'declaration-block-no-redundant-longhand-properties': null,
|
|
43
|
-
|
|
44
|
-
'declaration-property-value-no-unknown': [
|
|
45
|
-
true,
|
|
46
|
-
{
|
|
47
|
-
ignoreProperties: {
|
|
48
|
-
'/.+/': /^(v-(bind|deep|global|slotted)|theme|view)|\$/,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
'font-family-name-quotes': 'always-unless-keyword',
|
|
54
|
-
'function-no-unknown': null, // delegate to scss/function-no-unknown
|
|
55
|
-
'function-url-quotes': 'always',
|
|
56
|
-
'function-url-scheme-disallowed-list': ['/^data/', 'ftp', '/^http/'],
|
|
57
|
-
'hue-degree-notation': 'angle',
|
|
58
|
-
'keyframes-name-pattern': '^[a-z]+(-[a-z]+)*$',
|
|
59
|
-
|
|
60
|
-
'max-nesting-depth': [
|
|
61
|
-
6,
|
|
62
|
-
{
|
|
63
|
-
ignoreAtRules: ['each', 'media', 'supports', 'include'],
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
|
|
67
|
-
'media-feature-name-no-unknown': [
|
|
68
|
-
true,
|
|
69
|
-
{ ignoreMediaFeatureNames: ['screen'] },
|
|
70
|
-
],
|
|
71
|
-
|
|
72
|
-
'media-feature-name-no-vendor-prefix': true,
|
|
73
|
-
'no-descending-specificity': null,
|
|
74
|
-
'no-empty-source': null,
|
|
75
|
-
'no-unknown-animations': true,
|
|
76
|
-
'number-max-precision': 3,
|
|
77
|
-
|
|
78
|
-
'property-no-unknown': [
|
|
79
|
-
true,
|
|
80
|
-
{ ignoreProperties: ['align-tracks', 'animation-timeline'] },
|
|
81
|
-
],
|
|
82
|
-
|
|
83
|
-
'property-no-vendor-prefix': true,
|
|
84
|
-
|
|
85
|
-
'rule-empty-line-before': [
|
|
86
|
-
'always',
|
|
87
|
-
{
|
|
88
|
-
except: ['first-nested'],
|
|
89
|
-
ignore: [],
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
|
|
93
|
-
'selector-class-pattern': [
|
|
94
|
-
'^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
|
|
95
|
-
{
|
|
96
|
-
message:
|
|
97
|
-
'Selector should be written as BEM "block__element--modifier--value" (selector-class-pattern)',
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
|
|
101
|
-
'selector-combinator-disallowed-list': ['>>>', '/deep/'],
|
|
102
|
-
|
|
103
|
-
'selector-max-compound-selectors': 6,
|
|
104
|
-
'selector-max-id': 0,
|
|
105
|
-
'selector-no-qualifying-type': null,
|
|
106
|
-
'selector-no-vendor-prefix': true,
|
|
107
|
-
'selector-pseudo-element-disallowed-list': ['shadow'],
|
|
108
|
-
|
|
109
|
-
'selector-pseudo-element-no-unknown': [
|
|
110
|
-
true,
|
|
111
|
-
{ ignorePseudoElements: ['v-deep', 'file-selector-button'] },
|
|
112
|
-
],
|
|
113
|
-
|
|
114
|
-
'selector-type-no-unknown': [true, { ignoreTypes: ['ymaps'] }],
|
|
115
|
-
'shorthand-property-no-redundant-values': true,
|
|
116
|
-
'string-no-newline': null,
|
|
117
|
-
'time-min-milliseconds': 16,
|
|
118
|
-
|
|
119
|
-
'value-keyword-case': [
|
|
120
|
-
'lower',
|
|
121
|
-
{ camelCaseSvgKeywords: true, ignoreFunctions: ['v-bind'] },
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
'value-no-vendor-prefix': true,
|
|
125
|
-
},
|
|
126
|
-
};
|