oxlint-tailwindcss 1.10.2 → 1.11.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.
- package/README.md +35 -4
- package/dist/index.cjs +351 -55
- package/dist/index.d.cts +16 -26
- package/dist/index.d.mts +16 -26
- package/dist/index.mjs +351 -55
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -34,8 +34,8 @@ Read the story behind this plugin:
|
|
|
34
34
|
possible.
|
|
35
35
|
- **Variable detection** — Lints variables matching `/^classNames?$/`, `/^classes$/`, `/^styles?$/`
|
|
36
36
|
(e.g. `className`, `classNames`, `classes`, `styles`) automatically.
|
|
37
|
-
- **Customizable** — Extend class detection with custom attributes,
|
|
38
|
-
patterns.
|
|
37
|
+
- **Customizable** — Extend class detection with custom attributes, attribute patterns (regex, for
|
|
38
|
+
`*ClassName` props), callees, tags, and variable patterns.
|
|
39
39
|
- **Component class support** — Recognizes `@layer components { .btn {} }` in your CSS.
|
|
40
40
|
|
|
41
41
|
Full documentation: **https://oxlint-tailwindcss.pages.dev** (English) ·
|
|
@@ -165,6 +165,18 @@ For slow environments (large monorepos, CI), you can increase the design system
|
|
|
165
165
|
}
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
+
This `timeout` governs the **precompute loader** only. The sort/canonicalize/declaration worker
|
|
169
|
+
services used while linting have a separate **30 s per-request** timeout. If a slow-but-functional
|
|
170
|
+
machine or CI runner reports `worker request timed out after 30000ms` on valid class lists, raise it
|
|
171
|
+
with the `OXLINT_TAILWINDCSS_WORKER_REQUEST_TIMEOUT` environment variable (milliseconds):
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
OXLINT_TAILWINDCSS_WORKER_REQUEST_TIMEOUT=60000 oxlint
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
A timeout no longer costs O(files): after a few consecutive timeouts for one entry point the rest of
|
|
178
|
+
the run fails fast, and the state self-heals once the machine recovers.
|
|
179
|
+
|
|
168
180
|
### Root font size
|
|
169
181
|
|
|
170
182
|
The `enforce-canonical` rule converts px-based arbitrary values to named classes (e.g. `p-[2px]` →
|
|
@@ -230,8 +242,11 @@ entries are appended to the built-in defaults:
|
|
|
230
242
|
"jsPlugins": ["oxlint-tailwindcss"],
|
|
231
243
|
"settings": {
|
|
232
244
|
"tailwindcss": {
|
|
233
|
-
// Additional JSX attribute names to scan
|
|
245
|
+
// Additional JSX attribute names to scan (exact match)
|
|
234
246
|
"attributes": ["xyzClassName", "classNames", "overlayClassName"],
|
|
247
|
+
// Regex patterns for JSX attribute names — catches *ClassName conventions
|
|
248
|
+
// (React Native / Uniwind) without listing every prop
|
|
249
|
+
"attributePatterns": ["ClassName$"],
|
|
235
250
|
// Additional function names to scan
|
|
236
251
|
"callees": ["myHelper"],
|
|
237
252
|
// Additional tagged template tags to scan
|
|
@@ -250,6 +265,12 @@ entries are appended to the built-in defaults:
|
|
|
250
265
|
This applies to all 24 rules at once. For example, adding `"classNames"` to `attributes` makes every
|
|
251
266
|
rule lint `<Input classNames={{ root: "..." }} />`.
|
|
252
267
|
|
|
268
|
+
> **`attributePatterns` vs `variablePatterns`** — both match by regex, but on different things.
|
|
269
|
+
> `attributePatterns` matches **JSX attribute names** (`contentContainerClassName`,
|
|
270
|
+
> `tintColorClassName`, …); `variablePatterns` matches **variable declaration names only**
|
|
271
|
+
> (`const fooClassName = "..."`), never JSX attributes — despite its default `/^classNames?$/`
|
|
272
|
+
> looking like the `className` attribute.
|
|
273
|
+
|
|
253
274
|
To **remove** specific items from the built-in defaults, use `exclude`:
|
|
254
275
|
|
|
255
276
|
```jsonc
|
|
@@ -507,6 +528,9 @@ unconditionally.
|
|
|
507
528
|
<div className="hover:flex dark:flex" />
|
|
508
529
|
<div className="absolute after:absolute" />
|
|
509
530
|
<div className="shrink-0 [&>svg]:shrink-0" />
|
|
531
|
+
|
|
532
|
+
// ✅ OK — responsive reset: lg:block restores display after md:hidden removed it
|
|
533
|
+
<div className="block md:hidden lg:block" />
|
|
510
534
|
```
|
|
511
535
|
|
|
512
536
|
Only flags when the exact same utility exists both as base and with a conditional variant. Variants
|
|
@@ -518,7 +542,14 @@ are not flagged.
|
|
|
518
542
|
are override fragments where the "redundant" variant is often load-bearing (it beats a same-group
|
|
519
543
|
class the component merges in), so they are skipped to avoid false positives.
|
|
520
544
|
|
|
521
|
-
**
|
|
545
|
+
**Responsive resets (issue #150):** the base only "applies unconditionally" if nothing else
|
|
546
|
+
overrides its property. A variant that re-establishes a property an intermediate class took away
|
|
547
|
+
(`lg:block` after `md:hidden`) is load-bearing and not flagged. With an `entryPoint` this uses the
|
|
548
|
+
CSS properties the design system reports (any property); without one it falls back to the closed
|
|
549
|
+
`display`/`visibility` groups.
|
|
550
|
+
|
|
551
|
+
**Options:** `entryPoint` (per-rule override of `settings.tailwindcss.entryPoint`; optional — the
|
|
552
|
+
rule is DS-optional and never reports a missing design system). **No autofix.**
|
|
522
553
|
|
|
523
554
|
---
|
|
524
555
|
|