@icebreakers/stylelint-config 1.1.6 → 1.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 +49 -4
- package/dist/cli.cjs +13 -334
- package/dist/cli.js +13 -327
- package/dist/index.cjs +163 -117
- package/dist/index.d.cts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +157 -124
- package/package.json +8 -2
- package/dist/chunk-PRTO2AHU.js +0 -43
package/dist/cli.js
CHANGED
|
@@ -1,297 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__commonJS,
|
|
3
|
-
__toESM,
|
|
4
|
-
init_esm_shims
|
|
5
|
-
} from "./chunk-PRTO2AHU.js";
|
|
6
|
-
|
|
7
|
-
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
8
|
-
var require_is_primitive = __commonJS({
|
|
9
|
-
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
|
|
10
|
-
"use strict";
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
module.exports = function isPrimitive(val) {
|
|
13
|
-
if (typeof val === "object") {
|
|
14
|
-
return val === null;
|
|
15
|
-
}
|
|
16
|
-
return typeof val !== "function";
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
22
|
-
var require_isobject = __commonJS({
|
|
23
|
-
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
|
|
24
|
-
"use strict";
|
|
25
|
-
init_esm_shims();
|
|
26
|
-
module.exports = function isObject2(val) {
|
|
27
|
-
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
33
|
-
var require_is_plain_object = __commonJS({
|
|
34
|
-
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
|
|
35
|
-
"use strict";
|
|
36
|
-
init_esm_shims();
|
|
37
|
-
var isObject2 = require_isobject();
|
|
38
|
-
function isObjectObject(o) {
|
|
39
|
-
return isObject2(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
40
|
-
}
|
|
41
|
-
module.exports = function isPlainObject(o) {
|
|
42
|
-
var ctor, prot;
|
|
43
|
-
if (isObjectObject(o) === false) return false;
|
|
44
|
-
ctor = o.constructor;
|
|
45
|
-
if (typeof ctor !== "function") return false;
|
|
46
|
-
prot = ctor.prototype;
|
|
47
|
-
if (isObjectObject(prot) === false) return false;
|
|
48
|
-
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
57
|
-
var require_set_value = __commonJS({
|
|
58
|
-
"../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports, module) {
|
|
59
|
-
"use strict";
|
|
60
|
-
init_esm_shims();
|
|
61
|
-
var { deleteProperty } = Reflect;
|
|
62
|
-
var isPrimitive = require_is_primitive();
|
|
63
|
-
var isPlainObject = require_is_plain_object();
|
|
64
|
-
var isObject2 = (value) => {
|
|
65
|
-
return typeof value === "object" && value !== null || typeof value === "function";
|
|
66
|
-
};
|
|
67
|
-
var isUnsafeKey = (key) => {
|
|
68
|
-
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
69
|
-
};
|
|
70
|
-
var validateKey = (key) => {
|
|
71
|
-
if (!isPrimitive(key)) {
|
|
72
|
-
throw new TypeError("Object keys must be strings or symbols");
|
|
73
|
-
}
|
|
74
|
-
if (isUnsafeKey(key)) {
|
|
75
|
-
throw new Error(`Cannot set unsafe key: "${key}"`);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var toStringKey = (input) => {
|
|
79
|
-
return Array.isArray(input) ? input.flat().map(String).join(",") : input;
|
|
80
|
-
};
|
|
81
|
-
var createMemoKey = (input, options) => {
|
|
82
|
-
if (typeof input !== "string" || !options) return input;
|
|
83
|
-
let key = input + ";";
|
|
84
|
-
if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
|
|
85
|
-
if (options.separator !== void 0) key += `separator=${options.separator};`;
|
|
86
|
-
if (options.split !== void 0) key += `split=${options.split};`;
|
|
87
|
-
if (options.merge !== void 0) key += `merge=${options.merge};`;
|
|
88
|
-
if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
|
|
89
|
-
return key;
|
|
90
|
-
};
|
|
91
|
-
var memoize = (input, options, fn) => {
|
|
92
|
-
const key = toStringKey(options ? createMemoKey(input, options) : input);
|
|
93
|
-
validateKey(key);
|
|
94
|
-
const value = setValue.cache.get(key) || fn();
|
|
95
|
-
setValue.cache.set(key, value);
|
|
96
|
-
return value;
|
|
97
|
-
};
|
|
98
|
-
var splitString = (input, options = {}) => {
|
|
99
|
-
const sep = options.separator || ".";
|
|
100
|
-
const preserve = sep === "/" ? false : options.preservePaths;
|
|
101
|
-
if (typeof input === "string" && preserve !== false && /\//.test(input)) {
|
|
102
|
-
return [input];
|
|
103
|
-
}
|
|
104
|
-
const parts = [];
|
|
105
|
-
let part = "";
|
|
106
|
-
const push = (part2) => {
|
|
107
|
-
let number;
|
|
108
|
-
if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
|
|
109
|
-
parts.push(number);
|
|
110
|
-
} else {
|
|
111
|
-
parts.push(part2);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
for (let i = 0; i < input.length; i++) {
|
|
115
|
-
const value = input[i];
|
|
116
|
-
if (value === "\\") {
|
|
117
|
-
part += input[++i];
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (value === sep) {
|
|
121
|
-
push(part);
|
|
122
|
-
part = "";
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
part += value;
|
|
126
|
-
}
|
|
127
|
-
if (part) {
|
|
128
|
-
push(part);
|
|
129
|
-
}
|
|
130
|
-
return parts;
|
|
131
|
-
};
|
|
132
|
-
var split2 = (input, options) => {
|
|
133
|
-
if (options && typeof options.split === "function") return options.split(input);
|
|
134
|
-
if (typeof input === "symbol") return [input];
|
|
135
|
-
if (Array.isArray(input)) return input;
|
|
136
|
-
return memoize(input, options, () => splitString(input, options));
|
|
137
|
-
};
|
|
138
|
-
var assignProp = (obj, prop, value, options) => {
|
|
139
|
-
validateKey(prop);
|
|
140
|
-
if (value === void 0) {
|
|
141
|
-
deleteProperty(obj, prop);
|
|
142
|
-
} else if (options && options.merge) {
|
|
143
|
-
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
144
|
-
if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
|
|
145
|
-
obj[prop] = merge(obj[prop], value);
|
|
146
|
-
} else {
|
|
147
|
-
obj[prop] = value;
|
|
148
|
-
}
|
|
149
|
-
} else {
|
|
150
|
-
obj[prop] = value;
|
|
151
|
-
}
|
|
152
|
-
return obj;
|
|
153
|
-
};
|
|
154
|
-
var setValue = (target, path, value, options) => {
|
|
155
|
-
if (!path || !isObject2(target)) return target;
|
|
156
|
-
const keys = split2(path, options);
|
|
157
|
-
let obj = target;
|
|
158
|
-
for (let i = 0; i < keys.length; i++) {
|
|
159
|
-
const key = keys[i];
|
|
160
|
-
const next = keys[i + 1];
|
|
161
|
-
validateKey(key);
|
|
162
|
-
if (next === void 0) {
|
|
163
|
-
assignProp(obj, key, value, options);
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
if (typeof next === "number" && !Array.isArray(obj[key])) {
|
|
167
|
-
obj = obj[key] = [];
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
if (!isObject2(obj[key])) {
|
|
171
|
-
obj[key] = {};
|
|
172
|
-
}
|
|
173
|
-
obj = obj[key];
|
|
174
|
-
}
|
|
175
|
-
return target;
|
|
176
|
-
};
|
|
177
|
-
setValue.split = split2;
|
|
178
|
-
setValue.cache = /* @__PURE__ */ new Map();
|
|
179
|
-
setValue.clear = () => {
|
|
180
|
-
setValue.cache = /* @__PURE__ */ new Map();
|
|
181
|
-
};
|
|
182
|
-
module.exports = setValue;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
|
|
186
1
|
// src/cli.ts
|
|
187
|
-
init_esm_shims();
|
|
188
2
|
import fs from "fs";
|
|
189
3
|
import { resolve } from "path";
|
|
190
4
|
import process from "process";
|
|
191
5
|
import jsonc from "comment-json";
|
|
192
6
|
|
|
193
7
|
// src/shared.ts
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
init_esm_shims();
|
|
198
|
-
var __defProp = Object.defineProperty;
|
|
199
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
200
|
-
var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
|
|
201
|
-
var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
|
|
202
|
-
if (typeof options.join === "function") {
|
|
203
|
-
return options.join(segs);
|
|
204
|
-
}
|
|
205
|
-
return segs[0] + joinChar + segs[1];
|
|
206
|
-
}, "join");
|
|
207
|
-
var split = /* @__PURE__ */ __name((path, splitChar, options) => {
|
|
208
|
-
if (typeof options.split === "function") {
|
|
209
|
-
return options.split(path);
|
|
8
|
+
function asStringArray(value) {
|
|
9
|
+
if (!Array.isArray(value)) {
|
|
10
|
+
return [];
|
|
210
11
|
}
|
|
211
|
-
return
|
|
212
|
-
}
|
|
213
|
-
var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
|
|
214
|
-
if (typeof options?.isValid === "function") {
|
|
215
|
-
return options.isValid(key, target);
|
|
216
|
-
}
|
|
217
|
-
return true;
|
|
218
|
-
}, "isValid");
|
|
219
|
-
var isValidObject = /* @__PURE__ */ __name((v) => {
|
|
220
|
-
return isObject(v) || typeof v === "function";
|
|
221
|
-
}, "isValidObject");
|
|
222
|
-
var getValue = /* @__PURE__ */ __name((target, path, options = {}) => {
|
|
223
|
-
if (!isObject(options)) {
|
|
224
|
-
options = { default: options };
|
|
225
|
-
}
|
|
226
|
-
if (!isValidObject(target)) {
|
|
227
|
-
return typeof options.default !== "undefined" ? options.default : target;
|
|
228
|
-
}
|
|
229
|
-
if (typeof path === "number") {
|
|
230
|
-
path = String(path);
|
|
231
|
-
}
|
|
232
|
-
const pathIsArray = Array.isArray(path);
|
|
233
|
-
const pathIsString = typeof path === "string";
|
|
234
|
-
const splitChar = options.separator || ".";
|
|
235
|
-
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
236
|
-
if (!pathIsString && !pathIsArray) {
|
|
237
|
-
return target;
|
|
238
|
-
}
|
|
239
|
-
if (target[path] !== void 0) {
|
|
240
|
-
return isValid(path, target, options) ? target[path] : options.default;
|
|
241
|
-
}
|
|
242
|
-
const segs = pathIsArray ? path : split(path, splitChar, options);
|
|
243
|
-
const len = segs.length;
|
|
244
|
-
let idx = 0;
|
|
245
|
-
do {
|
|
246
|
-
let prop = segs[idx];
|
|
247
|
-
if (typeof prop !== "string") {
|
|
248
|
-
prop = String(prop);
|
|
249
|
-
}
|
|
250
|
-
while (prop && prop.slice(-1) === "\\") {
|
|
251
|
-
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
252
|
-
}
|
|
253
|
-
if (target[prop] !== void 0) {
|
|
254
|
-
if (!isValid(prop, target, options)) {
|
|
255
|
-
return options.default;
|
|
256
|
-
}
|
|
257
|
-
target = target[prop];
|
|
258
|
-
} else {
|
|
259
|
-
let hasProp = false;
|
|
260
|
-
let n = idx + 1;
|
|
261
|
-
while (n < len) {
|
|
262
|
-
prop = join([prop, segs[n++]], joinChar, options);
|
|
263
|
-
if (hasProp = target[prop] !== void 0) {
|
|
264
|
-
if (!isValid(prop, target, options)) {
|
|
265
|
-
return options.default;
|
|
266
|
-
}
|
|
267
|
-
target = target[prop];
|
|
268
|
-
idx = n - 1;
|
|
269
|
-
break;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
if (!hasProp) {
|
|
273
|
-
return options.default;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
} while (++idx < len && isValidObject(target));
|
|
277
|
-
if (idx === len) {
|
|
278
|
-
return target;
|
|
279
|
-
}
|
|
280
|
-
return options.default;
|
|
281
|
-
}, "getValue");
|
|
282
|
-
var index_default = getValue;
|
|
283
|
-
|
|
284
|
-
// src/shared.ts
|
|
285
|
-
var import_set_value = __toESM(require_set_value(), 1);
|
|
12
|
+
return value.filter((entry) => typeof entry === "string");
|
|
13
|
+
}
|
|
286
14
|
function setVscodeSettingsJson(json2 = {}) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
15
|
+
json2["css.validate"] = false;
|
|
16
|
+
json2["less.validate"] = false;
|
|
17
|
+
json2["scss.validate"] = false;
|
|
18
|
+
const existing = new Set(asStringArray(json2["stylelint.validate"]));
|
|
19
|
+
existing.add("vue");
|
|
20
|
+
existing.add("css");
|
|
21
|
+
existing.add("scss");
|
|
22
|
+
json2["stylelint.validate"] = Array.from(existing);
|
|
295
23
|
return json2;
|
|
296
24
|
}
|
|
297
25
|
|
|
@@ -312,45 +40,3 @@ if (isExisted) {
|
|
|
312
40
|
setVscodeSettingsJson(json);
|
|
313
41
|
fs.writeFileSync(vscodeSettingsFilename, jsonc.stringify(json, void 0, 2), "utf8");
|
|
314
42
|
console.info(`[@icebreakers/stylelint-config] ${isExisted ? "update" : "init"} '.vscode/settings.json' finished`);
|
|
315
|
-
/*! Bundled license information:
|
|
316
|
-
|
|
317
|
-
is-primitive/index.js:
|
|
318
|
-
(*!
|
|
319
|
-
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
320
|
-
*
|
|
321
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
322
|
-
* Released under the MIT License.
|
|
323
|
-
*)
|
|
324
|
-
|
|
325
|
-
isobject/index.js:
|
|
326
|
-
(*!
|
|
327
|
-
* isobject <https://github.com/jonschlinkert/isobject>
|
|
328
|
-
*
|
|
329
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
330
|
-
* Released under the MIT License.
|
|
331
|
-
*)
|
|
332
|
-
|
|
333
|
-
is-plain-object/index.js:
|
|
334
|
-
(*!
|
|
335
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
336
|
-
*
|
|
337
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
338
|
-
* Released under the MIT License.
|
|
339
|
-
*)
|
|
340
|
-
|
|
341
|
-
set-value/index.js:
|
|
342
|
-
(*!
|
|
343
|
-
* set-value <https://github.com/jonschlinkert/set-value>
|
|
344
|
-
*
|
|
345
|
-
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
346
|
-
* Released under the MIT License.
|
|
347
|
-
*)
|
|
348
|
-
|
|
349
|
-
get-value/dist/index.mjs:
|
|
350
|
-
(*!
|
|
351
|
-
* get-value <https://github.com/jonschlinkert/get-value>
|
|
352
|
-
*
|
|
353
|
-
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
354
|
-
* Released under the MIT License.
|
|
355
|
-
*)
|
|
356
|
-
*/
|
package/dist/index.cjs
CHANGED
|
@@ -20,81 +20,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
createStylelintConfig: () => createIcebreakerStylelintConfig,
|
|
23
24
|
icebreaker: () => icebreaker
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(index_exports);
|
|
26
27
|
|
|
27
|
-
// ../../node_modules/.pnpm/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
const prototype = Object.getPrototypeOf(value);
|
|
33
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
if (Symbol.iterator in value) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
if (Symbol.toStringTag in value) {
|
|
40
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
45
|
-
if (!isPlainObject(defaults)) {
|
|
46
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
47
|
-
}
|
|
48
|
-
const object = Object.assign({}, defaults);
|
|
49
|
-
for (const key in baseObject) {
|
|
50
|
-
if (key === "__proto__" || key === "constructor") {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const value = baseObject[key];
|
|
54
|
-
if (value === null || value === void 0) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
61
|
-
object[key] = [...value, ...object[key]];
|
|
62
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
63
|
-
object[key] = _defu(
|
|
64
|
-
value,
|
|
65
|
-
object[key],
|
|
66
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
67
|
-
merger
|
|
68
|
-
);
|
|
69
|
-
} else {
|
|
70
|
-
object[key] = value;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return object;
|
|
74
|
-
}
|
|
75
|
-
function createDefu(merger) {
|
|
76
|
-
return (...arguments_) => (
|
|
77
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
78
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
var defu = createDefu();
|
|
82
|
-
var defuFn = createDefu((object, key, currentValue) => {
|
|
83
|
-
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
84
|
-
object[key] = currentValue(object[key]);
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
89
|
-
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
90
|
-
object[key] = currentValue(object[key]);
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
28
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
29
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
30
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
94
31
|
|
|
95
|
-
// src/
|
|
96
|
-
var
|
|
97
|
-
|
|
32
|
+
// src/config.ts
|
|
33
|
+
var import_node_module = require("module");
|
|
34
|
+
|
|
35
|
+
// src/constants.ts
|
|
36
|
+
var PRESET_STANDARD_SCSS = "stylelint-config-standard-scss";
|
|
37
|
+
var PRESET_VUE_SCSS = "stylelint-config-recommended-vue/scss";
|
|
38
|
+
var PRESET_RECESS_ORDER = "stylelint-config-recess-order";
|
|
39
|
+
var DEFAULT_IGNORE_AT_RULES = [
|
|
98
40
|
"tailwind",
|
|
99
41
|
"theme",
|
|
100
42
|
"apply",
|
|
@@ -105,64 +47,168 @@ var ignoreAtRules = [
|
|
|
105
47
|
"reference",
|
|
106
48
|
"config",
|
|
107
49
|
"plugin",
|
|
108
|
-
// unocss
|
|
109
50
|
"unocss"
|
|
110
51
|
];
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
52
|
+
var DEFAULT_IGNORE_TYPES = [
|
|
53
|
+
"page"
|
|
54
|
+
];
|
|
55
|
+
var DEFAULT_IGNORE_UNITS = [
|
|
56
|
+
"rpx"
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
// src/utils.ts
|
|
60
|
+
var IGNORE_DEFAULTS = {
|
|
61
|
+
atRules: DEFAULT_IGNORE_AT_RULES,
|
|
62
|
+
types: DEFAULT_IGNORE_TYPES,
|
|
63
|
+
units: DEFAULT_IGNORE_UNITS
|
|
64
|
+
};
|
|
65
|
+
var IGNORE_REPLACE_KEYS = {
|
|
66
|
+
atRules: "atRules",
|
|
67
|
+
types: "types",
|
|
68
|
+
units: "units"
|
|
69
|
+
};
|
|
70
|
+
var IGNORE_APPEND_KEYS = {
|
|
71
|
+
atRules: "addAtRules",
|
|
72
|
+
types: "addTypes",
|
|
73
|
+
units: "addUnits"
|
|
74
|
+
};
|
|
75
|
+
function toArray(value) {
|
|
76
|
+
if (value == null) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
return Array.isArray(value) ? value : [value];
|
|
80
|
+
}
|
|
81
|
+
function unique(values) {
|
|
82
|
+
const result = [];
|
|
83
|
+
const seen = /* @__PURE__ */ new Set();
|
|
84
|
+
for (const value of values) {
|
|
85
|
+
if (seen.has(value)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
seen.add(value);
|
|
89
|
+
result.push(value);
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
function resolveIgnoreList(kind, options) {
|
|
94
|
+
const replaceKey = IGNORE_REPLACE_KEYS[kind];
|
|
95
|
+
const appendKey = IGNORE_APPEND_KEYS[kind];
|
|
96
|
+
const base = options?.[replaceKey];
|
|
97
|
+
const extras = options?.[appendKey];
|
|
98
|
+
const initial = base !== void 0 ? base : IGNORE_DEFAULTS[kind];
|
|
99
|
+
if (!extras || extras.length === 0) {
|
|
100
|
+
return unique(initial);
|
|
101
|
+
}
|
|
102
|
+
return unique([...initial, ...extras]);
|
|
103
|
+
}
|
|
104
|
+
function normalizeExtends(base) {
|
|
105
|
+
if (!base || Array.isArray(base) && base.length === 0) {
|
|
106
|
+
return void 0;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(base)) {
|
|
109
|
+
return base.length === 1 ? base[0] : base;
|
|
110
|
+
}
|
|
111
|
+
return base;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/config.ts
|
|
115
|
+
var requireFromConfig = (0, import_node_module.createRequire)(importMetaUrl);
|
|
116
|
+
var PRESET_PATH_STANDARD_SCSS = requireFromConfig.resolve(PRESET_STANDARD_SCSS);
|
|
117
|
+
var PRESET_PATH_VUE_SCSS = requireFromConfig.resolve(PRESET_VUE_SCSS);
|
|
118
|
+
var PRESET_PATH_RECESS_ORDER = requireFromConfig.resolve(PRESET_RECESS_ORDER);
|
|
119
|
+
function resolvePresetExtends(presets) {
|
|
120
|
+
const entries = [];
|
|
121
|
+
if (presets?.scss !== false) {
|
|
122
|
+
entries.push(PRESET_PATH_STANDARD_SCSS);
|
|
123
|
+
}
|
|
124
|
+
if (presets?.vue !== false) {
|
|
125
|
+
entries.push(PRESET_PATH_VUE_SCSS);
|
|
126
|
+
}
|
|
127
|
+
if (presets?.order !== false) {
|
|
128
|
+
entries.push(PRESET_PATH_RECESS_ORDER);
|
|
129
|
+
}
|
|
130
|
+
return entries;
|
|
131
|
+
}
|
|
132
|
+
function resolveExtends(options) {
|
|
133
|
+
const presets = resolvePresetExtends(options?.presets);
|
|
134
|
+
const extras = toArray(options?.extends);
|
|
135
|
+
const values = unique([...presets, ...extras]);
|
|
136
|
+
return normalizeExtends(values);
|
|
137
|
+
}
|
|
138
|
+
function resolveOverrides(options) {
|
|
139
|
+
const overrides = options?.overrides;
|
|
140
|
+
if (!overrides || overrides.length === 0) {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
return [...overrides];
|
|
144
|
+
}
|
|
145
|
+
function resolveRules(options) {
|
|
146
|
+
const ignoreUnits = resolveIgnoreList("units", options?.ignores);
|
|
147
|
+
const ignoreTypes = resolveIgnoreList("types", options?.ignores);
|
|
148
|
+
const ignoreAtRules = resolveIgnoreList("atRules", options?.ignores);
|
|
149
|
+
const rules = {
|
|
150
|
+
"unit-no-unknown": [
|
|
151
|
+
true,
|
|
152
|
+
{
|
|
153
|
+
ignoreUnits
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"selector-type-no-unknown": [
|
|
157
|
+
true,
|
|
158
|
+
{
|
|
159
|
+
ignoreTypes
|
|
160
|
+
}
|
|
121
161
|
],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// 'unit-allowed-list': ['em', 'rem', 's'],
|
|
128
|
-
// },
|
|
129
|
-
// },
|
|
162
|
+
"at-rule-no-deprecated": [
|
|
163
|
+
true,
|
|
164
|
+
{
|
|
165
|
+
ignoreAtRules
|
|
166
|
+
}
|
|
130
167
|
],
|
|
168
|
+
"scss/selector-no-redundant-nesting-selector": true,
|
|
169
|
+
"scss/at-rule-no-unknown": [
|
|
170
|
+
true,
|
|
171
|
+
{
|
|
172
|
+
ignoreAtRules
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
};
|
|
176
|
+
if (options?.rules) {
|
|
177
|
+
return {
|
|
178
|
+
...rules,
|
|
179
|
+
...options.rules
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return rules;
|
|
183
|
+
}
|
|
184
|
+
function createIcebreakerStylelintConfig(options = {}) {
|
|
185
|
+
return {
|
|
186
|
+
extends: resolveExtends(options),
|
|
187
|
+
overrides: resolveOverrides(options),
|
|
188
|
+
rules: resolveRules(options)
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/index.ts
|
|
193
|
+
function mergeConfigs(base, overrides) {
|
|
194
|
+
if (!overrides) {
|
|
195
|
+
return base;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
...base,
|
|
199
|
+
...overrides,
|
|
131
200
|
rules: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
true,
|
|
135
|
-
{
|
|
136
|
-
ignoreUnits: ["rpx"]
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
// https://stylelint.io/user-guide/rules/selector-type-no-unknown/
|
|
140
|
-
"selector-type-no-unknown": [
|
|
141
|
-
true,
|
|
142
|
-
{
|
|
143
|
-
ignoreTypes: ["page"]
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"at-rule-no-deprecated": [
|
|
147
|
-
true,
|
|
148
|
-
{
|
|
149
|
-
ignoreAtRules
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"scss/selector-no-redundant-nesting-selector": true,
|
|
153
|
-
"scss/at-rule-no-unknown": [
|
|
154
|
-
true,
|
|
155
|
-
{
|
|
156
|
-
ignoreAtRules
|
|
157
|
-
}
|
|
158
|
-
]
|
|
201
|
+
...base.rules ?? {},
|
|
202
|
+
...overrides.rules ?? {}
|
|
159
203
|
}
|
|
160
204
|
};
|
|
161
205
|
}
|
|
162
206
|
function icebreaker(config) {
|
|
163
|
-
|
|
207
|
+
const base = createIcebreakerStylelintConfig();
|
|
208
|
+
return mergeConfigs(base, config);
|
|
164
209
|
}
|
|
165
210
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
211
|
0 && (module.exports = {
|
|
212
|
+
createStylelintConfig,
|
|
167
213
|
icebreaker
|
|
168
214
|
});
|