@unocss/eslint-plugin 0.58.9 → 0.59.0
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 +3 -3
- package/dist/index.mjs +1 -1
- package/package.json +7 -6
- package/dist/worker.cjs +0 -99
- package/dist/worker.d.cts +0 -10
- package/dist/worker.d.mts +0 -10
- package/dist/worker.d.ts +0 -10
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';Object.defineProperty(exports, '__esModule', {value: true});
|
|
2
2
|
|
|
3
3
|
const MagicString = require('magic-string');
|
|
4
4
|
const node_path = require('node:path');
|
|
@@ -19,7 +19,7 @@ const configsRecommended = {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const syncAction = synckit.createSyncFn(node_path.join(dirs.distDir, "worker.
|
|
22
|
+
const syncAction = synckit.createSyncFn(node_path.join(dirs.distDir, "worker.mjs"));
|
|
23
23
|
const createRule = utils.ESLintUtils.RuleCreator(
|
|
24
24
|
() => "https://unocss.dev/integrations/eslint#rules"
|
|
25
25
|
);
|
|
@@ -346,4 +346,4 @@ const index = {
|
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
-
|
|
349
|
+
exports.default = index;
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ const configsRecommended = {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
const syncAction = createSyncFn(join(distDir, "worker.
|
|
16
|
+
const syncAction = createSyncFn(join(distDir, "worker.mjs"));
|
|
17
17
|
const createRule = ESLintUtils.RuleCreator(
|
|
18
18
|
() => "https://unocss.dev/integrations/eslint#rules"
|
|
19
19
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/eslint-plugin",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.59.0",
|
|
4
5
|
"description": "ESLint plugin for UnoCSS",
|
|
5
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
7
|
"license": "MIT",
|
|
@@ -34,15 +35,15 @@
|
|
|
34
35
|
"node": ">=14"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@typescript-eslint/utils": "^7.
|
|
38
|
-
"magic-string": "^0.30.
|
|
38
|
+
"@typescript-eslint/utils": "^7.5.0",
|
|
39
|
+
"magic-string": "^0.30.9",
|
|
39
40
|
"synckit": "^0.9.0",
|
|
40
|
-
"@unocss/config": "0.
|
|
41
|
-
"@unocss/core": "0.
|
|
41
|
+
"@unocss/config": "0.59.0",
|
|
42
|
+
"@unocss/core": "0.59.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"vue-eslint-parser": "^9.4.2",
|
|
45
|
-
"@unocss/eslint-plugin": "0.
|
|
46
|
+
"@unocss/eslint-plugin": "0.59.0"
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "unbuild",
|
package/dist/worker.cjs
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const process = require('node:process');
|
|
4
|
-
const config = require('@unocss/config');
|
|
5
|
-
const core = require('@unocss/core');
|
|
6
|
-
const synckit = require('synckit');
|
|
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
|
-
|
|
12
|
-
async function sortRules(rules, uno) {
|
|
13
|
-
const unknown = [];
|
|
14
|
-
if (!uno.config.details)
|
|
15
|
-
uno.config.details = true;
|
|
16
|
-
const expandedResult = core.parseVariantGroup(rules);
|
|
17
|
-
rules = expandedResult.expanded;
|
|
18
|
-
const result = await Promise.all(rules.split(/\s+/g).map(async (i) => {
|
|
19
|
-
const token = await uno.parseToken(i);
|
|
20
|
-
if (token == null) {
|
|
21
|
-
unknown.push(i);
|
|
22
|
-
return void 0;
|
|
23
|
-
}
|
|
24
|
-
const variantRank = (token[0][5]?.variantHandlers?.length || 0) * 1e5;
|
|
25
|
-
const order = token[0][0] + variantRank;
|
|
26
|
-
return [order, i];
|
|
27
|
-
}));
|
|
28
|
-
let sorted = result.filter(core.notNull).sort((a, b) => {
|
|
29
|
-
let result2 = a[0] - b[0];
|
|
30
|
-
if (result2 === 0)
|
|
31
|
-
result2 = a[1].localeCompare(b[1]);
|
|
32
|
-
return result2;
|
|
33
|
-
}).map((i) => i[1]).join(" ");
|
|
34
|
-
if (expandedResult?.prefixes.length)
|
|
35
|
-
sorted = core.collapseVariantGroup(sorted, expandedResult.prefixes);
|
|
36
|
-
return [...unknown, sorted].join(" ").trim();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var _a;
|
|
40
|
-
let promise;
|
|
41
|
-
(_a = process__default.env).ESLINT || (_a.ESLINT = "true");
|
|
42
|
-
async function _getGenerator() {
|
|
43
|
-
const { config: config$1, sources } = await config.loadConfig();
|
|
44
|
-
if (!sources.length)
|
|
45
|
-
throw new Error("[@unocss/eslint-plugin] No config file found, create a `uno.config.ts` file in your project root and try again.");
|
|
46
|
-
return core.createGenerator({
|
|
47
|
-
...config$1,
|
|
48
|
-
warn: false
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
async function getGenerator() {
|
|
52
|
-
promise = promise || _getGenerator();
|
|
53
|
-
return await promise;
|
|
54
|
-
}
|
|
55
|
-
function setGenerator(generator) {
|
|
56
|
-
promise = Promise.resolve(generator);
|
|
57
|
-
}
|
|
58
|
-
async function actionSort(classes) {
|
|
59
|
-
return await sortRules(classes, await getGenerator());
|
|
60
|
-
}
|
|
61
|
-
async function actionBlocklist(classes, id) {
|
|
62
|
-
const uno = await getGenerator();
|
|
63
|
-
const blocked = /* @__PURE__ */ new Set();
|
|
64
|
-
const extracted = await uno.applyExtractors(classes, id);
|
|
65
|
-
const values = [...extracted.values()];
|
|
66
|
-
const matchBlocked = async (raw) => {
|
|
67
|
-
if (blocked.has(raw))
|
|
68
|
-
return;
|
|
69
|
-
if (uno.isBlocked(raw)) {
|
|
70
|
-
blocked.add(raw);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
let current = raw;
|
|
74
|
-
for (const p of uno.config.preprocess)
|
|
75
|
-
current = p(raw);
|
|
76
|
-
const applied = await uno.matchVariants(raw, current);
|
|
77
|
-
if (applied && uno.isBlocked(applied[1]))
|
|
78
|
-
blocked.add(raw);
|
|
79
|
-
};
|
|
80
|
-
await Promise.all(values.map(matchBlocked));
|
|
81
|
-
return [...blocked];
|
|
82
|
-
}
|
|
83
|
-
async function runAsync(action, ...args) {
|
|
84
|
-
switch (action) {
|
|
85
|
-
case "sort":
|
|
86
|
-
return actionSort(...args);
|
|
87
|
-
case "blocklist":
|
|
88
|
-
return actionBlocklist(...args);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function run(action, ...args) {
|
|
92
|
-
return runAsync(action, ...args);
|
|
93
|
-
}
|
|
94
|
-
synckit.runAsWorker(run);
|
|
95
|
-
|
|
96
|
-
exports.getGenerator = getGenerator;
|
|
97
|
-
exports.run = run;
|
|
98
|
-
exports.runAsync = runAsync;
|
|
99
|
-
exports.setGenerator = setGenerator;
|
package/dist/worker.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UnoGenerator } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
declare function getGenerator(): Promise<UnoGenerator<any>>;
|
|
4
|
-
declare function setGenerator(generator: Awaited<UnoGenerator<any>>): void;
|
|
5
|
-
declare function runAsync(action: 'sort', classes: string): Promise<string>;
|
|
6
|
-
declare function runAsync(action: 'blocklist', classes: string, id?: string): Promise<string[]>;
|
|
7
|
-
declare function run(action: 'sort', classes: string): string;
|
|
8
|
-
declare function run(action: 'blocklist', classes: string, id?: string): string[];
|
|
9
|
-
|
|
10
|
-
export { getGenerator, run, runAsync, setGenerator };
|
package/dist/worker.d.mts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UnoGenerator } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
declare function getGenerator(): Promise<UnoGenerator<any>>;
|
|
4
|
-
declare function setGenerator(generator: Awaited<UnoGenerator<any>>): void;
|
|
5
|
-
declare function runAsync(action: 'sort', classes: string): Promise<string>;
|
|
6
|
-
declare function runAsync(action: 'blocklist', classes: string, id?: string): Promise<string[]>;
|
|
7
|
-
declare function run(action: 'sort', classes: string): string;
|
|
8
|
-
declare function run(action: 'blocklist', classes: string, id?: string): string[];
|
|
9
|
-
|
|
10
|
-
export { getGenerator, run, runAsync, setGenerator };
|
package/dist/worker.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { UnoGenerator } from '@unocss/core';
|
|
2
|
-
|
|
3
|
-
declare function getGenerator(): Promise<UnoGenerator<any>>;
|
|
4
|
-
declare function setGenerator(generator: Awaited<UnoGenerator<any>>): void;
|
|
5
|
-
declare function runAsync(action: 'sort', classes: string): Promise<string>;
|
|
6
|
-
declare function runAsync(action: 'blocklist', classes: string, id?: string): Promise<string[]>;
|
|
7
|
-
declare function run(action: 'sort', classes: string): string;
|
|
8
|
-
declare function run(action: 'blocklist', classes: string, id?: string): string[];
|
|
9
|
-
|
|
10
|
-
export { getGenerator, run, runAsync, setGenerator };
|