oxlint-tailwindcss 0.4.1 → 0.6.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 +75 -4
- package/dist/index.cjs +471 -40
- package/dist/index.mjs +605 -178
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -97,6 +97,28 @@ If auto-detection doesn't find your CSS file, set `entryPoint` once in `settings
|
|
|
97
97
|
|
|
98
98
|
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.
|
|
99
99
|
|
|
100
|
+
### Multiple entry points (monorepos)
|
|
101
|
+
|
|
102
|
+
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:
|
|
103
|
+
|
|
104
|
+
```jsonc
|
|
105
|
+
{
|
|
106
|
+
"settings": {
|
|
107
|
+
"tailwindcss": {
|
|
108
|
+
"entryPoint": [
|
|
109
|
+
"packages/web/src/globals.css",
|
|
110
|
+
"packages/admin/src/styles.css",
|
|
111
|
+
"packages/marketing/src/tailwind.css",
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
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`.
|
|
119
|
+
|
|
120
|
+
### Per-rule override
|
|
121
|
+
|
|
100
122
|
You can also override per rule if needed:
|
|
101
123
|
|
|
102
124
|
```jsonc
|
|
@@ -109,6 +131,8 @@ You can also override per rule if needed:
|
|
|
109
131
|
|
|
110
132
|
Resolution order: rule option > `settings.tailwindcss.entryPoint` > auto-detect.
|
|
111
133
|
|
|
134
|
+
### Timeout
|
|
135
|
+
|
|
112
136
|
For slow environments (large monorepos, CI), you can increase the design system loading timeout:
|
|
113
137
|
|
|
114
138
|
```jsonc
|
|
@@ -121,6 +145,48 @@ For slow environments (large monorepos, CI), you can increase the design system
|
|
|
121
145
|
}
|
|
122
146
|
```
|
|
123
147
|
|
|
148
|
+
### Root font size
|
|
149
|
+
|
|
150
|
+
The `enforce-canonical` rule converts px-based arbitrary values to named classes (e.g. `p-[2px]` → `p-0.5`). This conversion depends on the root font size:
|
|
151
|
+
|
|
152
|
+
```jsonc
|
|
153
|
+
{
|
|
154
|
+
"settings": {
|
|
155
|
+
"tailwindcss": {
|
|
156
|
+
"rootFontSize": 16, // pixels (default: 16)
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Debug logging
|
|
163
|
+
|
|
164
|
+
To see which design system is used for each file, enable debug mode:
|
|
165
|
+
|
|
166
|
+
```jsonc
|
|
167
|
+
{
|
|
168
|
+
"settings": {
|
|
169
|
+
"tailwindcss": {
|
|
170
|
+
"debug": true,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Or use the environment variable (no config changes needed):
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
DEBUG=oxlint-tailwindcss oxlint .
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Output:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
[oxlint-tailwindcss] Loaded design system from "packages/web/src/globals.css"
|
|
186
|
+
[oxlint-tailwindcss] packages/web/src/App.tsx → packages/web/src/globals.css
|
|
187
|
+
[oxlint-tailwindcss] packages/admin/src/Dashboard.tsx → packages/admin/src/styles.css
|
|
188
|
+
```
|
|
189
|
+
|
|
124
190
|
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`, `consistent-variant-order`) are silently disabled. All other rules work without it.
|
|
125
191
|
|
|
126
192
|
## Custom class detection
|
|
@@ -395,15 +461,20 @@ Only flags when the exact same utility exists both as base and with a conditiona
|
|
|
395
461
|
|
|
396
462
|
#### `enforce-canonical`
|
|
397
463
|
|
|
398
|
-
|
|
464
|
+
Enforces canonical Tailwind CSS class names. Uses `canonicalizeCandidates()` from the Tailwind CSS engine dynamically — the same API that powers Tailwind CSS IntelliSense's `suggestCanonicalClasses`.
|
|
399
465
|
|
|
400
466
|
```tsx
|
|
401
467
|
// ❌ Bad → ✅ Fixed
|
|
402
|
-
"-m-0"
|
|
403
|
-
"-mt-0"
|
|
404
|
-
"
|
|
468
|
+
"-m-0" → "m-0"
|
|
469
|
+
"-mt-0" → "mt-0"
|
|
470
|
+
"p-[2px]" → "p-0.5"
|
|
471
|
+
"max-w-[400px]" → "max-w-100"
|
|
472
|
+
"text-[var(--color-text)]/90" → "text-(--color-text)/90"
|
|
473
|
+
"[--w-padding:theme(spacing.1)]" → "[--w-padding:--spacing(1)]"
|
|
405
474
|
```
|
|
406
475
|
|
|
476
|
+
The px→named conversion (e.g. `p-[2px]` → `p-0.5`) depends on `rootFontSize` (default: 16).
|
|
477
|
+
|
|
407
478
|
**Requires design system.** **Autofix:** Replaces with canonical form.
|
|
408
479
|
|
|
409
480
|
---
|