@yasainet/eslint 0.0.67 → 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.67",
3
+ "version": "0.0.69",
4
4
  "description": "ESLint",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,14 +1,44 @@
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
  *
6
33
  * - margin is forbidden; spacing is controlled by padding/gap on the parent
34
+ * - `space-x-*` / `space-y-*` are also banned because they apply margin to
35
+ * children under the hood. Use `flex/grid + gap` instead. Negative variants
36
+ * (`-space-x-2`) remain allowed for intentional overlap
7
37
  * - class order, deprecated classes, conflicts, duplicates, and whitespace
8
38
  * are enforced via `eslint-plugin-better-tailwindcss`
9
- * - `entryPoint` points at the consuming project's CSS-first Tailwind config
10
- * (`src/app/globals.css`). Override in the project's eslint.config.mjs if
11
- * 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.
12
42
  */
13
43
  export const tailwindcssConfigs = [
14
44
  {
@@ -17,7 +47,7 @@ export const tailwindcssConfigs = [
17
47
  plugins: { "better-tailwindcss": betterTailwindcss },
18
48
  settings: {
19
49
  "better-tailwindcss": {
20
- entryPoint: "src/app/globals.css",
50
+ entryPoint,
21
51
  },
22
52
  },
23
53
  rules: {
@@ -35,6 +65,11 @@ export const tailwindcssConfigs = [
35
65
  message:
36
66
  "Avoid margin; control spacing with padding/gap (exceptions: mx-auto, -mt-*)",
37
67
  },
68
+ {
69
+ pattern: "^space-[xy]-[^-\\s]+$",
70
+ message:
71
+ "Avoid space-x/space-y (uses margin internally); use flex/grid + gap",
72
+ },
38
73
  ],
39
74
  },
40
75
  ],