@unocss/eslint-plugin 0.56.1 → 0.56.2
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 +80 -65
- package/dist/index.d.cts +22 -7
- package/dist/index.d.mts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.mjs +80 -65
- package/dist/worker.cjs +7 -0
- package/dist/worker.mjs +3 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,21 +1,81 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const utils = require('@typescript-eslint/utils');
|
|
4
|
+
const MagicString = require('magic-string');
|
|
4
5
|
const node_path = require('node:path');
|
|
5
6
|
const synckit = require('synckit');
|
|
6
7
|
const dirs = require('./dirs.cjs');
|
|
7
|
-
const MagicString = require('magic-string');
|
|
8
8
|
require('node:url');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
11
|
|
|
12
12
|
const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const configsRecommended = {
|
|
15
|
+
plugins: ["@unocss"],
|
|
16
|
+
rules: {
|
|
17
|
+
"@unocss/order": "warn",
|
|
18
|
+
"@unocss/order-attributify": "warn"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
16
21
|
|
|
17
22
|
const syncAction = synckit.createSyncFn(node_path.join(dirs.distDir, "worker.cjs"));
|
|
18
23
|
|
|
24
|
+
const IGNORE_ATTRIBUTES = ["style", "class", "classname", "value"];
|
|
25
|
+
const orderAttributify = utils.ESLintUtils.RuleCreator((name) => name)({
|
|
26
|
+
name: "order-attributify",
|
|
27
|
+
meta: {
|
|
28
|
+
type: "layout",
|
|
29
|
+
fixable: "code",
|
|
30
|
+
docs: {
|
|
31
|
+
description: "Order of UnoCSS attributes",
|
|
32
|
+
recommended: "recommended"
|
|
33
|
+
},
|
|
34
|
+
messages: {
|
|
35
|
+
"invalid-order": "UnoCSS attributes are not ordered"
|
|
36
|
+
},
|
|
37
|
+
schema: []
|
|
38
|
+
},
|
|
39
|
+
defaultOptions: [],
|
|
40
|
+
create(context) {
|
|
41
|
+
const scriptVisitor = {};
|
|
42
|
+
const templateBodyVisitor = {
|
|
43
|
+
VStartTag(node) {
|
|
44
|
+
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
45
|
+
if (!valueless.length)
|
|
46
|
+
return;
|
|
47
|
+
const input = valueless.map((i) => i.key.name).join(" ").trim();
|
|
48
|
+
const sorted = syncAction("sort", input);
|
|
49
|
+
if (sorted !== input) {
|
|
50
|
+
context.report({
|
|
51
|
+
node,
|
|
52
|
+
messageId: "invalid-order",
|
|
53
|
+
fix(fixer) {
|
|
54
|
+
const codeFull = context.getSourceCode();
|
|
55
|
+
const offset = node.range[0];
|
|
56
|
+
const code = codeFull.getText().slice(node.range[0], node.range[1]);
|
|
57
|
+
const s = new MagicString__default(code);
|
|
58
|
+
const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => b[0] - a[0]);
|
|
59
|
+
for (const [start, end] of sortedNodes.slice(1))
|
|
60
|
+
s.remove(start, end);
|
|
61
|
+
s.overwrite(sortedNodes[0][0], sortedNodes[0][1], ` ${sorted.trim()} `);
|
|
62
|
+
return fixer.replaceText(node, s.toString());
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
if (context.parserServices == null || context.parserServices.defineTemplateBodyVisitor == null) {
|
|
69
|
+
return scriptVisitor;
|
|
70
|
+
} else {
|
|
71
|
+
return context.parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const CLASS_FIELDS = ["class", "classname"];
|
|
77
|
+
const AST_NODES_WITH_QUOTES = ["Literal", "VLiteral"];
|
|
78
|
+
|
|
19
79
|
const order = utils.ESLintUtils.RuleCreator((name) => name)({
|
|
20
80
|
name: "order",
|
|
21
81
|
meta: {
|
|
@@ -80,58 +140,6 @@ const order = utils.ESLintUtils.RuleCreator((name) => name)({
|
|
|
80
140
|
}
|
|
81
141
|
});
|
|
82
142
|
|
|
83
|
-
const IGNORE_ATTRIBUTES = ["style", "class", "classname", "value"];
|
|
84
|
-
const orderAttributify = utils.ESLintUtils.RuleCreator((name) => name)({
|
|
85
|
-
name: "order-attributify",
|
|
86
|
-
meta: {
|
|
87
|
-
type: "layout",
|
|
88
|
-
fixable: "code",
|
|
89
|
-
docs: {
|
|
90
|
-
description: "Order of UnoCSS attributes",
|
|
91
|
-
recommended: "recommended"
|
|
92
|
-
},
|
|
93
|
-
messages: {
|
|
94
|
-
"invalid-order": "UnoCSS attributes are not ordered"
|
|
95
|
-
},
|
|
96
|
-
schema: []
|
|
97
|
-
},
|
|
98
|
-
defaultOptions: [],
|
|
99
|
-
create(context) {
|
|
100
|
-
const scriptVisitor = {};
|
|
101
|
-
const templateBodyVisitor = {
|
|
102
|
-
VStartTag(node) {
|
|
103
|
-
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
104
|
-
if (!valueless.length)
|
|
105
|
-
return;
|
|
106
|
-
const input = valueless.map((i) => i.key.name).join(" ").trim();
|
|
107
|
-
const sorted = syncAction("sort", input);
|
|
108
|
-
if (sorted !== input) {
|
|
109
|
-
context.report({
|
|
110
|
-
node,
|
|
111
|
-
messageId: "invalid-order",
|
|
112
|
-
fix(fixer) {
|
|
113
|
-
const codeFull = context.getSourceCode();
|
|
114
|
-
const offset = node.range[0];
|
|
115
|
-
const code = codeFull.getText().slice(node.range[0], node.range[1]);
|
|
116
|
-
const s = new MagicString__default(code);
|
|
117
|
-
const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => b[0] - a[0]);
|
|
118
|
-
for (const [start, end] of sortedNodes.slice(1))
|
|
119
|
-
s.remove(start, end);
|
|
120
|
-
s.overwrite(sortedNodes[0][0], sortedNodes[0][1], ` ${sorted.trim()} `);
|
|
121
|
-
return fixer.replaceText(node, s.toString());
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
if (context.parserServices == null || context.parserServices.defineTemplateBodyVisitor == null) {
|
|
128
|
-
return scriptVisitor;
|
|
129
|
-
} else {
|
|
130
|
-
return context.parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
143
|
const blocklist = utils.ESLintUtils.RuleCreator((name) => name)({
|
|
136
144
|
name: "blocklist",
|
|
137
145
|
meta: {
|
|
@@ -213,22 +221,29 @@ const blocklist = utils.ESLintUtils.RuleCreator((name) => name)({
|
|
|
213
221
|
}
|
|
214
222
|
});
|
|
215
223
|
|
|
216
|
-
const
|
|
217
|
-
plugins: ["@unocss"],
|
|
218
|
-
rules: {
|
|
219
|
-
"@unocss/order": "warn",
|
|
220
|
-
"@unocss/order-attributify": "warn"
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const index = {
|
|
224
|
+
const plugin = {
|
|
225
225
|
rules: {
|
|
226
226
|
order,
|
|
227
227
|
"order-attributify": orderAttributify,
|
|
228
228
|
blocklist
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const configsFlat = {
|
|
233
|
+
plugin: {
|
|
234
|
+
unocss: plugin
|
|
229
235
|
},
|
|
236
|
+
rules: {
|
|
237
|
+
"unocss/order": "warn",
|
|
238
|
+
"unocss/order-attributify": "warn"
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const index = {
|
|
243
|
+
...plugin,
|
|
230
244
|
configs: {
|
|
231
|
-
recommended: configsRecommended
|
|
245
|
+
recommended: configsRecommended,
|
|
246
|
+
flat: configsFlat
|
|
232
247
|
}
|
|
233
248
|
};
|
|
234
249
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_eslint_utils from '@typescript-eslint/utils/eslint-utils';
|
|
2
2
|
|
|
3
3
|
declare const _default: {
|
|
4
|
-
rules: {
|
|
5
|
-
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
6
|
-
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
7
|
-
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
8
|
-
};
|
|
9
4
|
configs: {
|
|
10
5
|
recommended: {
|
|
11
6
|
plugins: string[];
|
|
12
7
|
rules: {
|
|
13
|
-
'@unocss/order':
|
|
14
|
-
'@unocss/order-attributify':
|
|
8
|
+
readonly '@unocss/order': "warn";
|
|
9
|
+
readonly '@unocss/order-attributify': "warn";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
flat: {
|
|
13
|
+
plugin: {
|
|
14
|
+
unocss: {
|
|
15
|
+
rules: {
|
|
16
|
+
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
17
|
+
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
18
|
+
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
rules: {
|
|
23
|
+
readonly 'unocss/order': "warn";
|
|
24
|
+
readonly 'unocss/order-attributify': "warn";
|
|
15
25
|
};
|
|
16
26
|
};
|
|
17
27
|
};
|
|
28
|
+
rules: {
|
|
29
|
+
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
30
|
+
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
31
|
+
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
32
|
+
};
|
|
18
33
|
};
|
|
19
34
|
|
|
20
35
|
export { _default as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_eslint_utils from '@typescript-eslint/utils/eslint-utils';
|
|
2
2
|
|
|
3
3
|
declare const _default: {
|
|
4
|
-
rules: {
|
|
5
|
-
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
6
|
-
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
7
|
-
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
8
|
-
};
|
|
9
4
|
configs: {
|
|
10
5
|
recommended: {
|
|
11
6
|
plugins: string[];
|
|
12
7
|
rules: {
|
|
13
|
-
'@unocss/order':
|
|
14
|
-
'@unocss/order-attributify':
|
|
8
|
+
readonly '@unocss/order': "warn";
|
|
9
|
+
readonly '@unocss/order-attributify': "warn";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
flat: {
|
|
13
|
+
plugin: {
|
|
14
|
+
unocss: {
|
|
15
|
+
rules: {
|
|
16
|
+
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
17
|
+
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
18
|
+
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
rules: {
|
|
23
|
+
readonly 'unocss/order': "warn";
|
|
24
|
+
readonly 'unocss/order-attributify': "warn";
|
|
15
25
|
};
|
|
16
26
|
};
|
|
17
27
|
};
|
|
28
|
+
rules: {
|
|
29
|
+
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
30
|
+
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
31
|
+
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
32
|
+
};
|
|
18
33
|
};
|
|
19
34
|
|
|
20
35
|
export { _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import * as _typescript_eslint_utils_eslint_utils from '@typescript-eslint/utils/eslint-utils';
|
|
2
2
|
|
|
3
3
|
declare const _default: {
|
|
4
|
-
rules: {
|
|
5
|
-
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
6
|
-
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
7
|
-
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
8
|
-
};
|
|
9
4
|
configs: {
|
|
10
5
|
recommended: {
|
|
11
6
|
plugins: string[];
|
|
12
7
|
rules: {
|
|
13
|
-
'@unocss/order':
|
|
14
|
-
'@unocss/order-attributify':
|
|
8
|
+
readonly '@unocss/order': "warn";
|
|
9
|
+
readonly '@unocss/order-attributify': "warn";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
flat: {
|
|
13
|
+
plugin: {
|
|
14
|
+
unocss: {
|
|
15
|
+
rules: {
|
|
16
|
+
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
17
|
+
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
18
|
+
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
rules: {
|
|
23
|
+
readonly 'unocss/order': "warn";
|
|
24
|
+
readonly 'unocss/order-attributify': "warn";
|
|
15
25
|
};
|
|
16
26
|
};
|
|
17
27
|
};
|
|
28
|
+
rules: {
|
|
29
|
+
order: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
30
|
+
'order-attributify': _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
31
|
+
blocklist: _typescript_eslint_utils_eslint_utils.RuleWithMeta<[], "">;
|
|
32
|
+
};
|
|
18
33
|
};
|
|
19
34
|
|
|
20
35
|
export { _default as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,75 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
import MagicString from 'magic-string';
|
|
2
3
|
import { join } from 'node:path';
|
|
3
4
|
import { createSyncFn } from 'synckit';
|
|
4
5
|
import { distDir } from './dirs.mjs';
|
|
5
|
-
import MagicString from 'magic-string';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const configsRecommended = {
|
|
9
|
+
plugins: ["@unocss"],
|
|
10
|
+
rules: {
|
|
11
|
+
"@unocss/order": "warn",
|
|
12
|
+
"@unocss/order-attributify": "warn"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
const syncAction = createSyncFn(join(distDir, "worker.cjs"));
|
|
12
17
|
|
|
18
|
+
const IGNORE_ATTRIBUTES = ["style", "class", "classname", "value"];
|
|
19
|
+
const orderAttributify = ESLintUtils.RuleCreator((name) => name)({
|
|
20
|
+
name: "order-attributify",
|
|
21
|
+
meta: {
|
|
22
|
+
type: "layout",
|
|
23
|
+
fixable: "code",
|
|
24
|
+
docs: {
|
|
25
|
+
description: "Order of UnoCSS attributes",
|
|
26
|
+
recommended: "recommended"
|
|
27
|
+
},
|
|
28
|
+
messages: {
|
|
29
|
+
"invalid-order": "UnoCSS attributes are not ordered"
|
|
30
|
+
},
|
|
31
|
+
schema: []
|
|
32
|
+
},
|
|
33
|
+
defaultOptions: [],
|
|
34
|
+
create(context) {
|
|
35
|
+
const scriptVisitor = {};
|
|
36
|
+
const templateBodyVisitor = {
|
|
37
|
+
VStartTag(node) {
|
|
38
|
+
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
39
|
+
if (!valueless.length)
|
|
40
|
+
return;
|
|
41
|
+
const input = valueless.map((i) => i.key.name).join(" ").trim();
|
|
42
|
+
const sorted = syncAction("sort", input);
|
|
43
|
+
if (sorted !== input) {
|
|
44
|
+
context.report({
|
|
45
|
+
node,
|
|
46
|
+
messageId: "invalid-order",
|
|
47
|
+
fix(fixer) {
|
|
48
|
+
const codeFull = context.getSourceCode();
|
|
49
|
+
const offset = node.range[0];
|
|
50
|
+
const code = codeFull.getText().slice(node.range[0], node.range[1]);
|
|
51
|
+
const s = new MagicString(code);
|
|
52
|
+
const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => b[0] - a[0]);
|
|
53
|
+
for (const [start, end] of sortedNodes.slice(1))
|
|
54
|
+
s.remove(start, end);
|
|
55
|
+
s.overwrite(sortedNodes[0][0], sortedNodes[0][1], ` ${sorted.trim()} `);
|
|
56
|
+
return fixer.replaceText(node, s.toString());
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (context.parserServices == null || context.parserServices.defineTemplateBodyVisitor == null) {
|
|
63
|
+
return scriptVisitor;
|
|
64
|
+
} else {
|
|
65
|
+
return context.parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const CLASS_FIELDS = ["class", "classname"];
|
|
71
|
+
const AST_NODES_WITH_QUOTES = ["Literal", "VLiteral"];
|
|
72
|
+
|
|
13
73
|
const order = ESLintUtils.RuleCreator((name) => name)({
|
|
14
74
|
name: "order",
|
|
15
75
|
meta: {
|
|
@@ -74,58 +134,6 @@ const order = ESLintUtils.RuleCreator((name) => name)({
|
|
|
74
134
|
}
|
|
75
135
|
});
|
|
76
136
|
|
|
77
|
-
const IGNORE_ATTRIBUTES = ["style", "class", "classname", "value"];
|
|
78
|
-
const orderAttributify = ESLintUtils.RuleCreator((name) => name)({
|
|
79
|
-
name: "order-attributify",
|
|
80
|
-
meta: {
|
|
81
|
-
type: "layout",
|
|
82
|
-
fixable: "code",
|
|
83
|
-
docs: {
|
|
84
|
-
description: "Order of UnoCSS attributes",
|
|
85
|
-
recommended: "recommended"
|
|
86
|
-
},
|
|
87
|
-
messages: {
|
|
88
|
-
"invalid-order": "UnoCSS attributes are not ordered"
|
|
89
|
-
},
|
|
90
|
-
schema: []
|
|
91
|
-
},
|
|
92
|
-
defaultOptions: [],
|
|
93
|
-
create(context) {
|
|
94
|
-
const scriptVisitor = {};
|
|
95
|
-
const templateBodyVisitor = {
|
|
96
|
-
VStartTag(node) {
|
|
97
|
-
const valueless = node.attributes.filter((i) => typeof i.key?.name === "string" && !IGNORE_ATTRIBUTES.includes(i.key?.name?.toLowerCase()) && i.value == null);
|
|
98
|
-
if (!valueless.length)
|
|
99
|
-
return;
|
|
100
|
-
const input = valueless.map((i) => i.key.name).join(" ").trim();
|
|
101
|
-
const sorted = syncAction("sort", input);
|
|
102
|
-
if (sorted !== input) {
|
|
103
|
-
context.report({
|
|
104
|
-
node,
|
|
105
|
-
messageId: "invalid-order",
|
|
106
|
-
fix(fixer) {
|
|
107
|
-
const codeFull = context.getSourceCode();
|
|
108
|
-
const offset = node.range[0];
|
|
109
|
-
const code = codeFull.getText().slice(node.range[0], node.range[1]);
|
|
110
|
-
const s = new MagicString(code);
|
|
111
|
-
const sortedNodes = valueless.map((i) => [i.range[0] - offset, i.range[1] - offset]).sort((a, b) => b[0] - a[0]);
|
|
112
|
-
for (const [start, end] of sortedNodes.slice(1))
|
|
113
|
-
s.remove(start, end);
|
|
114
|
-
s.overwrite(sortedNodes[0][0], sortedNodes[0][1], ` ${sorted.trim()} `);
|
|
115
|
-
return fixer.replaceText(node, s.toString());
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
if (context.parserServices == null || context.parserServices.defineTemplateBodyVisitor == null) {
|
|
122
|
-
return scriptVisitor;
|
|
123
|
-
} else {
|
|
124
|
-
return context.parserServices?.defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
137
|
const blocklist = ESLintUtils.RuleCreator((name) => name)({
|
|
130
138
|
name: "blocklist",
|
|
131
139
|
meta: {
|
|
@@ -207,22 +215,29 @@ const blocklist = ESLintUtils.RuleCreator((name) => name)({
|
|
|
207
215
|
}
|
|
208
216
|
});
|
|
209
217
|
|
|
210
|
-
const
|
|
211
|
-
plugins: ["@unocss"],
|
|
212
|
-
rules: {
|
|
213
|
-
"@unocss/order": "warn",
|
|
214
|
-
"@unocss/order-attributify": "warn"
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
const index = {
|
|
218
|
+
const plugin = {
|
|
219
219
|
rules: {
|
|
220
220
|
order,
|
|
221
221
|
"order-attributify": orderAttributify,
|
|
222
222
|
blocklist
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const configsFlat = {
|
|
227
|
+
plugin: {
|
|
228
|
+
unocss: plugin
|
|
223
229
|
},
|
|
230
|
+
rules: {
|
|
231
|
+
"unocss/order": "warn",
|
|
232
|
+
"unocss/order-attributify": "warn"
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const index = {
|
|
237
|
+
...plugin,
|
|
224
238
|
configs: {
|
|
225
|
-
recommended: configsRecommended
|
|
239
|
+
recommended: configsRecommended,
|
|
240
|
+
flat: configsFlat
|
|
226
241
|
}
|
|
227
242
|
};
|
|
228
243
|
|
package/dist/worker.cjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const process = require('node:process');
|
|
3
4
|
const config = require('@unocss/config');
|
|
4
5
|
const core = require('@unocss/core');
|
|
5
6
|
const synckit = require('synckit');
|
|
6
7
|
|
|
8
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
9
|
+
|
|
10
|
+
const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
11
|
+
|
|
7
12
|
async function sortRules(rules, uno) {
|
|
8
13
|
const unknown = [];
|
|
9
14
|
if (!uno.config.details)
|
|
@@ -31,7 +36,9 @@ async function sortRules(rules, uno) {
|
|
|
31
36
|
return [...unknown, sorted].join(" ").trim();
|
|
32
37
|
}
|
|
33
38
|
|
|
39
|
+
var _a;
|
|
34
40
|
let promise;
|
|
41
|
+
(_a = process__default.env).ESLINT || (_a.ESLINT = "true");
|
|
35
42
|
async function _getGenerator() {
|
|
36
43
|
const { config: config$1, sources } = await config.loadConfig();
|
|
37
44
|
if (!sources.length)
|
package/dist/worker.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
import { loadConfig } from '@unocss/config';
|
|
2
3
|
import { parseVariantGroup, notNull, collapseVariantGroup, createGenerator } from '@unocss/core';
|
|
3
4
|
import { runAsWorker } from 'synckit';
|
|
@@ -29,7 +30,9 @@ async function sortRules(rules, uno) {
|
|
|
29
30
|
return [...unknown, sorted].join(" ").trim();
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
var _a;
|
|
32
34
|
let promise;
|
|
35
|
+
(_a = process.env).ESLINT || (_a.ESLINT = "true");
|
|
33
36
|
async function _getGenerator() {
|
|
34
37
|
const { config, sources } = await loadConfig();
|
|
35
38
|
if (!sources.length)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/eslint-plugin",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.2",
|
|
4
4
|
"description": "ESLint plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@typescript-eslint/utils": "^6.7.2",
|
|
38
38
|
"magic-string": "^0.30.3",
|
|
39
39
|
"synckit": "^0.8.5",
|
|
40
|
-
"@unocss/config": "0.56.
|
|
41
|
-
"@unocss/core": "0.56.
|
|
40
|
+
"@unocss/config": "0.56.2",
|
|
41
|
+
"@unocss/core": "0.56.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@unocss/eslint-plugin": "0.56.
|
|
44
|
+
"@unocss/eslint-plugin": "0.56.2"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|