oxlint-tailwindcss 0.8.0 → 1.0.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/README.md CHANGED
@@ -1,15 +1,19 @@
1
1
  # oxlint-tailwindcss
2
2
 
3
- 23 Tailwind CSS linting rules for [oxlint](https://oxc.rs/docs/guide/usage/linter). Built for Tailwind CSS v4 with auto-detection, typo suggestions, and autofixes.
3
+ 23 Tailwind CSS linting rules for [oxlint](https://oxc.rs/docs/guide/usage/linter). Built for Tailwind CSS v4 with deterministic config, typo suggestions, and autofixes.
4
+
5
+ > **v1.0.0** — Upgrading from v0.x? See the **[migration guide](https://oxlint-tailwindcss.pages.dev/migration/v0-to-v1)**. The headline change: `settings.tailwindcss.entryPoint` is now required.
4
6
 
5
7
  Read the story behind this plugin: [oxlint-tailwindcss: The Linting Plugin Tailwind v4 Needed](https://sergioazocar.com/en/blog/oxlint-tailwindcss-the-linting-plugin-tailwind-v4-needed)
6
8
 
7
9
  ## Highlights
8
10
 
9
- - **Works out of the box** — Auto-detects your Tailwind CSS entry point. Fully configurable when needed.
10
- - **Monorepo-ready** — Each package resolves its own design system automatically. Run `oxlint` once from the workspace root.
11
- - **Fast** — Native oxlint plugin with per-entry-point caching and content-based disk cache for monorepo deduplication.
12
- - **Tailwind CSS v4** — Designed for v4 from day one.
11
+ - **Configure once, never fails** — `settings.tailwindcss.entryPoint` is explicit. Same input → same output on every machine.
12
+ - **Monorepo-ready** — Single root config with a glob → CSS mapping array, or one `.oxlintrc.json` per package. Both fully deterministic.
13
+ - **Coexists with oxfmt and Prettier** — Point all tools at the same CSS and they agree byte-for-byte. See the [interop guide](https://oxlint-tailwindcss.pages.dev/interop).
14
+ - **Tailwind CSS v4** — Designed for v4 from day one. Reads your `@theme { ... }` custom tokens, your shadcn variables, your typography plugin.
15
+ - **Fail loud** — Misconfiguration surfaces as a single `designSystemUnavailable` diagnostic with an actionable hint. Never silently skipped rules.
16
+ - **Fast** — Native oxlint plugin with per-entry-point caching and content-hash disk cache for monorepo deduplication.
13
17
  - **Typo suggestions** — `itms-center` → "Did you mean `items-center`?"
14
18
  - **Conflict detection** — Shows exactly which CSS properties conflict and which class wins.
15
19
  - **Lightweight** — Only 2 runtime dependencies: `@tailwindcss/node` and `tailwindcss`.
@@ -18,6 +22,8 @@ Read the story behind this plugin: [oxlint-tailwindcss: The Linting Plugin Tailw
18
22
  - **Customizable** — Extend class detection with custom attributes, callees, tags, and variable patterns.
19
23
  - **Component class support** — Recognizes `@layer components { .btn {} }` in your CSS.
20
24
 
25
+ Full documentation: **https://oxlint-tailwindcss.pages.dev** (English) · **https://oxlint-tailwindcss.pages.dev/es** (Español)
26
+
21
27
  ## Installation
22
28
 
23
29
  ```bash
@@ -63,30 +69,14 @@ Add the plugin to your `.oxlintrc.json`:
63
69
  }
64
70
  ```
65
71
 
66
- The plugin auto-detects your Tailwind CSS entry point. No configuration needed in most projects.
67
-
68
- ## Auto-detection
69
-
70
- The plugin searches for a CSS file containing a Tailwind import signal (`@import "tailwindcss"`, `@import 'tailwindcss'`, `@import tailwindcss`, `@tailwind base`) in these locations, walking upward from the linted file:
71
-
72
- ```
73
- src/{name}.css {name}.css app/{name}.css
74
- styles/{name}.css style/{name}.css css/{name}.css
75
- assets/{name}.css assets/css/{name}.css resources/css/{name}.css
76
- ```
77
-
78
- Where `{name}` is one of: `app`, `globals`, `global`, `style`, `styles`, `index`, `main`, `tailwind`, `tailwindcss`.
79
-
80
- The search is monorepo-aware — it stops at `package.json` boundaries so each package resolves its own Tailwind config. Packages without a Tailwind CSS file are silently skipped (DS-dependent rules produce no diagnostics). If the signal isn't found directly in the CSS file, the auto-detector follows `@import` statements one level deep — supporting both relative paths and package imports (e.g. `@import '@company/theme/tailwind.config.css'`).
81
-
82
- If auto-detection doesn't find your CSS file, set `entryPoint` once in `settings`:
72
+ Declare your Tailwind CSS entry point in `settings.tailwindcss.entryPoint`:
83
73
 
84
74
  ```jsonc
85
75
  {
86
76
  "jsPlugins": ["oxlint-tailwindcss"],
87
77
  "settings": {
88
78
  "tailwindcss": {
89
- "entryPoint": "app/tailwind.css",
79
+ "entryPoint": "src/styles.css",
90
80
  },
91
81
  },
92
82
  "rules": {
@@ -96,27 +86,31 @@ If auto-detection doesn't find your CSS file, set `entryPoint` once in `settings
96
86
  }
97
87
  ```
98
88
 
99
- The design system is loaded once per entry point and shared across all rules. In monorepos, each package resolves its own entry point automatically via `package.json` boundaries.
89
+ That's the only required setting. The plugin loads your design system from that file once and shares it across every rule.
100
90
 
101
- ### Multiple entry points (monorepos)
91
+ ### Monorepos
102
92
 
103
- For monorepos where auto-detection isn't enough, `entryPoint` accepts an array. The plugin picks the closest entry point for each file based on directory proximity:
93
+ Two patterns, both fully deterministic:
94
+
95
+ **Pattern A — single root config with a glob → CSS mapping.** First match wins, evaluation in array order:
104
96
 
105
97
  ```jsonc
106
98
  {
107
99
  "settings": {
108
100
  "tailwindcss": {
109
101
  "entryPoint": [
110
- "packages/web/src/globals.css",
111
- "packages/admin/src/styles.css",
112
- "packages/marketing/src/tailwind.css",
102
+ { "files": "packages/ui/**", "use": "packages/ui/src/styles.css" },
103
+ { "files": "packages/admin/**", "use": "packages/admin/src/admin.css" },
104
+ { "files": "**", "use": "src/global.css" },
113
105
  ],
114
106
  },
115
107
  },
116
108
  }
117
109
  ```
118
110
 
119
- For example, `packages/web/src/App.tsx` resolves to `packages/web/src/globals.css` and `packages/admin/src/Dashboard.tsx` resolves to `packages/admin/src/styles.css`.
111
+ **Pattern B — one `.oxlintrc.json` per package**, each with its own string `entryPoint`. oxlint resolves the closest config to the file being linted.
112
+
113
+ See the full [monorepo guide](https://oxlint-tailwindcss.pages.dev/monorepo) for examples of both.
120
114
 
121
115
  ### Per-rule override
122
116
 
@@ -130,7 +124,7 @@ You can also override per rule if needed:
130
124
  }
131
125
  ```
132
126
 
133
- Resolution order: rule option > `settings.tailwindcss.entryPoint` > auto-detect.
127
+ Resolution order: rule option > `settings.tailwindcss.entryPoint`. If neither resolves a CSS file, DS-dependent rules emit a single `designSystemUnavailable` diagnostic per file (with the migration hint inline). v1.0.0 removed the filesystem auto-detect — explicit `entryPoint` is mandatory.
134
128
 
135
129
  ### Timeout
136
130
 
@@ -140,7 +134,7 @@ For slow environments (large monorepos, CI), you can increase the design system
140
134
  {
141
135
  "settings": {
142
136
  "tailwindcss": {
143
- "timeout": 60000, // milliseconds (default: 30000)
137
+ "timeout": 120000, // milliseconds (default: 60000)
144
138
  },
145
139
  },
146
140
  }
@@ -188,7 +182,7 @@ Output:
188
182
  [oxlint-tailwindcss] packages/admin/src/Dashboard.tsx → packages/admin/src/styles.css
189
183
  ```
190
184
 
191
- If no entry point is found (neither configured nor auto-detected), rules that require the design system (`no-unknown-classes`, `no-conflicting-classes`, `no-deprecated-classes`, `enforce-canonical`, `enforce-sort-order`, `no-unnecessary-arbitrary-value`, `prefer-theme-tokens`, `consistent-variant-order`) are silently disabled. All other rules work without it.
185
+ If no entry point is configured, the DS-dependent rules (`no-unknown-classes`, `no-conflicting-classes`, `no-deprecated-classes`, `enforce-canonical`, `enforce-sort-order`, `no-unnecessary-arbitrary-value`, `prefer-theme-tokens`) emit a single `designSystemUnavailable` diagnostic per file with an actionable hint — no more silent skips. `consistent-variant-order` is the lone exception: its static fallback is itself deterministic, so a missing entryPoint is tolerated there. All non-DS rules work without an entry point.
192
186
 
193
187
  ## Custom class detection
194
188
 
@@ -290,6 +284,10 @@ classed("button", "flex items-center", {
290
284
  },
291
285
  })
292
286
 
287
+ // Array values — the idiomatic multi-line form of cn()/cva()/tv()
288
+ cn(["flex", "items-center"])
289
+ tv({ base: ["flex", "items-center"], variants: { size: { sm: ["p-2", "text-sm"] } } })
290
+
293
291
  // Object-valued JSX attributes (e.g. Mantine classNames prop)
294
292
  <Input classNames={{ root: "flex items-center", input: "border-none" }} />
295
293