@unocss/eslint-plugin 66.6.8 → 66.7.0-beta.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/dist/index.cjs +28 -46
- package/dist/index.mjs +27 -45
- package/dist/worker.mjs +5 -7
- package/package.json +7 -10
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ let _typescript_eslint_utils_eslint_utils = require("@typescript-eslint/utils/es
|
|
|
29
29
|
let synckit = require("synckit");
|
|
30
30
|
let node_url = require("node:url");
|
|
31
31
|
let magic_string = require("magic-string");
|
|
32
|
-
magic_string = __toESM(magic_string);
|
|
32
|
+
magic_string = __toESM(magic_string, 1);
|
|
33
33
|
let _typescript_eslint_types = require("@typescript-eslint/types");
|
|
34
34
|
//#region src/constants.ts
|
|
35
35
|
const CLASS_FIELDS = ["class", "classname"];
|
|
@@ -62,14 +62,10 @@ var order_attributify_default = createRule({
|
|
|
62
62
|
create(context) {
|
|
63
63
|
const scriptVisitor = {};
|
|
64
64
|
const templateBodyVisitor = { VStartTag(node) {
|
|
65
|
-
|
|
66
|
-
const valueless = node.attributes.filter((i) => {
|
|
67
|
-
var _i$key, _i$key2;
|
|
68
|
-
return typeof ((_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.name) === "string" && !IGNORE_ATTRIBUTES.includes((_i$key2 = i.key) === null || _i$key2 === void 0 || (_i$key2 = _i$key2.name) === null || _i$key2 === void 0 ? void 0 : _i$key2.toLowerCase()) && i.value == null;
|
|
69
|
-
});
|
|
65
|
+
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
70
66
|
if (!valueless.length) return;
|
|
71
67
|
const input = valueless.map((i) => i.key.name).join(" ").trim();
|
|
72
|
-
const sorted = syncAction(
|
|
68
|
+
const sorted = syncAction(context.settings.unocss?.configPath, "sort", input, context.filename);
|
|
73
69
|
if (sorted !== input) context.report({
|
|
74
70
|
node,
|
|
75
71
|
messageId: "invalid-order",
|
|
@@ -83,9 +79,9 @@ var order_attributify_default = createRule({
|
|
|
83
79
|
}
|
|
84
80
|
});
|
|
85
81
|
} };
|
|
86
|
-
const parserServices =
|
|
82
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
87
83
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
88
|
-
else return parserServices
|
|
84
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
89
85
|
}
|
|
90
86
|
});
|
|
91
87
|
//#endregion
|
|
@@ -102,16 +98,15 @@ var blocklist_default = createRule({
|
|
|
102
98
|
},
|
|
103
99
|
create(context) {
|
|
104
100
|
const checkLiteral = (node) => {
|
|
105
|
-
var _context$settings$uno;
|
|
106
101
|
if (typeof node.value !== "string" || !node.value.trim()) return;
|
|
107
102
|
const input = node.value;
|
|
108
|
-
syncAction(
|
|
103
|
+
syncAction(context.settings.unocss?.configPath, "blocklist", input, context.filename).forEach(([name, meta]) => {
|
|
109
104
|
context.report({
|
|
110
105
|
node,
|
|
111
106
|
messageId: "in-blocklist",
|
|
112
107
|
data: {
|
|
113
108
|
name,
|
|
114
|
-
reason:
|
|
109
|
+
reason: meta?.message ? `: ${meta.message}` : ""
|
|
115
110
|
}
|
|
116
111
|
});
|
|
117
112
|
});
|
|
@@ -124,8 +119,7 @@ var blocklist_default = createRule({
|
|
|
124
119
|
},
|
|
125
120
|
SvelteAttribute(node) {
|
|
126
121
|
if (node.key.name === "class") {
|
|
127
|
-
|
|
128
|
-
if (((_node$value = node.value) === null || _node$value === void 0 ? void 0 : _node$value[0].type) === "SvelteLiteral") checkLiteral(node.value[0]);
|
|
122
|
+
if (node.value?.[0].type === "SvelteLiteral") checkLiteral(node.value[0]);
|
|
129
123
|
}
|
|
130
124
|
}
|
|
131
125
|
};
|
|
@@ -136,30 +130,26 @@ var blocklist_default = createRule({
|
|
|
136
130
|
}
|
|
137
131
|
},
|
|
138
132
|
VStartTag(node) {
|
|
139
|
-
const valueless = node.attributes.filter((i) =>
|
|
140
|
-
var _i$key, _i$key2;
|
|
141
|
-
return typeof ((_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.name) === "string" && !IGNORE_ATTRIBUTES.includes((_i$key2 = i.key) === null || _i$key2 === void 0 || (_i$key2 = _i$key2.name) === null || _i$key2 === void 0 ? void 0 : _i$key2.toLowerCase()) && i.value == null;
|
|
142
|
-
});
|
|
133
|
+
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
143
134
|
if (!valueless.length) return;
|
|
144
135
|
for (const node of valueless) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
syncAction((_context$settings$uno2 = context.settings.unocss) === null || _context$settings$uno2 === void 0 ? void 0 : _context$settings$uno2.configPath, "blocklist", node.key.name, context.filename).forEach(([name, meta]) => {
|
|
136
|
+
if (!node?.key?.name) continue;
|
|
137
|
+
syncAction(context.settings.unocss?.configPath, "blocklist", node.key.name, context.filename).forEach(([name, meta]) => {
|
|
148
138
|
context.report({
|
|
149
139
|
node,
|
|
150
140
|
messageId: "in-blocklist",
|
|
151
141
|
data: {
|
|
152
142
|
name,
|
|
153
|
-
reason:
|
|
143
|
+
reason: meta?.message ? `: ${meta.message}` : ""
|
|
154
144
|
}
|
|
155
145
|
});
|
|
156
146
|
});
|
|
157
147
|
}
|
|
158
148
|
}
|
|
159
149
|
};
|
|
160
|
-
const parserServices =
|
|
150
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
161
151
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
162
|
-
else return parserServices
|
|
152
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
163
153
|
}
|
|
164
154
|
});
|
|
165
155
|
//#endregion
|
|
@@ -237,9 +227,9 @@ var enforce_class_compile_default = createRule({
|
|
|
237
227
|
});
|
|
238
228
|
}
|
|
239
229
|
};
|
|
240
|
-
const parserServices =
|
|
230
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
241
231
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
242
|
-
else return parserServices
|
|
232
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
243
233
|
}
|
|
244
234
|
});
|
|
245
235
|
//#endregion
|
|
@@ -282,10 +272,9 @@ const plugin = { rules: {
|
|
|
282
272
|
return unoVariablesRegexes.some((reg) => reg.test(name));
|
|
283
273
|
}
|
|
284
274
|
function checkLiteral(node, addSpace) {
|
|
285
|
-
var _context$settings$uno;
|
|
286
275
|
if (typeof node.value !== "string" || !node.value.trim()) return;
|
|
287
276
|
const input = node.value;
|
|
288
|
-
let sorted = syncAction(
|
|
277
|
+
let sorted = syncAction(context.settings.unocss?.configPath, "sort", input, context.filename).trim();
|
|
289
278
|
if (addSpace === "before") sorted = ` ${sorted}`;
|
|
290
279
|
else if (addSpace === "after") sorted += " ";
|
|
291
280
|
if (sorted !== input) {
|
|
@@ -307,7 +296,6 @@ const plugin = { rules: {
|
|
|
307
296
|
}
|
|
308
297
|
}
|
|
309
298
|
function checkTemplateElement(quasi) {
|
|
310
|
-
var _context$settings$uno2;
|
|
311
299
|
const input = quasi.value.raw;
|
|
312
300
|
if (!input) return;
|
|
313
301
|
const getRange = () => {
|
|
@@ -321,7 +309,7 @@ const plugin = { rules: {
|
|
|
321
309
|
return [start, end];
|
|
322
310
|
};
|
|
323
311
|
if (!getRange()) return;
|
|
324
|
-
let sorted = syncAction(
|
|
312
|
+
let sorted = syncAction(context.settings.unocss?.configPath, "sort", input, context.filename).trim();
|
|
325
313
|
if (/^\s/.test(input)) sorted = ` ${sorted}`;
|
|
326
314
|
if (/\s$/.test(input)) sorted += " ";
|
|
327
315
|
if (sorted !== input) context.report({
|
|
@@ -378,10 +366,7 @@ const plugin = { rules: {
|
|
|
378
366
|
}
|
|
379
367
|
node.value.forEach((obj, i) => {
|
|
380
368
|
if (obj.type === "SvelteMustacheTag") checkExpressionRecursively(obj.expression);
|
|
381
|
-
else if (obj.type === "SvelteLiteral")
|
|
382
|
-
var _node$value, _node$value2;
|
|
383
|
-
checkLiteral(obj, ((_node$value = node.value) === null || _node$value === void 0 || (_node$value = _node$value[i - 1]) === null || _node$value === void 0 ? void 0 : _node$value.type) === "SvelteMustacheTag" ? "before" : ((_node$value2 = node.value) === null || _node$value2 === void 0 || (_node$value2 = _node$value2[i + 1]) === null || _node$value2 === void 0 ? void 0 : _node$value2.type) === "SvelteMustacheTag" ? "after" : void 0);
|
|
384
|
-
}
|
|
369
|
+
else if (obj.type === "SvelteLiteral") checkLiteral(obj, node.value?.[i - 1]?.type === "SvelteMustacheTag" ? "before" : node.value?.[i + 1]?.type === "SvelteMustacheTag" ? "after" : void 0);
|
|
385
370
|
});
|
|
386
371
|
}
|
|
387
372
|
},
|
|
@@ -425,9 +410,9 @@ const plugin = { rules: {
|
|
|
425
410
|
if (node.value.type === "VLiteral") checkLiteral(node.value);
|
|
426
411
|
}
|
|
427
412
|
} };
|
|
428
|
-
const parserServices =
|
|
413
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
429
414
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
430
|
-
else return parserServices
|
|
415
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
431
416
|
}
|
|
432
417
|
}),
|
|
433
418
|
"order-attributify": order_attributify_default,
|
|
@@ -435,15 +420,6 @@ const plugin = { rules: {
|
|
|
435
420
|
"enforce-class-compile": enforce_class_compile_default
|
|
436
421
|
} };
|
|
437
422
|
//#endregion
|
|
438
|
-
//#region src/configs/flat.ts
|
|
439
|
-
const flatConfig = {
|
|
440
|
-
plugins: { unocss: plugin },
|
|
441
|
-
rules: {
|
|
442
|
-
"unocss/order": "warn",
|
|
443
|
-
"unocss/order-attributify": "warn"
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
//#endregion
|
|
447
423
|
//#region src/index.ts
|
|
448
424
|
const configs = {
|
|
449
425
|
recommended: {
|
|
@@ -453,7 +429,13 @@ const configs = {
|
|
|
453
429
|
"@unocss/order-attributify": "warn"
|
|
454
430
|
}
|
|
455
431
|
},
|
|
456
|
-
flat:
|
|
432
|
+
flat: {
|
|
433
|
+
plugins: { unocss: plugin },
|
|
434
|
+
rules: {
|
|
435
|
+
"unocss/order": "warn",
|
|
436
|
+
"unocss/order-attributify": "warn"
|
|
437
|
+
}
|
|
438
|
+
}
|
|
457
439
|
};
|
|
458
440
|
const eslintPlugin = {
|
|
459
441
|
...plugin,
|
package/dist/index.mjs
CHANGED
|
@@ -32,14 +32,10 @@ var order_attributify_default = createRule({
|
|
|
32
32
|
create(context) {
|
|
33
33
|
const scriptVisitor = {};
|
|
34
34
|
const templateBodyVisitor = { VStartTag(node) {
|
|
35
|
-
|
|
36
|
-
const valueless = node.attributes.filter((i) => {
|
|
37
|
-
var _i$key, _i$key2;
|
|
38
|
-
return typeof ((_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.name) === "string" && !IGNORE_ATTRIBUTES.includes((_i$key2 = i.key) === null || _i$key2 === void 0 || (_i$key2 = _i$key2.name) === null || _i$key2 === void 0 ? void 0 : _i$key2.toLowerCase()) && i.value == null;
|
|
39
|
-
});
|
|
35
|
+
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
40
36
|
if (!valueless.length) return;
|
|
41
37
|
const input = valueless.map((i) => i.key.name).join(" ").trim();
|
|
42
|
-
const sorted = syncAction(
|
|
38
|
+
const sorted = syncAction(context.settings.unocss?.configPath, "sort", input, context.filename);
|
|
43
39
|
if (sorted !== input) context.report({
|
|
44
40
|
node,
|
|
45
41
|
messageId: "invalid-order",
|
|
@@ -53,9 +49,9 @@ var order_attributify_default = createRule({
|
|
|
53
49
|
}
|
|
54
50
|
});
|
|
55
51
|
} };
|
|
56
|
-
const parserServices =
|
|
52
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
57
53
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
58
|
-
else return parserServices
|
|
54
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
59
55
|
}
|
|
60
56
|
});
|
|
61
57
|
//#endregion
|
|
@@ -72,16 +68,15 @@ var blocklist_default = createRule({
|
|
|
72
68
|
},
|
|
73
69
|
create(context) {
|
|
74
70
|
const checkLiteral = (node) => {
|
|
75
|
-
var _context$settings$uno;
|
|
76
71
|
if (typeof node.value !== "string" || !node.value.trim()) return;
|
|
77
72
|
const input = node.value;
|
|
78
|
-
syncAction(
|
|
73
|
+
syncAction(context.settings.unocss?.configPath, "blocklist", input, context.filename).forEach(([name, meta]) => {
|
|
79
74
|
context.report({
|
|
80
75
|
node,
|
|
81
76
|
messageId: "in-blocklist",
|
|
82
77
|
data: {
|
|
83
78
|
name,
|
|
84
|
-
reason:
|
|
79
|
+
reason: meta?.message ? `: ${meta.message}` : ""
|
|
85
80
|
}
|
|
86
81
|
});
|
|
87
82
|
});
|
|
@@ -94,8 +89,7 @@ var blocklist_default = createRule({
|
|
|
94
89
|
},
|
|
95
90
|
SvelteAttribute(node) {
|
|
96
91
|
if (node.key.name === "class") {
|
|
97
|
-
|
|
98
|
-
if (((_node$value = node.value) === null || _node$value === void 0 ? void 0 : _node$value[0].type) === "SvelteLiteral") checkLiteral(node.value[0]);
|
|
92
|
+
if (node.value?.[0].type === "SvelteLiteral") checkLiteral(node.value[0]);
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
95
|
};
|
|
@@ -106,30 +100,26 @@ var blocklist_default = createRule({
|
|
|
106
100
|
}
|
|
107
101
|
},
|
|
108
102
|
VStartTag(node) {
|
|
109
|
-
const valueless = node.attributes.filter((i) =>
|
|
110
|
-
var _i$key, _i$key2;
|
|
111
|
-
return typeof ((_i$key = i.key) === null || _i$key === void 0 ? void 0 : _i$key.name) === "string" && !IGNORE_ATTRIBUTES.includes((_i$key2 = i.key) === null || _i$key2 === void 0 || (_i$key2 = _i$key2.name) === null || _i$key2 === void 0 ? void 0 : _i$key2.toLowerCase()) && i.value == null;
|
|
112
|
-
});
|
|
103
|
+
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
113
104
|
if (!valueless.length) return;
|
|
114
105
|
for (const node of valueless) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
syncAction((_context$settings$uno2 = context.settings.unocss) === null || _context$settings$uno2 === void 0 ? void 0 : _context$settings$uno2.configPath, "blocklist", node.key.name, context.filename).forEach(([name, meta]) => {
|
|
106
|
+
if (!node?.key?.name) continue;
|
|
107
|
+
syncAction(context.settings.unocss?.configPath, "blocklist", node.key.name, context.filename).forEach(([name, meta]) => {
|
|
118
108
|
context.report({
|
|
119
109
|
node,
|
|
120
110
|
messageId: "in-blocklist",
|
|
121
111
|
data: {
|
|
122
112
|
name,
|
|
123
|
-
reason:
|
|
113
|
+
reason: meta?.message ? `: ${meta.message}` : ""
|
|
124
114
|
}
|
|
125
115
|
});
|
|
126
116
|
});
|
|
127
117
|
}
|
|
128
118
|
}
|
|
129
119
|
};
|
|
130
|
-
const parserServices =
|
|
120
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
131
121
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
132
|
-
else return parserServices
|
|
122
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
133
123
|
}
|
|
134
124
|
});
|
|
135
125
|
//#endregion
|
|
@@ -207,9 +197,9 @@ var enforce_class_compile_default = createRule({
|
|
|
207
197
|
});
|
|
208
198
|
}
|
|
209
199
|
};
|
|
210
|
-
const parserServices =
|
|
200
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
211
201
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
212
|
-
else return parserServices
|
|
202
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
213
203
|
}
|
|
214
204
|
});
|
|
215
205
|
//#endregion
|
|
@@ -252,10 +242,9 @@ const plugin = { rules: {
|
|
|
252
242
|
return unoVariablesRegexes.some((reg) => reg.test(name));
|
|
253
243
|
}
|
|
254
244
|
function checkLiteral(node, addSpace) {
|
|
255
|
-
var _context$settings$uno;
|
|
256
245
|
if (typeof node.value !== "string" || !node.value.trim()) return;
|
|
257
246
|
const input = node.value;
|
|
258
|
-
let sorted = syncAction(
|
|
247
|
+
let sorted = syncAction(context.settings.unocss?.configPath, "sort", input, context.filename).trim();
|
|
259
248
|
if (addSpace === "before") sorted = ` ${sorted}`;
|
|
260
249
|
else if (addSpace === "after") sorted += " ";
|
|
261
250
|
if (sorted !== input) {
|
|
@@ -277,7 +266,6 @@ const plugin = { rules: {
|
|
|
277
266
|
}
|
|
278
267
|
}
|
|
279
268
|
function checkTemplateElement(quasi) {
|
|
280
|
-
var _context$settings$uno2;
|
|
281
269
|
const input = quasi.value.raw;
|
|
282
270
|
if (!input) return;
|
|
283
271
|
const getRange = () => {
|
|
@@ -291,7 +279,7 @@ const plugin = { rules: {
|
|
|
291
279
|
return [start, end];
|
|
292
280
|
};
|
|
293
281
|
if (!getRange()) return;
|
|
294
|
-
let sorted = syncAction(
|
|
282
|
+
let sorted = syncAction(context.settings.unocss?.configPath, "sort", input, context.filename).trim();
|
|
295
283
|
if (/^\s/.test(input)) sorted = ` ${sorted}`;
|
|
296
284
|
if (/\s$/.test(input)) sorted += " ";
|
|
297
285
|
if (sorted !== input) context.report({
|
|
@@ -348,10 +336,7 @@ const plugin = { rules: {
|
|
|
348
336
|
}
|
|
349
337
|
node.value.forEach((obj, i) => {
|
|
350
338
|
if (obj.type === "SvelteMustacheTag") checkExpressionRecursively(obj.expression);
|
|
351
|
-
else if (obj.type === "SvelteLiteral")
|
|
352
|
-
var _node$value, _node$value2;
|
|
353
|
-
checkLiteral(obj, ((_node$value = node.value) === null || _node$value === void 0 || (_node$value = _node$value[i - 1]) === null || _node$value === void 0 ? void 0 : _node$value.type) === "SvelteMustacheTag" ? "before" : ((_node$value2 = node.value) === null || _node$value2 === void 0 || (_node$value2 = _node$value2[i + 1]) === null || _node$value2 === void 0 ? void 0 : _node$value2.type) === "SvelteMustacheTag" ? "after" : void 0);
|
|
354
|
-
}
|
|
339
|
+
else if (obj.type === "SvelteLiteral") checkLiteral(obj, node.value?.[i - 1]?.type === "SvelteMustacheTag" ? "before" : node.value?.[i + 1]?.type === "SvelteMustacheTag" ? "after" : void 0);
|
|
355
340
|
});
|
|
356
341
|
}
|
|
357
342
|
},
|
|
@@ -395,9 +380,9 @@ const plugin = { rules: {
|
|
|
395
380
|
if (node.value.type === "VLiteral") checkLiteral(node.value);
|
|
396
381
|
}
|
|
397
382
|
} };
|
|
398
|
-
const parserServices =
|
|
383
|
+
const parserServices = context?.sourceCode.parserServices || context.parserServices;
|
|
399
384
|
if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
|
|
400
|
-
else return parserServices
|
|
385
|
+
else return parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
401
386
|
}
|
|
402
387
|
}),
|
|
403
388
|
"order-attributify": order_attributify_default,
|
|
@@ -405,15 +390,6 @@ const plugin = { rules: {
|
|
|
405
390
|
"enforce-class-compile": enforce_class_compile_default
|
|
406
391
|
} };
|
|
407
392
|
//#endregion
|
|
408
|
-
//#region src/configs/flat.ts
|
|
409
|
-
const flatConfig = {
|
|
410
|
-
plugins: { unocss: plugin },
|
|
411
|
-
rules: {
|
|
412
|
-
"unocss/order": "warn",
|
|
413
|
-
"unocss/order-attributify": "warn"
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
//#endregion
|
|
417
393
|
//#region src/index.ts
|
|
418
394
|
const configs = {
|
|
419
395
|
recommended: {
|
|
@@ -423,7 +399,13 @@ const configs = {
|
|
|
423
399
|
"@unocss/order-attributify": "warn"
|
|
424
400
|
}
|
|
425
401
|
},
|
|
426
|
-
flat:
|
|
402
|
+
flat: {
|
|
403
|
+
plugins: { unocss: plugin },
|
|
404
|
+
rules: {
|
|
405
|
+
"unocss/order": "warn",
|
|
406
|
+
"unocss/order-attributify": "warn"
|
|
407
|
+
}
|
|
408
|
+
}
|
|
427
409
|
};
|
|
428
410
|
const eslintPlugin = {
|
|
429
411
|
...plugin,
|
package/dist/worker.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dirname } from "node:path";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import { collapseVariantGroup, createGenerator, notNull, parseVariantGroup } from "@unocss/core";
|
|
4
3
|
import { loadConfig } from "@unocss/config";
|
|
4
|
+
import { collapseVariantGroup, createGenerator, notNull, parseVariantGroup } from "@unocss/core";
|
|
5
5
|
import { runAsWorker } from "synckit";
|
|
6
6
|
//#region ../../virtual-shared/integration/src/sort-rules.ts
|
|
7
7
|
async function sortRules(rules, uno) {
|
|
@@ -12,7 +12,6 @@ async function sortRules(rules, uno) {
|
|
|
12
12
|
const result = [];
|
|
13
13
|
const arr = rules.split(/\s+/g);
|
|
14
14
|
for (const i of arr) {
|
|
15
|
-
var _token$0$;
|
|
16
15
|
if (!i) continue;
|
|
17
16
|
const token = await uno.parseToken(i);
|
|
18
17
|
if (token == null) {
|
|
@@ -20,7 +19,7 @@ async function sortRules(rules, uno) {
|
|
|
20
19
|
result.push(void 0);
|
|
21
20
|
continue;
|
|
22
21
|
}
|
|
23
|
-
const variantRank = (
|
|
22
|
+
const variantRank = (token[0][5]?.variantHandlers?.length || 0) * 1e5;
|
|
24
23
|
const order = token[0][0] + variantRank;
|
|
25
24
|
result.push([order, i]);
|
|
26
25
|
}
|
|
@@ -29,14 +28,13 @@ async function sortRules(rules, uno) {
|
|
|
29
28
|
if (result === 0) result = a[1].localeCompare(b[1]);
|
|
30
29
|
return result;
|
|
31
30
|
}).map((i) => i[1]).join(" ");
|
|
32
|
-
if (expandedResult
|
|
31
|
+
if (expandedResult?.prefixes.length) sorted = collapseVariantGroup(sorted, expandedResult.prefixes);
|
|
33
32
|
return [...unknown, sorted].join(" ").trim();
|
|
34
33
|
}
|
|
35
34
|
//#endregion
|
|
36
35
|
//#region src/worker.ts
|
|
37
|
-
var _process$env;
|
|
38
36
|
const promises = /* @__PURE__ */ new Map();
|
|
39
|
-
|
|
37
|
+
process.env.ESLINT ||= "true";
|
|
40
38
|
function getSearchCwd(id) {
|
|
41
39
|
if (id.match(/\.\w+\/[^/]+$/)) return dirname(id.slice(0, id.lastIndexOf("/")));
|
|
42
40
|
return dirname(id);
|
|
@@ -75,7 +73,7 @@ async function actionBlocklist(configPath, classes, id) {
|
|
|
75
73
|
const blocked = /* @__PURE__ */ new Map();
|
|
76
74
|
const values = [...(await uno.applyExtractors(classes, id)).values()];
|
|
77
75
|
const getMeta = (raw, meta) => {
|
|
78
|
-
return
|
|
76
|
+
return meta?.message ? {
|
|
79
77
|
...meta,
|
|
80
78
|
message: typeof meta.message === "function" ? meta.message(raw) : meta.message
|
|
81
79
|
} : meta;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/eslint-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.
|
|
4
|
+
"version": "66.7.0-beta.1",
|
|
5
5
|
"description": "ESLint plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -42,20 +42,17 @@
|
|
|
42
42
|
"files": [
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=14"
|
|
47
|
-
},
|
|
48
45
|
"dependencies": {
|
|
49
|
-
"@typescript-eslint/utils": "^8.
|
|
46
|
+
"@typescript-eslint/utils": "^8.59.3",
|
|
50
47
|
"magic-string": "^0.30.21",
|
|
51
48
|
"synckit": "^0.11.12",
|
|
52
|
-
"@unocss/config": "66.
|
|
53
|
-
"@unocss/core": "66.
|
|
54
|
-
"@unocss/rule-utils": "66.
|
|
49
|
+
"@unocss/config": "66.7.0-beta.1",
|
|
50
|
+
"@unocss/core": "66.7.0-beta.1",
|
|
51
|
+
"@unocss/rule-utils": "66.7.0-beta.1"
|
|
55
52
|
},
|
|
56
53
|
"devDependencies": {
|
|
57
|
-
"@typescript/native-preview": "
|
|
58
|
-
"svelte-eslint-parser": "^1.6.
|
|
54
|
+
"@typescript/native-preview": "7.0.0-dev.20260514.1",
|
|
55
|
+
"svelte-eslint-parser": "^1.6.1",
|
|
59
56
|
"vue-eslint-parser": "^10.4.0"
|
|
60
57
|
},
|
|
61
58
|
"scripts": {
|