@unocss/eslint-plugin 0.49.3 → 0.49.5

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
@@ -90,7 +90,7 @@ const orderAttributify = utils.ESLintUtils.RuleCreator((name) => name)({
90
90
  const scriptVisitor = {};
91
91
  const templateBodyVisitor = {
92
92
  VStartTag(node) {
93
- const valueless = node.attributes.filter((i) => !INGORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
93
+ const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !INGORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
94
94
  if (!valueless.length)
95
95
  return;
96
96
  const input = valueless.map((i) => i.key.name).join(" ").trim();
@@ -104,14 +104,9 @@ const orderAttributify = utils.ESLintUtils.RuleCreator((name) => name)({
104
104
  const offset = node.range[0];
105
105
  const code = codeFull.getText().slice(node.range[0], node.range[1]);
106
106
  const s = new MagicString__default(code);
107
- const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => a[0] - b[0]);
108
- for (let [start, end] of sortedNodes.slice(1)) {
109
- if (code[start - 1] === " ")
110
- start--;
111
- if (code[end] === " ")
112
- end++;
107
+ const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => b[0] - a[0]);
108
+ for (const [start, end] of sortedNodes.slice(1))
113
109
  s.remove(start, end);
114
- }
115
110
  s.overwrite(sortedNodes[0][0], sortedNodes[0][1], ` ${sorted.trim()} `);
116
111
  return fixer.replaceText(node, s.toString());
117
112
  }
package/dist/index.mjs CHANGED
@@ -84,7 +84,7 @@ const orderAttributify = ESLintUtils.RuleCreator((name) => name)({
84
84
  const scriptVisitor = {};
85
85
  const templateBodyVisitor = {
86
86
  VStartTag(node) {
87
- const valueless = node.attributes.filter((i) => !INGORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
87
+ const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !INGORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
88
88
  if (!valueless.length)
89
89
  return;
90
90
  const input = valueless.map((i) => i.key.name).join(" ").trim();
@@ -98,14 +98,9 @@ const orderAttributify = ESLintUtils.RuleCreator((name) => name)({
98
98
  const offset = node.range[0];
99
99
  const code = codeFull.getText().slice(node.range[0], node.range[1]);
100
100
  const s = new MagicString(code);
101
- const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => a[0] - b[0]);
102
- for (let [start, end] of sortedNodes.slice(1)) {
103
- if (code[start - 1] === " ")
104
- start--;
105
- if (code[end] === " ")
106
- end++;
101
+ const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => b[0] - a[0]);
102
+ for (const [start, end] of sortedNodes.slice(1))
107
103
  s.remove(start, end);
108
- }
109
104
  s.overwrite(sortedNodes[0][0], sortedNodes[0][1], ` ${sorted.trim()} `);
110
105
  return fixer.replaceText(node, s.toString());
111
106
  }
@@ -16,7 +16,7 @@ async function sortRules(rules, uno) {
16
16
  unknown.push(i);
17
17
  return void 0;
18
18
  }
19
- const variantRank = (token[0][5]?.variantHandlers?.length || 0) * 1e3;
19
+ const variantRank = (token[0][5]?.variantHandlers?.length || 0) * 1e5;
20
20
  const order = token[0][0] + variantRank;
21
21
  return [order, i];
22
22
  }));
@@ -14,7 +14,7 @@ async function sortRules(rules, uno) {
14
14
  unknown.push(i);
15
15
  return void 0;
16
16
  }
17
- const variantRank = (token[0][5]?.variantHandlers?.length || 0) * 1e3;
17
+ const variantRank = (token[0][5]?.variantHandlers?.length || 0) * 1e5;
18
18
  const order = token[0][0] + variantRank;
19
19
  return [order, i];
20
20
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/eslint-plugin",
3
- "version": "0.49.3",
3
+ "version": "0.49.5",
4
4
  "description": "ESLint plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -36,14 +36,14 @@
36
36
  "node": ">=14"
37
37
  },
38
38
  "dependencies": {
39
- "@typescript-eslint/utils": "^5.50.0",
39
+ "@typescript-eslint/utils": "^5.52.0",
40
40
  "@unocss/config": "^0.49.2",
41
- "@unocss/core": "0.49.3",
41
+ "@unocss/core": "0.49.5",
42
42
  "magic-string": "^0.27.0",
43
43
  "synckit": "^0.8.5"
44
44
  },
45
45
  "devDependencies": {
46
- "@unocss/eslint-plugin": "0.49.3"
46
+ "@unocss/eslint-plugin": "0.49.5"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "unbuild",