@unocss/eslint-plugin 66.6.6 → 66.6.8

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 CHANGED
@@ -1,5 +1,8 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ //#region \0rolldown/runtime.js
3
6
  var __create = Object.create;
4
7
  var __defProp = Object.defineProperty;
5
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,16 +10,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
10
  var __getProtoOf = Object.getPrototypeOf;
8
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
12
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
20
19
  }
21
20
  return to;
22
21
  };
@@ -24,29 +23,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
23
  value: mod,
25
24
  enumerable: true
26
25
  }) : target, mod));
27
-
28
26
  //#endregion
29
27
  let node_path = require("node:path");
30
- let _typescript_eslint_utils = require("@typescript-eslint/utils");
28
+ let _typescript_eslint_utils_eslint_utils = require("@typescript-eslint/utils/eslint-utils");
31
29
  let synckit = require("synckit");
32
30
  let node_url = require("node:url");
33
31
  let magic_string = require("magic-string");
34
32
  magic_string = __toESM(magic_string);
35
33
  let _typescript_eslint_types = require("@typescript-eslint/types");
36
-
37
34
  //#region src/constants.ts
38
35
  const CLASS_FIELDS = ["class", "classname"];
39
36
  const AST_NODES_WITH_QUOTES = ["Literal", "VLiteral"];
40
-
41
37
  //#endregion
42
38
  //#region src/dirs.ts
43
39
  const distDir = (0, node_url.fileURLToPath)(new URL("../dist", require("url").pathToFileURL(__filename).href));
44
-
45
40
  //#endregion
46
41
  //#region src/rules/_.ts
47
42
  const syncAction = (0, synckit.createSyncFn)((0, node_path.join)(distDir, "worker.mjs"));
48
- const createRule = _typescript_eslint_utils.ESLintUtils.RuleCreator(() => "https://unocss.dev/integrations/eslint#rules");
49
-
43
+ const createRule = (0, _typescript_eslint_utils_eslint_utils.RuleCreator)(() => "https://unocss.dev/integrations/eslint#rules");
50
44
  //#endregion
51
45
  //#region src/rules/order-attributify.ts
52
46
  const IGNORE_ATTRIBUTES = [
@@ -62,9 +56,9 @@ var order_attributify_default = createRule({
62
56
  fixable: "code",
63
57
  docs: { description: "Order of UnoCSS attributes" },
64
58
  messages: { "invalid-order": "UnoCSS attributes are not ordered" },
65
- schema: []
59
+ schema: [],
60
+ defaultOptions: []
66
61
  },
67
- defaultOptions: [],
68
62
  create(context) {
69
63
  const scriptVisitor = {};
70
64
  const templateBodyVisitor = { VStartTag(node) {
@@ -94,7 +88,6 @@ var order_attributify_default = createRule({
94
88
  else return parserServices === null || parserServices === void 0 ? void 0 : parserServices.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
95
89
  }
96
90
  });
97
-
98
91
  //#endregion
99
92
  //#region src/rules/blocklist.ts
100
93
  var blocklist_default = createRule({
@@ -104,9 +97,9 @@ var blocklist_default = createRule({
104
97
  fixable: "code",
105
98
  docs: { description: "Utilities in UnoCSS blocklist" },
106
99
  messages: { "in-blocklist": "\"{{name}}\" is in blocklist{{reason}}" },
107
- schema: []
100
+ schema: [],
101
+ defaultOptions: []
108
102
  },
109
- defaultOptions: [],
110
103
  create(context) {
111
104
  const checkLiteral = (node) => {
112
105
  var _context$settings$uno;
@@ -148,12 +141,12 @@ var blocklist_default = createRule({
148
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;
149
142
  });
150
143
  if (!valueless.length) return;
151
- for (const node$1 of valueless) {
144
+ for (const node of valueless) {
152
145
  var _node$key, _context$settings$uno2;
153
- if (!(node$1 === null || node$1 === void 0 || (_node$key = node$1.key) === null || _node$key === void 0 ? void 0 : _node$key.name)) continue;
154
- syncAction((_context$settings$uno2 = context.settings.unocss) === null || _context$settings$uno2 === void 0 ? void 0 : _context$settings$uno2.configPath, "blocklist", node$1.key.name, context.filename).forEach(([name, meta]) => {
146
+ if (!(node === null || node === void 0 || (_node$key = node.key) === null || _node$key === void 0 ? void 0 : _node$key.name)) continue;
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]) => {
155
148
  context.report({
156
- node: node$1,
149
+ node,
157
150
  messageId: "in-blocklist",
158
151
  data: {
159
152
  name,
@@ -169,7 +162,6 @@ var blocklist_default = createRule({
169
162
  else return parserServices === null || parserServices === void 0 ? void 0 : parserServices.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
170
163
  }
171
164
  });
172
-
173
165
  //#endregion
174
166
  //#region src/rules/enforce-class-compile.ts
175
167
  var enforce_class_compile_default = createRule({
@@ -186,12 +178,12 @@ var enforce_class_compile_default = createRule({
186
178
  enableFix: { type: "boolean" }
187
179
  },
188
180
  additionalProperties: false
181
+ }],
182
+ defaultOptions: [{
183
+ prefix: ":uno:",
184
+ enableFix: true
189
185
  }]
190
186
  },
191
- defaultOptions: [{
192
- prefix: ":uno:",
193
- enableFix: true
194
- }],
195
187
  create(context, [mergedOptions]) {
196
188
  const CLASS_COMPILE_PREFIX = `${mergedOptions.prefix} `;
197
189
  const ENABLE_FIX = mergedOptions.enableFix;
@@ -250,235 +242,223 @@ var enforce_class_compile_default = createRule({
250
242
  else return parserServices === null || parserServices === void 0 ? void 0 : parserServices.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
251
243
  }
252
244
  });
253
-
254
245
  //#endregion
255
- //#region src/rules/order.ts
256
- var order_default = createRule({
257
- name: "order",
258
- meta: {
259
- type: "layout",
260
- fixable: "code",
261
- docs: { description: "Order of UnoCSS utilities in class attribute" },
262
- messages: { "invalid-order": "UnoCSS utilities are not ordered" },
263
- schema: [{
264
- type: "object",
265
- properties: {
266
- unoFunctions: {
267
- type: "array",
268
- items: { type: "string" }
246
+ //#region src/plugin.ts
247
+ const plugin = { rules: {
248
+ order: createRule({
249
+ name: "order",
250
+ meta: {
251
+ type: "layout",
252
+ fixable: "code",
253
+ docs: { description: "Order of UnoCSS utilities in class attribute" },
254
+ messages: { "invalid-order": "UnoCSS utilities are not ordered" },
255
+ schema: [{
256
+ type: "object",
257
+ properties: {
258
+ unoFunctions: {
259
+ type: "array",
260
+ items: { type: "string" }
261
+ },
262
+ unoVariables: {
263
+ type: "array",
264
+ items: { type: "string" }
265
+ }
269
266
  },
270
- unoVariables: {
271
- type: "array",
272
- items: { type: "string" }
267
+ additionalProperties: false
268
+ }],
269
+ defaultOptions: [{
270
+ unoFunctions: ["clsx", "classnames"],
271
+ unoVariables: ["^cls", "classNames?$"]
272
+ }]
273
+ },
274
+ create(context) {
275
+ let { unoFunctions = ["clsx", "classnames"], unoVariables = ["^cls", "classNames?$"] } = context.options[0] || {};
276
+ unoFunctions = unoFunctions.map((name) => name.toLowerCase());
277
+ function isUnoFunction(name) {
278
+ return unoFunctions.includes(name.toLowerCase());
279
+ }
280
+ const unoVariablesRegexes = unoVariables.map((regex) => new RegExp(regex, "i"));
281
+ function isUnoVariable(name) {
282
+ return unoVariablesRegexes.some((reg) => reg.test(name));
283
+ }
284
+ function checkLiteral(node, addSpace) {
285
+ var _context$settings$uno;
286
+ if (typeof node.value !== "string" || !node.value.trim()) return;
287
+ const input = node.value;
288
+ let sorted = syncAction((_context$settings$uno = context.settings.unocss) === null || _context$settings$uno === void 0 ? void 0 : _context$settings$uno.configPath, "sort", input, context.filename).trim();
289
+ if (addSpace === "before") sorted = ` ${sorted}`;
290
+ else if (addSpace === "after") sorted += " ";
291
+ if (sorted !== input) {
292
+ const nodeOrToken = node.type === "SvelteLiteral" ? {
293
+ type: _typescript_eslint_types.AST_TOKEN_TYPES.String,
294
+ value: node.value,
295
+ loc: node.loc,
296
+ range: node.range
297
+ } : node;
298
+ context.report({
299
+ node: nodeOrToken,
300
+ loc: node.loc,
301
+ messageId: "invalid-order",
302
+ fix(fixer) {
303
+ if (AST_NODES_WITH_QUOTES.includes(node.type)) return fixer.replaceTextRange([node.range[0] + 1, node.range[1] - 1], sorted);
304
+ else return fixer.replaceText(nodeOrToken, sorted);
305
+ }
306
+ });
273
307
  }
274
- },
275
- additionalProperties: false
276
- }]
277
- },
278
- defaultOptions: [{
279
- unoFunctions: ["clsx", "classnames"],
280
- unoVariables: ["^cls", "classNames?$"]
281
- }],
282
- create(context) {
283
- let { unoFunctions = ["clsx", "classnames"], unoVariables = ["^cls", "classNames?$"] } = context.options[0] || {};
284
- unoFunctions = unoFunctions.map((name) => name.toLowerCase());
285
- function isUnoFunction(name) {
286
- return unoFunctions.includes(name.toLowerCase());
287
- }
288
- const unoVariablesRegexes = unoVariables.map((regex) => new RegExp(regex, "i"));
289
- function isUnoVariable(name) {
290
- return unoVariablesRegexes.some((reg) => reg.test(name));
291
- }
292
- function checkLiteral(node, addSpace) {
293
- var _context$settings$uno;
294
- if (typeof node.value !== "string" || !node.value.trim()) return;
295
- const input = node.value;
296
- let sorted = syncAction((_context$settings$uno = context.settings.unocss) === null || _context$settings$uno === void 0 ? void 0 : _context$settings$uno.configPath, "sort", input, context.filename).trim();
297
- if (addSpace === "before") sorted = ` ${sorted}`;
298
- else if (addSpace === "after") sorted += " ";
299
- if (sorted !== input) {
300
- const nodeOrToken = node.type === "SvelteLiteral" ? {
301
- type: _typescript_eslint_types.AST_TOKEN_TYPES.String,
302
- value: node.value,
303
- loc: node.loc,
304
- range: node.range
305
- } : node;
306
- context.report({
307
- node: nodeOrToken,
308
- loc: node.loc,
308
+ }
309
+ function checkTemplateElement(quasi) {
310
+ var _context$settings$uno2;
311
+ const input = quasi.value.raw;
312
+ if (!input) return;
313
+ const getRange = () => {
314
+ const text = context.sourceCode.getText(quasi);
315
+ const raw = quasi.value.raw;
316
+ if (!text.includes(raw)) return;
317
+ const rawStart = text.indexOf(raw);
318
+ const start = quasi.range[0] + rawStart;
319
+ const end = quasi.range[0] + rawStart + raw.length;
320
+ if (start < quasi.range[0] || end > quasi.range[1]) return;
321
+ return [start, end];
322
+ };
323
+ if (!getRange()) return;
324
+ let sorted = syncAction((_context$settings$uno2 = context.settings.unocss) === null || _context$settings$uno2 === void 0 ? void 0 : _context$settings$uno2.configPath, "sort", input, context.filename).trim();
325
+ if (/^\s/.test(input)) sorted = ` ${sorted}`;
326
+ if (/\s$/.test(input)) sorted += " ";
327
+ if (sorted !== input) context.report({
328
+ node: quasi,
329
+ loc: quasi.loc,
309
330
  messageId: "invalid-order",
310
331
  fix(fixer) {
311
- if (AST_NODES_WITH_QUOTES.includes(node.type)) return fixer.replaceTextRange([node.range[0] + 1, node.range[1] - 1], sorted);
312
- else return fixer.replaceText(nodeOrToken, sorted);
332
+ const realRange = getRange();
333
+ if (!realRange) return null;
334
+ return fixer.replaceTextRange(realRange, sorted);
313
335
  }
314
336
  });
315
337
  }
316
- }
317
- function checkTemplateElement(quasi) {
318
- var _context$settings$uno2;
319
- const input = quasi.value.raw;
320
- if (!input) return;
321
- const getRange = () => {
322
- const text = context.sourceCode.getText(quasi);
323
- const raw = quasi.value.raw;
324
- if (!text.includes(raw)) return;
325
- const rawStart = text.indexOf(raw);
326
- const start = quasi.range[0] + rawStart;
327
- const end = quasi.range[0] + rawStart + raw.length;
328
- if (start < quasi.range[0] || end > quasi.range[1]) return;
329
- return [start, end];
330
- };
331
- if (!getRange()) return;
332
- let sorted = syncAction((_context$settings$uno2 = context.settings.unocss) === null || _context$settings$uno2 === void 0 ? void 0 : _context$settings$uno2.configPath, "sort", input, context.filename).trim();
333
- if (/^\s/.test(input)) sorted = ` ${sorted}`;
334
- if (/\s$/.test(input)) sorted += " ";
335
- if (sorted !== input) context.report({
336
- node: quasi,
337
- loc: quasi.loc,
338
- messageId: "invalid-order",
339
- fix(fixer) {
340
- const realRange = getRange();
341
- if (!realRange) return null;
342
- return fixer.replaceTextRange(realRange, sorted);
343
- }
344
- });
345
- }
346
- function isPossibleLiteral(node) {
347
- return node.type === "Literal" || node.type === "TemplateLiteral" || node.type === "TaggedTemplateExpression";
348
- }
349
- function checkPossibleLiteral(...nodes) {
350
- nodes.forEach((node) => {
351
- if (!isPossibleLiteral(node)) return;
352
- if (node.type === "Literal" && typeof node.value === "string") return checkLiteral(node);
353
- const isSimpleTemplateLiteral = (node$1) => {
354
- return node$1.expressions.length === 0 && node$1.quasis.length === 1;
355
- };
356
- if (node.type === "TemplateLiteral" && isSimpleTemplateLiteral(node)) return checkTemplateElement(node.quasis[0]);
357
- const isStringRaw = (tag) => {
358
- return tag.type === "MemberExpression" && tag.object.type === "Identifier" && tag.object.name === "String" && tag.property.type === "Identifier" && tag.property.name === "raw";
359
- };
360
- if (node.type === "TaggedTemplateExpression" && isStringRaw(node.tag) && isSimpleTemplateLiteral(node.quasi)) return checkTemplateElement(node.quasi.quasis[0]);
361
- if (node.type === "TemplateLiteral" && node.expressions.length > 0 && node.quasis.length > 0) {
362
- node.quasis.forEach((quasi) => {
363
- checkTemplateElement(quasi);
364
- });
365
- return;
366
- }
367
- });
368
- }
369
- const scriptVisitor = {
370
- JSXAttribute(node) {
371
- if (typeof node.name.name === "string" && CLASS_FIELDS.includes(node.name.name.toLowerCase()) && node.value) {
372
- if (isPossibleLiteral(node.value)) return checkPossibleLiteral(node.value);
373
- else if (node.value.type === "JSXExpressionContainer" && isPossibleLiteral(node.value.expression)) return checkPossibleLiteral(node.value.expression);
374
- }
375
- },
376
- SvelteAttribute(node) {
377
- if (node.key.name === "class") {
378
- if (!node.value.length) return;
379
- function checkExpressionRecursively(expression) {
380
- if (expression.type !== "ConditionalExpression") return;
381
- if (expression.consequent.type === "Literal") checkLiteral(expression.consequent);
382
- if (expression.alternate) {
383
- if (expression.alternate.type === "ConditionalExpression") checkExpressionRecursively(expression.alternate);
384
- else if (expression.alternate.type === "Literal") checkLiteral(expression.alternate);
338
+ function isPossibleLiteral(node) {
339
+ return node.type === "Literal" || node.type === "TemplateLiteral" || node.type === "TaggedTemplateExpression";
340
+ }
341
+ function checkPossibleLiteral(...nodes) {
342
+ nodes.forEach((node) => {
343
+ if (!isPossibleLiteral(node)) return;
344
+ if (node.type === "Literal" && typeof node.value === "string") return checkLiteral(node);
345
+ const isSimpleTemplateLiteral = (node) => {
346
+ return node.expressions.length === 0 && node.quasis.length === 1;
347
+ };
348
+ if (node.type === "TemplateLiteral" && isSimpleTemplateLiteral(node)) return checkTemplateElement(node.quasis[0]);
349
+ const isStringRaw = (tag) => {
350
+ return tag.type === "MemberExpression" && tag.object.type === "Identifier" && tag.object.name === "String" && tag.property.type === "Identifier" && tag.property.name === "raw";
351
+ };
352
+ if (node.type === "TaggedTemplateExpression" && isStringRaw(node.tag) && isSimpleTemplateLiteral(node.quasi)) return checkTemplateElement(node.quasi.quasis[0]);
353
+ if (node.type === "TemplateLiteral" && node.expressions.length > 0 && node.quasis.length > 0) {
354
+ node.quasis.forEach((quasi) => {
355
+ checkTemplateElement(quasi);
356
+ });
357
+ return;
358
+ }
359
+ });
360
+ }
361
+ const scriptVisitor = {
362
+ JSXAttribute(node) {
363
+ if (typeof node.name.name === "string" && CLASS_FIELDS.includes(node.name.name.toLowerCase()) && node.value) {
364
+ if (isPossibleLiteral(node.value)) return checkPossibleLiteral(node.value);
365
+ else if (node.value.type === "JSXExpressionContainer" && isPossibleLiteral(node.value.expression)) return checkPossibleLiteral(node.value.expression);
366
+ }
367
+ },
368
+ SvelteAttribute(node) {
369
+ if (node.key.name === "class") {
370
+ if (!node.value.length) return;
371
+ function checkExpressionRecursively(expression) {
372
+ if (expression.type !== "ConditionalExpression") return;
373
+ if (expression.consequent.type === "Literal") checkLiteral(expression.consequent);
374
+ if (expression.alternate) {
375
+ if (expression.alternate.type === "ConditionalExpression") checkExpressionRecursively(expression.alternate);
376
+ else if (expression.alternate.type === "Literal") checkLiteral(expression.alternate);
377
+ }
385
378
  }
379
+ node.value.forEach((obj, i) => {
380
+ 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
+ }
385
+ });
386
386
  }
387
- node.value.forEach((obj, i) => {
388
- if (obj.type === "SvelteMustacheTag") checkExpressionRecursively(obj.expression);
389
- else if (obj.type === "SvelteLiteral") {
390
- var _node$value, _node$value2;
391
- 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);
387
+ },
388
+ CallExpression(node) {
389
+ if (!(node.callee.type === "Identifier" && isUnoFunction(node.callee.name))) return;
390
+ node.arguments.forEach((arg) => {
391
+ if (isPossibleLiteral(arg)) return checkPossibleLiteral(arg);
392
+ if (arg.type === "ConditionalExpression") return checkPossibleLiteral(arg.consequent, arg.alternate);
393
+ if (arg.type === "LogicalExpression") return checkPossibleLiteral(arg.left, arg.right);
394
+ function handleObjectExpression(node) {
395
+ node.properties.forEach((p) => {
396
+ if (p.type !== "Property") return;
397
+ if (isPossibleLiteral(p.value)) return checkPossibleLiteral(p.value);
398
+ if (p.value.type === "ObjectExpression") return handleObjectExpression(p.value);
399
+ });
400
+ return checkPossibleLiteral(...node.properties.filter((p) => p.type === "Property").map((p) => p.key));
392
401
  }
402
+ if (arg.type === "ObjectExpression") return handleObjectExpression(arg);
403
+ if (arg.type === "ArrayExpression") return arg.elements.forEach((element) => {
404
+ if (element && isPossibleLiteral(element)) return checkPossibleLiteral(element);
405
+ });
393
406
  });
394
- }
395
- },
396
- CallExpression(node) {
397
- if (!(node.callee.type === "Identifier" && isUnoFunction(node.callee.name))) return;
398
- node.arguments.forEach((arg) => {
399
- if (isPossibleLiteral(arg)) return checkPossibleLiteral(arg);
400
- if (arg.type === "ConditionalExpression") return checkPossibleLiteral(arg.consequent, arg.alternate);
401
- if (arg.type === "LogicalExpression") return checkPossibleLiteral(arg.left, arg.right);
402
- function handleObjectExpression(node$1) {
403
- node$1.properties.forEach((p) => {
407
+ },
408
+ VariableDeclarator(node) {
409
+ if (node.id.type !== "Identifier" || !node.init || !isUnoVariable(node.id.name)) return;
410
+ if (isPossibleLiteral(node.init)) return checkPossibleLiteral(node.init);
411
+ if (node.init.type === "TSAsExpression" && isPossibleLiteral(node.init.expression)) return checkPossibleLiteral(node.init.expression);
412
+ function handleObjectExpression(node) {
413
+ node.properties.forEach((p) => {
404
414
  if (p.type !== "Property") return;
405
415
  if (isPossibleLiteral(p.value)) return checkPossibleLiteral(p.value);
406
416
  if (p.value.type === "ObjectExpression") return handleObjectExpression(p.value);
407
417
  });
408
- return checkPossibleLiteral(...node$1.properties.filter((p) => p.type === "Property").map((p) => p.key));
409
418
  }
410
- if (arg.type === "ObjectExpression") return handleObjectExpression(arg);
411
- if (arg.type === "ArrayExpression") return arg.elements.forEach((element) => {
412
- if (element && isPossibleLiteral(element)) return checkPossibleLiteral(element);
413
- });
414
- });
415
- },
416
- VariableDeclarator(node) {
417
- if (node.id.type !== "Identifier" || !node.init || !isUnoVariable(node.id.name)) return;
418
- if (isPossibleLiteral(node.init)) return checkPossibleLiteral(node.init);
419
- if (node.init.type === "TSAsExpression" && isPossibleLiteral(node.init.expression)) return checkPossibleLiteral(node.init.expression);
420
- function handleObjectExpression(node$1) {
421
- node$1.properties.forEach((p) => {
422
- if (p.type !== "Property") return;
423
- if (isPossibleLiteral(p.value)) return checkPossibleLiteral(p.value);
424
- if (p.value.type === "ObjectExpression") return handleObjectExpression(p.value);
425
- });
419
+ if (node.init.type === "ObjectExpression") return handleObjectExpression(node.init);
420
+ if (node.init.type === "TSAsExpression" && node.init.expression.type === "ObjectExpression") return handleObjectExpression(node.init.expression);
426
421
  }
427
- if (node.init.type === "ObjectExpression") return handleObjectExpression(node.init);
428
- if (node.init.type === "TSAsExpression" && node.init.expression.type === "ObjectExpression") return handleObjectExpression(node.init.expression);
429
- }
430
- };
431
- const templateBodyVisitor = { VAttribute(node) {
432
- if (node.key.name === "class") {
433
- if (node.value.type === "VLiteral") checkLiteral(node.value);
434
- }
435
- } };
436
- const parserServices = (context === null || context === void 0 ? void 0 : context.sourceCode.parserServices) || context.parserServices;
437
- if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
438
- else return parserServices === null || parserServices === void 0 ? void 0 : parserServices.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
439
- }
440
- });
441
-
442
- //#endregion
443
- //#region src/plugin.ts
444
- const plugin = { rules: {
445
- order: order_default,
422
+ };
423
+ const templateBodyVisitor = { VAttribute(node) {
424
+ if (node.key.name === "class") {
425
+ if (node.value.type === "VLiteral") checkLiteral(node.value);
426
+ }
427
+ } };
428
+ const parserServices = (context === null || context === void 0 ? void 0 : context.sourceCode.parserServices) || context.parserServices;
429
+ if (parserServices == null || parserServices.defineTemplateBodyVisitor == null) return scriptVisitor;
430
+ else return parserServices === null || parserServices === void 0 ? void 0 : parserServices.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
431
+ }
432
+ }),
446
433
  "order-attributify": order_attributify_default,
447
434
  blocklist: blocklist_default,
448
435
  "enforce-class-compile": enforce_class_compile_default
449
436
  } };
450
-
451
437
  //#endregion
452
438
  //#region src/configs/flat.ts
453
- var flat_default = {
439
+ const flatConfig = {
454
440
  plugins: { unocss: plugin },
455
441
  rules: {
456
442
  "unocss/order": "warn",
457
443
  "unocss/order-attributify": "warn"
458
444
  }
459
445
  };
460
-
461
- //#endregion
462
- //#region src/configs/recommended.ts
463
- var recommended_default = {
464
- plugins: ["@unocss"],
465
- rules: {
466
- "@unocss/order": "warn",
467
- "@unocss/order-attributify": "warn"
468
- }
469
- };
470
-
471
446
  //#endregion
472
447
  //#region src/index.ts
473
448
  const configs = {
474
- recommended: recommended_default,
475
- flat: flat_default
449
+ recommended: {
450
+ plugins: ["@unocss"],
451
+ rules: {
452
+ "@unocss/order": "warn",
453
+ "@unocss/order-attributify": "warn"
454
+ }
455
+ },
456
+ flat: flatConfig
476
457
  };
477
- var src_default = {
458
+ const eslintPlugin = {
478
459
  ...plugin,
479
460
  configs
480
461
  };
481
-
482
462
  //#endregion
483
463
  exports.configs = configs;
484
- exports.default = src_default;
464
+ exports.default = eslintPlugin;