@unocss/eslint-plugin 66.5.7 → 66.5.10-beta.1

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.
Files changed (2) hide show
  1. package/dist/worker.mjs +10 -2
  2. package/package.json +5 -5
package/dist/worker.mjs CHANGED
@@ -38,8 +38,16 @@ async function sortRules(rules, uno) {
38
38
 
39
39
  const promises = /* @__PURE__ */ new Map();
40
40
  process.env.ESLINT ||= "true";
41
+ function getSearchCwd(id) {
42
+ const virtualMatch = id.match(/\.\w+\/[^/]+$/);
43
+ if (virtualMatch) {
44
+ const realPath = id.slice(0, id.lastIndexOf("/"));
45
+ return dirname(realPath);
46
+ }
47
+ return dirname(id);
48
+ }
41
49
  async function _getGenerator(configPath, id) {
42
- const searchFrom = configPath ? process.cwd() : id ? dirname(id) : process.cwd();
50
+ const searchFrom = configPath ? process.cwd() : id ? getSearchCwd(id) : process.cwd();
43
51
  const { config, sources } = await loadConfig(
44
52
  searchFrom,
45
53
  configPath
@@ -55,7 +63,7 @@ function getCacheKey(configPath, id) {
55
63
  if (configPath)
56
64
  return `config:${configPath}`;
57
65
  if (id)
58
- return `dir:${dirname(id)}`;
66
+ return `dir:${getSearchCwd(id)}`;
59
67
  return `cwd:${process.cwd()}`;
60
68
  }
61
69
  async function getGenerator(configPath, id) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/eslint-plugin",
3
3
  "type": "module",
4
- "version": "66.5.7",
4
+ "version": "66.5.10-beta.1",
5
5
  "description": "ESLint plugin for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -38,15 +38,15 @@
38
38
  "@typescript-eslint/utils": "^8.46.4",
39
39
  "magic-string": "^0.30.21",
40
40
  "synckit": "^0.11.11",
41
- "@unocss/config": "66.5.7",
42
- "@unocss/core": "66.5.7",
43
- "@unocss/rule-utils": "66.5.7"
41
+ "@unocss/config": "66.5.10-beta.1",
42
+ "@unocss/core": "66.5.10-beta.1",
43
+ "@unocss/rule-utils": "66.5.10-beta.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@typescript/native-preview": "latest",
47
47
  "svelte-eslint-parser": "^1.4.0",
48
48
  "vue-eslint-parser": "^10.2.0",
49
- "@unocss/eslint-plugin": "66.5.7"
49
+ "@unocss/eslint-plugin": "66.5.10-beta.1"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "unbuild",