@xiaohe01/stylelint-config 2.1.0 → 2.2.1
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/README.md +2 -2
- package/dist/index.cjs +168 -23
- package/dist/index.d.cts +3 -8
- package/dist/index.d.mts +3 -8
- package/dist/index.d.ts +3 -8
- package/dist/index.mjs +168 -23
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>xiaohe-stylelint-config</h1>
|
|
3
|
-
<span>🤚 Stylelint config preset for xiaohe</span>
|
|
3
|
+
<span>🤚 Stylelint config preset for xiaohe (inspired by antfu/eslint-config)</span>
|
|
4
4
|
</div>
|
|
5
5
|
|
|
6
6
|
<br>
|
|
@@ -27,7 +27,7 @@ npm install -D stylelint @xiaohe01/stylelint-config
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
> [!WARNING]
|
|
30
|
-
> Stylelint `16.
|
|
30
|
+
> Stylelint `16.13.0+` is now required
|
|
31
31
|
|
|
32
32
|
### 🛹 Usage
|
|
33
33
|
|
package/dist/index.cjs
CHANGED
|
@@ -16,15 +16,40 @@ const GLOB_ALL = [
|
|
|
16
16
|
function core(options = {}) {
|
|
17
17
|
return [
|
|
18
18
|
{
|
|
19
|
+
name: "xiaohe/core/rules",
|
|
19
20
|
files: GLOB_ALL,
|
|
20
21
|
extends: [
|
|
21
|
-
"stylelint-config-recommended",
|
|
22
22
|
"stylelint-config-recess-order"
|
|
23
23
|
],
|
|
24
24
|
rules: {
|
|
25
25
|
"alpha-value-notation": "number",
|
|
26
|
+
"annotation-no-unknown": true,
|
|
27
|
+
"at-rule-descriptor-no-unknown": true,
|
|
28
|
+
"at-rule-descriptor-value-no-unknown": true,
|
|
29
|
+
"at-rule-no-deprecated": true,
|
|
30
|
+
"at-rule-no-unknown": true,
|
|
31
|
+
"at-rule-prelude-no-invalid": [
|
|
32
|
+
true,
|
|
33
|
+
{
|
|
34
|
+
ignoreAtRules: [
|
|
35
|
+
"media"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"block-no-empty": true,
|
|
26
40
|
"color-function-notation": "legacy",
|
|
27
41
|
"color-hex-length": "long",
|
|
42
|
+
"comment-no-empty": true,
|
|
43
|
+
"custom-property-no-missing-var-function": true,
|
|
44
|
+
"declaration-block-no-duplicate-custom-properties": true,
|
|
45
|
+
"declaration-block-no-duplicate-properties": [
|
|
46
|
+
true,
|
|
47
|
+
{
|
|
48
|
+
ignore: [
|
|
49
|
+
"consecutive-duplicates-with-different-syntaxes"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
28
53
|
"declaration-block-no-redundant-longhand-properties": [
|
|
29
54
|
true,
|
|
30
55
|
{
|
|
@@ -33,16 +58,36 @@ function core(options = {}) {
|
|
|
33
58
|
]
|
|
34
59
|
}
|
|
35
60
|
],
|
|
36
|
-
"declaration-
|
|
37
|
-
"
|
|
61
|
+
"declaration-block-no-shorthand-property-overrides": true,
|
|
62
|
+
"declaration-property-value-keyword-no-deprecated": true,
|
|
63
|
+
"font-family-no-duplicate-names": true,
|
|
64
|
+
"function-calc-no-unspaced-operator": true,
|
|
65
|
+
"keyframe-block-no-duplicate-selectors": true,
|
|
66
|
+
"keyframe-declaration-no-important": true,
|
|
38
67
|
"length-zero-no-unit": [
|
|
39
68
|
true,
|
|
40
69
|
{
|
|
41
|
-
ignore: [
|
|
42
|
-
|
|
70
|
+
ignore: [
|
|
71
|
+
"custom-properties"
|
|
72
|
+
],
|
|
73
|
+
ignoreFunctions: [
|
|
74
|
+
"/^--/",
|
|
75
|
+
"var"
|
|
76
|
+
]
|
|
43
77
|
}
|
|
44
78
|
],
|
|
45
|
-
"no-
|
|
79
|
+
"media-feature-name-no-unknown": true,
|
|
80
|
+
"media-feature-name-value-no-unknown": true,
|
|
81
|
+
"media-query-no-invalid": true,
|
|
82
|
+
"named-grid-areas-no-invalid": true,
|
|
83
|
+
"no-descending-specificity": true,
|
|
84
|
+
"no-duplicate-at-import-rules": true,
|
|
85
|
+
"no-duplicate-selectors": true,
|
|
86
|
+
"no-invalid-double-slash-comments": true,
|
|
87
|
+
"no-invalid-position-at-import-rule": true,
|
|
88
|
+
"no-irregular-whitespace": true,
|
|
89
|
+
"property-no-unknown": true,
|
|
90
|
+
"selector-anb-no-unmatchable": true,
|
|
46
91
|
"selector-class-pattern": [
|
|
47
92
|
"^([#a-z][$#{}a-z0-9]*)((-{1,2}|_{2})[$#{}a-z0-9]+)*$",
|
|
48
93
|
{
|
|
@@ -52,7 +97,17 @@ function core(options = {}) {
|
|
|
52
97
|
}
|
|
53
98
|
],
|
|
54
99
|
"selector-not-notation": "simple",
|
|
55
|
-
"selector-
|
|
100
|
+
"selector-pseudo-class-no-unknown": true,
|
|
101
|
+
"selector-pseudo-element-no-unknown": true,
|
|
102
|
+
"string-no-newline": [
|
|
103
|
+
true,
|
|
104
|
+
{
|
|
105
|
+
ignore: [
|
|
106
|
+
"at-rule-preludes",
|
|
107
|
+
"declaration-values"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
],
|
|
56
111
|
...options.overrides
|
|
57
112
|
}
|
|
58
113
|
}
|
|
@@ -62,6 +117,7 @@ function core(options = {}) {
|
|
|
62
117
|
function css(options = {}) {
|
|
63
118
|
return [
|
|
64
119
|
{
|
|
120
|
+
name: "xiaohe/css/rules",
|
|
65
121
|
files: GLOB_CSS,
|
|
66
122
|
rules: {
|
|
67
123
|
...options.overrides
|
|
@@ -73,10 +129,13 @@ function css(options = {}) {
|
|
|
73
129
|
function html(options = {}) {
|
|
74
130
|
return [
|
|
75
131
|
{
|
|
132
|
+
name: "xiaohe/html/setup",
|
|
133
|
+
files: GLOB_HTML,
|
|
134
|
+
customSyntax: "postcss-html"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "xiaohe/html/rules",
|
|
76
138
|
files: GLOB_HTML,
|
|
77
|
-
extends: [
|
|
78
|
-
"stylelint-config-html/html"
|
|
79
|
-
],
|
|
80
139
|
rules: {
|
|
81
140
|
...options.overrides
|
|
82
141
|
}
|
|
@@ -87,11 +146,46 @@ function html(options = {}) {
|
|
|
87
146
|
function scss(options = {}) {
|
|
88
147
|
return [
|
|
89
148
|
{
|
|
149
|
+
name: "xiaohe/scss/setup",
|
|
150
|
+
files: GLOB_SCSS,
|
|
151
|
+
customSyntax: "postcss-scss",
|
|
152
|
+
plugins: [
|
|
153
|
+
"stylelint-scss"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "xiaohe/scss/rules",
|
|
90
158
|
files: GLOB_SCSS,
|
|
91
|
-
extends: [
|
|
92
|
-
"stylelint-config-recommended-scss"
|
|
93
|
-
],
|
|
94
159
|
rules: {
|
|
160
|
+
"annotation-no-unknown": null,
|
|
161
|
+
"at-rule-no-unknown": null,
|
|
162
|
+
"comment-no-empty": null,
|
|
163
|
+
"function-no-unknown": null,
|
|
164
|
+
"media-query-no-invalid": null,
|
|
165
|
+
"no-invalid-position-at-import-rule": [
|
|
166
|
+
true,
|
|
167
|
+
{
|
|
168
|
+
ignoreAtRules: [
|
|
169
|
+
"use",
|
|
170
|
+
"forward"
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"scss/at-extend-no-missing-placeholder": true,
|
|
175
|
+
"scss/at-if-no-null": true,
|
|
176
|
+
"scss/at-rule-no-unknown": true,
|
|
177
|
+
"scss/comment-no-empty": true,
|
|
178
|
+
"scss/declaration-nested-properties-no-divided-groups": true,
|
|
179
|
+
"scss/dollar-variable-no-missing-interpolation": true,
|
|
180
|
+
"scss/function-quote-no-quoted-strings-inside": true,
|
|
181
|
+
"scss/function-unquote-no-unquoted-strings-inside": true,
|
|
182
|
+
"scss/load-no-partial-leading-underscore": true,
|
|
183
|
+
"scss/load-partial-extension": "never",
|
|
184
|
+
"scss/no-duplicate-mixins": true,
|
|
185
|
+
"scss/no-global-function-names": true,
|
|
186
|
+
"scss/operator-no-newline-after": true,
|
|
187
|
+
"scss/operator-no-newline-before": true,
|
|
188
|
+
"scss/operator-no-unspaced": true,
|
|
95
189
|
...options.overrides
|
|
96
190
|
}
|
|
97
191
|
}
|
|
@@ -99,13 +193,50 @@ function scss(options = {}) {
|
|
|
99
193
|
}
|
|
100
194
|
|
|
101
195
|
function vue(options = {}) {
|
|
196
|
+
const {
|
|
197
|
+
scss = false
|
|
198
|
+
} = options;
|
|
102
199
|
return [
|
|
103
200
|
{
|
|
201
|
+
name: "xiaohe/vue/setup",
|
|
202
|
+
files: GLOB_VUE,
|
|
203
|
+
customSyntax: "postcss-html"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "xiaohe/vue/rules",
|
|
104
207
|
files: GLOB_VUE,
|
|
105
|
-
extends: [
|
|
106
|
-
"stylelint-config-recommended-vue"
|
|
107
|
-
],
|
|
108
208
|
rules: {
|
|
209
|
+
"function-no-unknown": [
|
|
210
|
+
true,
|
|
211
|
+
{
|
|
212
|
+
ignoreFunctions: [
|
|
213
|
+
"v-bind"
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"selector-pseudo-class-no-unknown": [
|
|
218
|
+
true,
|
|
219
|
+
{
|
|
220
|
+
ignorePseudoClasses: [
|
|
221
|
+
"deep",
|
|
222
|
+
"global",
|
|
223
|
+
"slotted"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"selector-pseudo-element-no-unknown": [
|
|
228
|
+
true,
|
|
229
|
+
{
|
|
230
|
+
ignorePseudoElements: [
|
|
231
|
+
"v-deep",
|
|
232
|
+
"v-global",
|
|
233
|
+
"v-slotted"
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
...scss ? {
|
|
238
|
+
"function-no-unknown": null
|
|
239
|
+
} : {},
|
|
109
240
|
...options.overrides
|
|
110
241
|
}
|
|
111
242
|
}
|
|
@@ -139,26 +270,37 @@ function defineConfig(options = {}, ...userOverrides) {
|
|
|
139
270
|
vue: enableVue = isPkgExists(VUE_PACKAGES)
|
|
140
271
|
} = options;
|
|
141
272
|
const overrides = [
|
|
142
|
-
...core(
|
|
273
|
+
...core({
|
|
274
|
+
overrides: getOverrides(options.core)
|
|
275
|
+
})
|
|
143
276
|
];
|
|
144
277
|
if (enableCss) {
|
|
145
278
|
overrides.push(
|
|
146
|
-
...css(
|
|
279
|
+
...css({
|
|
280
|
+
overrides: getOverrides(options.css)
|
|
281
|
+
})
|
|
147
282
|
);
|
|
148
283
|
}
|
|
149
284
|
if (enableHtml) {
|
|
150
285
|
overrides.push(
|
|
151
|
-
...html(
|
|
286
|
+
...html({
|
|
287
|
+
overrides: getOverrides(options.html)
|
|
288
|
+
})
|
|
152
289
|
);
|
|
153
290
|
}
|
|
154
291
|
if (enableScss) {
|
|
155
292
|
overrides.push(
|
|
156
|
-
...scss(
|
|
293
|
+
...scss({
|
|
294
|
+
overrides: getOverrides(options.scss)
|
|
295
|
+
})
|
|
157
296
|
);
|
|
158
297
|
}
|
|
159
298
|
if (enableVue) {
|
|
160
299
|
overrides.push(
|
|
161
|
-
...vue(
|
|
300
|
+
...vue({
|
|
301
|
+
overrides: getOverrides(options.vue),
|
|
302
|
+
scss: !!enableScss
|
|
303
|
+
})
|
|
162
304
|
);
|
|
163
305
|
}
|
|
164
306
|
overrides.push(...userOverrides);
|
|
@@ -170,8 +312,11 @@ function defineConfig(options = {}, ...userOverrides) {
|
|
|
170
312
|
...options
|
|
171
313
|
};
|
|
172
314
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
315
|
+
function getOverrides(options) {
|
|
316
|
+
if (options == null || typeof options === "boolean") {
|
|
317
|
+
return {};
|
|
318
|
+
}
|
|
319
|
+
return options.overrides || {};
|
|
175
320
|
}
|
|
176
321
|
|
|
177
322
|
exports.GLOB_ALL = GLOB_ALL;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Config } from 'stylelint';
|
|
3
2
|
|
|
4
3
|
type ConfigOverride = Omit<Config, "overrides"> & {
|
|
5
4
|
files: string | string[];
|
|
6
5
|
name?: string;
|
|
7
6
|
};
|
|
7
|
+
type ConfigRules = Config["rules"];
|
|
8
8
|
interface OptionsOverrides {
|
|
9
|
-
overrides?:
|
|
9
|
+
overrides?: ConfigRules;
|
|
10
10
|
}
|
|
11
11
|
interface OptionsConfig {
|
|
12
12
|
/**
|
|
@@ -39,11 +39,6 @@ interface OptionsConfig {
|
|
|
39
39
|
vue?: boolean | OptionsOverrides;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
42
|
declare function defineConfig(options?: OptionsConfig & Omit<Config, "overrides">, ...userOverrides: ConfigOverride[]): Config;
|
|
48
43
|
|
|
49
44
|
declare const GLOB_CSS: string[];
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Config } from 'stylelint';
|
|
3
2
|
|
|
4
3
|
type ConfigOverride = Omit<Config, "overrides"> & {
|
|
5
4
|
files: string | string[];
|
|
6
5
|
name?: string;
|
|
7
6
|
};
|
|
7
|
+
type ConfigRules = Config["rules"];
|
|
8
8
|
interface OptionsOverrides {
|
|
9
|
-
overrides?:
|
|
9
|
+
overrides?: ConfigRules;
|
|
10
10
|
}
|
|
11
11
|
interface OptionsConfig {
|
|
12
12
|
/**
|
|
@@ -39,11 +39,6 @@ interface OptionsConfig {
|
|
|
39
39
|
vue?: boolean | OptionsOverrides;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
42
|
declare function defineConfig(options?: OptionsConfig & Omit<Config, "overrides">, ...userOverrides: ConfigOverride[]): Config;
|
|
48
43
|
|
|
49
44
|
declare const GLOB_CSS: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Config } from 'stylelint';
|
|
3
2
|
|
|
4
3
|
type ConfigOverride = Omit<Config, "overrides"> & {
|
|
5
4
|
files: string | string[];
|
|
6
5
|
name?: string;
|
|
7
6
|
};
|
|
7
|
+
type ConfigRules = Config["rules"];
|
|
8
8
|
interface OptionsOverrides {
|
|
9
|
-
overrides?:
|
|
9
|
+
overrides?: ConfigRules;
|
|
10
10
|
}
|
|
11
11
|
interface OptionsConfig {
|
|
12
12
|
/**
|
|
@@ -39,11 +39,6 @@ interface OptionsConfig {
|
|
|
39
39
|
vue?: boolean | OptionsOverrides;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
42
|
declare function defineConfig(options?: OptionsConfig & Omit<Config, "overrides">, ...userOverrides: ConfigOverride[]): Config;
|
|
48
43
|
|
|
49
44
|
declare const GLOB_CSS: string[];
|
package/dist/index.mjs
CHANGED
|
@@ -14,15 +14,40 @@ const GLOB_ALL = [
|
|
|
14
14
|
function core(options = {}) {
|
|
15
15
|
return [
|
|
16
16
|
{
|
|
17
|
+
name: "xiaohe/core/rules",
|
|
17
18
|
files: GLOB_ALL,
|
|
18
19
|
extends: [
|
|
19
|
-
"stylelint-config-recommended",
|
|
20
20
|
"stylelint-config-recess-order"
|
|
21
21
|
],
|
|
22
22
|
rules: {
|
|
23
23
|
"alpha-value-notation": "number",
|
|
24
|
+
"annotation-no-unknown": true,
|
|
25
|
+
"at-rule-descriptor-no-unknown": true,
|
|
26
|
+
"at-rule-descriptor-value-no-unknown": true,
|
|
27
|
+
"at-rule-no-deprecated": true,
|
|
28
|
+
"at-rule-no-unknown": true,
|
|
29
|
+
"at-rule-prelude-no-invalid": [
|
|
30
|
+
true,
|
|
31
|
+
{
|
|
32
|
+
ignoreAtRules: [
|
|
33
|
+
"media"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"block-no-empty": true,
|
|
24
38
|
"color-function-notation": "legacy",
|
|
25
39
|
"color-hex-length": "long",
|
|
40
|
+
"comment-no-empty": true,
|
|
41
|
+
"custom-property-no-missing-var-function": true,
|
|
42
|
+
"declaration-block-no-duplicate-custom-properties": true,
|
|
43
|
+
"declaration-block-no-duplicate-properties": [
|
|
44
|
+
true,
|
|
45
|
+
{
|
|
46
|
+
ignore: [
|
|
47
|
+
"consecutive-duplicates-with-different-syntaxes"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
26
51
|
"declaration-block-no-redundant-longhand-properties": [
|
|
27
52
|
true,
|
|
28
53
|
{
|
|
@@ -31,16 +56,36 @@ function core(options = {}) {
|
|
|
31
56
|
]
|
|
32
57
|
}
|
|
33
58
|
],
|
|
34
|
-
"declaration-
|
|
35
|
-
"
|
|
59
|
+
"declaration-block-no-shorthand-property-overrides": true,
|
|
60
|
+
"declaration-property-value-keyword-no-deprecated": true,
|
|
61
|
+
"font-family-no-duplicate-names": true,
|
|
62
|
+
"function-calc-no-unspaced-operator": true,
|
|
63
|
+
"keyframe-block-no-duplicate-selectors": true,
|
|
64
|
+
"keyframe-declaration-no-important": true,
|
|
36
65
|
"length-zero-no-unit": [
|
|
37
66
|
true,
|
|
38
67
|
{
|
|
39
|
-
ignore: [
|
|
40
|
-
|
|
68
|
+
ignore: [
|
|
69
|
+
"custom-properties"
|
|
70
|
+
],
|
|
71
|
+
ignoreFunctions: [
|
|
72
|
+
"/^--/",
|
|
73
|
+
"var"
|
|
74
|
+
]
|
|
41
75
|
}
|
|
42
76
|
],
|
|
43
|
-
"no-
|
|
77
|
+
"media-feature-name-no-unknown": true,
|
|
78
|
+
"media-feature-name-value-no-unknown": true,
|
|
79
|
+
"media-query-no-invalid": true,
|
|
80
|
+
"named-grid-areas-no-invalid": true,
|
|
81
|
+
"no-descending-specificity": true,
|
|
82
|
+
"no-duplicate-at-import-rules": true,
|
|
83
|
+
"no-duplicate-selectors": true,
|
|
84
|
+
"no-invalid-double-slash-comments": true,
|
|
85
|
+
"no-invalid-position-at-import-rule": true,
|
|
86
|
+
"no-irregular-whitespace": true,
|
|
87
|
+
"property-no-unknown": true,
|
|
88
|
+
"selector-anb-no-unmatchable": true,
|
|
44
89
|
"selector-class-pattern": [
|
|
45
90
|
"^([#a-z][$#{}a-z0-9]*)((-{1,2}|_{2})[$#{}a-z0-9]+)*$",
|
|
46
91
|
{
|
|
@@ -50,7 +95,17 @@ function core(options = {}) {
|
|
|
50
95
|
}
|
|
51
96
|
],
|
|
52
97
|
"selector-not-notation": "simple",
|
|
53
|
-
"selector-
|
|
98
|
+
"selector-pseudo-class-no-unknown": true,
|
|
99
|
+
"selector-pseudo-element-no-unknown": true,
|
|
100
|
+
"string-no-newline": [
|
|
101
|
+
true,
|
|
102
|
+
{
|
|
103
|
+
ignore: [
|
|
104
|
+
"at-rule-preludes",
|
|
105
|
+
"declaration-values"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
],
|
|
54
109
|
...options.overrides
|
|
55
110
|
}
|
|
56
111
|
}
|
|
@@ -60,6 +115,7 @@ function core(options = {}) {
|
|
|
60
115
|
function css(options = {}) {
|
|
61
116
|
return [
|
|
62
117
|
{
|
|
118
|
+
name: "xiaohe/css/rules",
|
|
63
119
|
files: GLOB_CSS,
|
|
64
120
|
rules: {
|
|
65
121
|
...options.overrides
|
|
@@ -71,10 +127,13 @@ function css(options = {}) {
|
|
|
71
127
|
function html(options = {}) {
|
|
72
128
|
return [
|
|
73
129
|
{
|
|
130
|
+
name: "xiaohe/html/setup",
|
|
131
|
+
files: GLOB_HTML,
|
|
132
|
+
customSyntax: "postcss-html"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "xiaohe/html/rules",
|
|
74
136
|
files: GLOB_HTML,
|
|
75
|
-
extends: [
|
|
76
|
-
"stylelint-config-html/html"
|
|
77
|
-
],
|
|
78
137
|
rules: {
|
|
79
138
|
...options.overrides
|
|
80
139
|
}
|
|
@@ -85,11 +144,46 @@ function html(options = {}) {
|
|
|
85
144
|
function scss(options = {}) {
|
|
86
145
|
return [
|
|
87
146
|
{
|
|
147
|
+
name: "xiaohe/scss/setup",
|
|
148
|
+
files: GLOB_SCSS,
|
|
149
|
+
customSyntax: "postcss-scss",
|
|
150
|
+
plugins: [
|
|
151
|
+
"stylelint-scss"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "xiaohe/scss/rules",
|
|
88
156
|
files: GLOB_SCSS,
|
|
89
|
-
extends: [
|
|
90
|
-
"stylelint-config-recommended-scss"
|
|
91
|
-
],
|
|
92
157
|
rules: {
|
|
158
|
+
"annotation-no-unknown": null,
|
|
159
|
+
"at-rule-no-unknown": null,
|
|
160
|
+
"comment-no-empty": null,
|
|
161
|
+
"function-no-unknown": null,
|
|
162
|
+
"media-query-no-invalid": null,
|
|
163
|
+
"no-invalid-position-at-import-rule": [
|
|
164
|
+
true,
|
|
165
|
+
{
|
|
166
|
+
ignoreAtRules: [
|
|
167
|
+
"use",
|
|
168
|
+
"forward"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"scss/at-extend-no-missing-placeholder": true,
|
|
173
|
+
"scss/at-if-no-null": true,
|
|
174
|
+
"scss/at-rule-no-unknown": true,
|
|
175
|
+
"scss/comment-no-empty": true,
|
|
176
|
+
"scss/declaration-nested-properties-no-divided-groups": true,
|
|
177
|
+
"scss/dollar-variable-no-missing-interpolation": true,
|
|
178
|
+
"scss/function-quote-no-quoted-strings-inside": true,
|
|
179
|
+
"scss/function-unquote-no-unquoted-strings-inside": true,
|
|
180
|
+
"scss/load-no-partial-leading-underscore": true,
|
|
181
|
+
"scss/load-partial-extension": "never",
|
|
182
|
+
"scss/no-duplicate-mixins": true,
|
|
183
|
+
"scss/no-global-function-names": true,
|
|
184
|
+
"scss/operator-no-newline-after": true,
|
|
185
|
+
"scss/operator-no-newline-before": true,
|
|
186
|
+
"scss/operator-no-unspaced": true,
|
|
93
187
|
...options.overrides
|
|
94
188
|
}
|
|
95
189
|
}
|
|
@@ -97,13 +191,50 @@ function scss(options = {}) {
|
|
|
97
191
|
}
|
|
98
192
|
|
|
99
193
|
function vue(options = {}) {
|
|
194
|
+
const {
|
|
195
|
+
scss = false
|
|
196
|
+
} = options;
|
|
100
197
|
return [
|
|
101
198
|
{
|
|
199
|
+
name: "xiaohe/vue/setup",
|
|
200
|
+
files: GLOB_VUE,
|
|
201
|
+
customSyntax: "postcss-html"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "xiaohe/vue/rules",
|
|
102
205
|
files: GLOB_VUE,
|
|
103
|
-
extends: [
|
|
104
|
-
"stylelint-config-recommended-vue"
|
|
105
|
-
],
|
|
106
206
|
rules: {
|
|
207
|
+
"function-no-unknown": [
|
|
208
|
+
true,
|
|
209
|
+
{
|
|
210
|
+
ignoreFunctions: [
|
|
211
|
+
"v-bind"
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"selector-pseudo-class-no-unknown": [
|
|
216
|
+
true,
|
|
217
|
+
{
|
|
218
|
+
ignorePseudoClasses: [
|
|
219
|
+
"deep",
|
|
220
|
+
"global",
|
|
221
|
+
"slotted"
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"selector-pseudo-element-no-unknown": [
|
|
226
|
+
true,
|
|
227
|
+
{
|
|
228
|
+
ignorePseudoElements: [
|
|
229
|
+
"v-deep",
|
|
230
|
+
"v-global",
|
|
231
|
+
"v-slotted"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
...scss ? {
|
|
236
|
+
"function-no-unknown": null
|
|
237
|
+
} : {},
|
|
107
238
|
...options.overrides
|
|
108
239
|
}
|
|
109
240
|
}
|
|
@@ -137,26 +268,37 @@ function defineConfig(options = {}, ...userOverrides) {
|
|
|
137
268
|
vue: enableVue = isPkgExists(VUE_PACKAGES)
|
|
138
269
|
} = options;
|
|
139
270
|
const overrides = [
|
|
140
|
-
...core(
|
|
271
|
+
...core({
|
|
272
|
+
overrides: getOverrides(options.core)
|
|
273
|
+
})
|
|
141
274
|
];
|
|
142
275
|
if (enableCss) {
|
|
143
276
|
overrides.push(
|
|
144
|
-
...css(
|
|
277
|
+
...css({
|
|
278
|
+
overrides: getOverrides(options.css)
|
|
279
|
+
})
|
|
145
280
|
);
|
|
146
281
|
}
|
|
147
282
|
if (enableHtml) {
|
|
148
283
|
overrides.push(
|
|
149
|
-
...html(
|
|
284
|
+
...html({
|
|
285
|
+
overrides: getOverrides(options.html)
|
|
286
|
+
})
|
|
150
287
|
);
|
|
151
288
|
}
|
|
152
289
|
if (enableScss) {
|
|
153
290
|
overrides.push(
|
|
154
|
-
...scss(
|
|
291
|
+
...scss({
|
|
292
|
+
overrides: getOverrides(options.scss)
|
|
293
|
+
})
|
|
155
294
|
);
|
|
156
295
|
}
|
|
157
296
|
if (enableVue) {
|
|
158
297
|
overrides.push(
|
|
159
|
-
...vue(
|
|
298
|
+
...vue({
|
|
299
|
+
overrides: getOverrides(options.vue),
|
|
300
|
+
scss: !!enableScss
|
|
301
|
+
})
|
|
160
302
|
);
|
|
161
303
|
}
|
|
162
304
|
overrides.push(...userOverrides);
|
|
@@ -168,8 +310,11 @@ function defineConfig(options = {}, ...userOverrides) {
|
|
|
168
310
|
...options
|
|
169
311
|
};
|
|
170
312
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
313
|
+
function getOverrides(options) {
|
|
314
|
+
if (options == null || typeof options === "boolean") {
|
|
315
|
+
return {};
|
|
316
|
+
}
|
|
317
|
+
return options.overrides || {};
|
|
173
318
|
}
|
|
174
319
|
|
|
175
320
|
export { GLOB_ALL, GLOB_CSS, GLOB_HTML, GLOB_SCSS, GLOB_VUE, defineConfig };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaohe01/stylelint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1
|
|
4
|
+
"version": "2.2.1",
|
|
5
5
|
"description": "🤚 Stylelint config preset for xiaohe",
|
|
6
6
|
"author": "xiaohe0601 <xiaohe0601@outlook.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,15 +37,14 @@
|
|
|
37
37
|
"files": [
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"stylelint": ">=16.13.0"
|
|
42
|
+
},
|
|
40
43
|
"dependencies": {
|
|
41
44
|
"local-pkg": "^1.1.1",
|
|
42
45
|
"postcss-html": "^1.8.0",
|
|
43
46
|
"postcss-scss": "^4.0.9",
|
|
44
|
-
"stylelint-config-html": "^1.1.0",
|
|
45
47
|
"stylelint-config-recess-order": "^6.0.0",
|
|
46
|
-
"stylelint-config-recommended": "^15.0.0",
|
|
47
|
-
"stylelint-config-recommended-scss": "^14.1.0",
|
|
48
|
-
"stylelint-config-recommended-vue": "^1.6.0",
|
|
49
48
|
"stylelint-order": "^6.0.4",
|
|
50
49
|
"stylelint-scss": "^6.11.1"
|
|
51
50
|
},
|