@alexlit/config-stylelint 45.0.0 → 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 -1
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 };
|