@unocss/eslint-plugin 66.5.4 → 66.5.6
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 +6 -3
- package/dist/index.mjs +6 -3
- package/dist/worker.mjs +21 -10
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,8 @@ const orderAttributify = createRule({
|
|
|
46
46
|
const sorted = syncAction(
|
|
47
47
|
context.settings.unocss?.configPath,
|
|
48
48
|
"sort",
|
|
49
|
-
input
|
|
49
|
+
input,
|
|
50
|
+
context.filename
|
|
50
51
|
);
|
|
51
52
|
if (sorted !== input) {
|
|
52
53
|
context.report({
|
|
@@ -317,7 +318,8 @@ const order = createRule({
|
|
|
317
318
|
let sorted = syncAction(
|
|
318
319
|
context.settings.unocss?.configPath,
|
|
319
320
|
"sort",
|
|
320
|
-
input
|
|
321
|
+
input,
|
|
322
|
+
context.filename
|
|
321
323
|
).trim();
|
|
322
324
|
if (addSpace === "before")
|
|
323
325
|
sorted = ` ${sorted}`;
|
|
@@ -360,7 +362,8 @@ const order = createRule({
|
|
|
360
362
|
let sorted = syncAction(
|
|
361
363
|
context.settings.unocss?.configPath,
|
|
362
364
|
"sort",
|
|
363
|
-
input
|
|
365
|
+
input,
|
|
366
|
+
context.filename
|
|
364
367
|
).trim();
|
|
365
368
|
if (/^\s/.test(input))
|
|
366
369
|
sorted = ` ${sorted}`;
|
package/dist/index.mjs
CHANGED
|
@@ -40,7 +40,8 @@ const orderAttributify = createRule({
|
|
|
40
40
|
const sorted = syncAction(
|
|
41
41
|
context.settings.unocss?.configPath,
|
|
42
42
|
"sort",
|
|
43
|
-
input
|
|
43
|
+
input,
|
|
44
|
+
context.filename
|
|
44
45
|
);
|
|
45
46
|
if (sorted !== input) {
|
|
46
47
|
context.report({
|
|
@@ -311,7 +312,8 @@ const order = createRule({
|
|
|
311
312
|
let sorted = syncAction(
|
|
312
313
|
context.settings.unocss?.configPath,
|
|
313
314
|
"sort",
|
|
314
|
-
input
|
|
315
|
+
input,
|
|
316
|
+
context.filename
|
|
315
317
|
).trim();
|
|
316
318
|
if (addSpace === "before")
|
|
317
319
|
sorted = ` ${sorted}`;
|
|
@@ -354,7 +356,8 @@ const order = createRule({
|
|
|
354
356
|
let sorted = syncAction(
|
|
355
357
|
context.settings.unocss?.configPath,
|
|
356
358
|
"sort",
|
|
357
|
-
input
|
|
359
|
+
input,
|
|
360
|
+
context.filename
|
|
358
361
|
).trim();
|
|
359
362
|
if (/^\s/.test(input))
|
|
360
363
|
sorted = ` ${sorted}`;
|
package/dist/worker.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dirname } from 'node:path';
|
|
1
2
|
import process from 'node:process';
|
|
2
3
|
import { parseVariantGroup, notNull, collapseVariantGroup, createGenerator } from '@unocss/core';
|
|
3
4
|
import { loadConfig } from '@unocss/config';
|
|
@@ -37,9 +38,10 @@ async function sortRules(rules, uno) {
|
|
|
37
38
|
|
|
38
39
|
const promises = /* @__PURE__ */ new Map();
|
|
39
40
|
process.env.ESLINT ||= "true";
|
|
40
|
-
async function _getGenerator(configPath) {
|
|
41
|
+
async function _getGenerator(configPath, id) {
|
|
42
|
+
const searchFrom = configPath ? process.cwd() : id ? dirname(id) : process.cwd();
|
|
41
43
|
const { config, sources } = await loadConfig(
|
|
42
|
-
|
|
44
|
+
searchFrom,
|
|
43
45
|
configPath
|
|
44
46
|
);
|
|
45
47
|
if (!sources.length)
|
|
@@ -49,22 +51,31 @@ async function _getGenerator(configPath) {
|
|
|
49
51
|
warn: false
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
function getCacheKey(configPath, id) {
|
|
55
|
+
if (configPath)
|
|
56
|
+
return `config:${configPath}`;
|
|
57
|
+
if (id)
|
|
58
|
+
return `dir:${dirname(id)}`;
|
|
59
|
+
return `cwd:${process.cwd()}`;
|
|
60
|
+
}
|
|
61
|
+
async function getGenerator(configPath, id) {
|
|
62
|
+
const cacheKey = getCacheKey(configPath, id);
|
|
63
|
+
let promise = promises.get(cacheKey);
|
|
54
64
|
if (!promise) {
|
|
55
|
-
promise = _getGenerator(configPath);
|
|
56
|
-
promises.set(
|
|
65
|
+
promise = _getGenerator(configPath, id);
|
|
66
|
+
promises.set(cacheKey, promise);
|
|
57
67
|
}
|
|
58
68
|
return await promise;
|
|
59
69
|
}
|
|
60
70
|
function setGenerator(generator, configPath) {
|
|
61
|
-
|
|
71
|
+
const cacheKey = configPath ? `config:${configPath}` : `cwd:${process.cwd()}`;
|
|
72
|
+
promises.set(cacheKey, Promise.resolve(generator));
|
|
62
73
|
}
|
|
63
|
-
async function actionSort(configPath, classes) {
|
|
64
|
-
return await sortRules(classes, await getGenerator(configPath));
|
|
74
|
+
async function actionSort(configPath, classes, id) {
|
|
75
|
+
return await sortRules(classes, await getGenerator(configPath, id));
|
|
65
76
|
}
|
|
66
77
|
async function actionBlocklist(configPath, classes, id) {
|
|
67
|
-
const uno = await getGenerator(configPath);
|
|
78
|
+
const uno = await getGenerator(configPath, id);
|
|
68
79
|
const blocked = /* @__PURE__ */ new Map();
|
|
69
80
|
const extracted = await uno.applyExtractors(classes, id);
|
|
70
81
|
const values = [...extracted.values()];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/eslint-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.5.
|
|
4
|
+
"version": "66.5.6",
|
|
5
5
|
"description": "ESLint plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
"node": ">=14"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@typescript-eslint/utils": "^8.
|
|
39
|
-
"magic-string": "^0.30.
|
|
38
|
+
"@typescript-eslint/utils": "^8.46.4",
|
|
39
|
+
"magic-string": "^0.30.21",
|
|
40
40
|
"synckit": "^0.11.11",
|
|
41
|
-
"@unocss/
|
|
42
|
-
"@unocss/
|
|
43
|
-
"@unocss/rule-utils": "66.5.
|
|
41
|
+
"@unocss/config": "66.5.6",
|
|
42
|
+
"@unocss/core": "66.5.6",
|
|
43
|
+
"@unocss/rule-utils": "66.5.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@typescript/native-preview": "latest",
|
|
47
|
-
"svelte-eslint-parser": "^1.
|
|
47
|
+
"svelte-eslint-parser": "^1.4.0",
|
|
48
48
|
"vue-eslint-parser": "^10.2.0",
|
|
49
|
-
"@unocss/eslint-plugin": "66.5.
|
|
49
|
+
"@unocss/eslint-plugin": "66.5.6"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "unbuild",
|