@yasainet/eslint 0.0.68 → 0.0.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasainet/eslint",
3
- "version": "0.0.68",
3
+ "version": "0.0.69",
4
4
  "description": "ESLint",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,5 +1,32 @@
1
+ import { existsSync } from "node:fs";
2
+ import { dirname, join, sep } from "node:path";
3
+
1
4
  import betterTailwindcss from "eslint-plugin-better-tailwindcss";
2
5
 
6
+ // `eslint-plugin-better-tailwindcss` resolves a relative `entryPoint` against
7
+ // the linter's `cwd`, which under LSP servers (vscode-eslint, Zed) is often
8
+ // the edited file's directory rather than the consumer's project root and
9
+ // breaks resolution. Mirror the `findProjectRoot` pattern from
10
+ // `common/rules.mjs` and `common/constants.mjs`: walk up from this module
11
+ // outside of `node_modules` and locate `src/app/globals.css`, then pass the
12
+ // absolute path so resolution is cwd-independent. Falls back to the relative
13
+ // path when not found, preserving the previous CLI-only behavior.
14
+ const findEntryPoint = (start) => {
15
+ let dir = start;
16
+ while (dir !== dirname(dir)) {
17
+ if (!dir.split(sep).includes("node_modules")) {
18
+ const candidate = join(dir, "src/app/globals.css");
19
+ if (existsSync(candidate)) {
20
+ return candidate;
21
+ }
22
+ }
23
+ dir = dirname(dir);
24
+ }
25
+ return "src/app/globals.css";
26
+ };
27
+
28
+ const entryPoint = findEntryPoint(import.meta.dirname);
29
+
3
30
  /**
4
31
  * Tailwind CSS v4 lint rules:
5
32
  *
@@ -9,9 +36,9 @@ import betterTailwindcss from "eslint-plugin-better-tailwindcss";
9
36
  * (`-space-x-2`) remain allowed for intentional overlap
10
37
  * - class order, deprecated classes, conflicts, duplicates, and whitespace
11
38
  * are enforced via `eslint-plugin-better-tailwindcss`
12
- * - `entryPoint` points at the consuming project's CSS-first Tailwind config
13
- * (`src/app/globals.css`). Override in the project's eslint.config.mjs if
14
- * the path differs.
39
+ * - `entryPoint` is auto-resolved to the consuming project's
40
+ * `src/app/globals.css` via walk-up from this module. Override in the
41
+ * project's eslint.config.mjs if the file lives elsewhere.
15
42
  */
16
43
  export const tailwindcssConfigs = [
17
44
  {
@@ -20,7 +47,7 @@ export const tailwindcssConfigs = [
20
47
  plugins: { "better-tailwindcss": betterTailwindcss },
21
48
  settings: {
22
49
  "better-tailwindcss": {
23
- entryPoint: "src/app/globals.css",
50
+ entryPoint,
24
51
  },
25
52
  },
26
53
  rules: {