oxlint-tailwindcss 0.1.5 → 0.1.7
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 +24 -6
- package/dist/index.cjs +586 -113
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +586 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# oxlint-tailwindcss
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
22 Tailwind CSS linting rules for [oxlint](https://oxc.rs/docs/guide/usage/linter). Built for Tailwind CSS v4 with zero-config auto-detection, typo suggestions, and autofixes.
|
|
4
4
|
|
|
5
5
|
## Highlights
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- **Typo suggestions** — `itms-center` → "Did you mean `items-center`?"
|
|
11
11
|
- **Conflict detection** — Shows exactly which CSS properties conflict and which class wins.
|
|
12
12
|
- **Lightweight** — Only 2 runtime dependencies: `@tailwindcss/node` and `tailwindcss`.
|
|
13
|
-
- **
|
|
13
|
+
- **22 rules** — Correctness, style, complexity, and restriction rules with autofixes where possible.
|
|
14
14
|
- **Variable detection** — Lints variables named `className`, `classes`, `style` automatically.
|
|
15
15
|
- **Component class support** — Recognizes `@layer components { .btn {} }` in your CSS.
|
|
16
16
|
|
|
@@ -41,13 +41,14 @@ Add the plugin to your `.oxlintrc.json`:
|
|
|
41
41
|
"tailwindcss/enforce-sort-order": "warn",
|
|
42
42
|
"tailwindcss/enforce-shorthand": "warn",
|
|
43
43
|
"tailwindcss/enforce-logical": "off",
|
|
44
|
+
"tailwindcss/enforce-physical": "off",
|
|
44
45
|
"tailwindcss/enforce-consistent-important-position": "warn",
|
|
45
46
|
"tailwindcss/enforce-negative-arbitrary-values": "warn",
|
|
46
47
|
"tailwindcss/enforce-consistent-variable-syntax": "warn",
|
|
47
48
|
"tailwindcss/consistent-variant-order": "warn",
|
|
48
49
|
// Complexity
|
|
49
|
-
"tailwindcss/max-class-count": "
|
|
50
|
-
"tailwindcss/enforce-consistent-line-wrapping": "
|
|
50
|
+
"tailwindcss/max-class-count": "off",
|
|
51
|
+
"tailwindcss/enforce-consistent-line-wrapping": "off",
|
|
51
52
|
// Restrictions
|
|
52
53
|
"tailwindcss/no-restricted-classes": "off",
|
|
53
54
|
"tailwindcss/no-arbitrary-value": "off",
|
|
@@ -334,7 +335,7 @@ Suggests the canonical form of a class when a shorter equivalent exists. Only kn
|
|
|
334
335
|
|
|
335
336
|
#### `enforce-sort-order`
|
|
336
337
|
|
|
337
|
-
Sorts classes according to Tailwind's official class order.
|
|
338
|
+
Sorts classes according to Tailwind's official class order — identical to [oxfmt](https://oxc.rs/docs/guide/usage/formatter) and [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss). Uses `ds.getClassOrder()` from the Tailwind CSS engine for exact results.
|
|
338
339
|
|
|
339
340
|
```tsx
|
|
340
341
|
// ❌ Bad
|
|
@@ -404,6 +405,24 @@ Also converts `border-l/r`, `rounded-l/r/tl/tr/bl/br`, and `scroll-ml/mr/pl/pr`
|
|
|
404
405
|
|
|
405
406
|
---
|
|
406
407
|
|
|
408
|
+
#### `enforce-physical`
|
|
409
|
+
|
|
410
|
+
The inverse of `enforce-logical`. Converts logical properties back to physical ones for consistency in LTR-only projects.
|
|
411
|
+
|
|
412
|
+
```tsx
|
|
413
|
+
// ❌ Bad → ✅ Fixed
|
|
414
|
+
"ms-4" → "ml-4"
|
|
415
|
+
"me-4" → "mr-4"
|
|
416
|
+
"ps-4" → "pl-4"
|
|
417
|
+
"pe-4" → "pr-4"
|
|
418
|
+
"start-0" → "left-0"
|
|
419
|
+
"end-0" → "right-0"
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Autofix:** Replaces with physical equivalent.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
407
426
|
#### `enforce-consistent-important-position`
|
|
408
427
|
|
|
409
428
|
Enforces a consistent position for the `!` (important) modifier — either prefix or suffix.
|
|
@@ -659,7 +678,6 @@ The class parser correctly handles:
|
|
|
659
678
|
|
|
660
679
|
- **`enforce-canonical`**: Only classes in Tailwind's class list can be canonicalized. Some valid classes (e.g., `grow-1`, `border-1`) are not in the list and won't be converted. Arbitrary values are also not canonicalized.
|
|
661
680
|
- **`no-conflicting-classes`**: Uses exact CSS property name matching. Shorthand vs longhand conflicts (e.g., `p-4` vs `px-2` where `padding` conflicts with `padding-left`) are not detected.
|
|
662
|
-
- **`enforce-sort-order`**: Variant-prefixed classes use the base utility's sort order as a fallback, which may not be 100% accurate for complex variant combinations.
|
|
663
681
|
- **`no-dark-without-light`**: Groups by utility prefix heuristic. May not perfectly match all multi-part utility prefixes.
|
|
664
682
|
- **`no-unnecessary-arbitrary-value`**: Only detects equivalences for classes with a single CSS property. Multi-property utilities may have arbitrary forms that aren't detected.
|
|
665
683
|
- **Component classes**: Only first-level `@import` relative paths are followed. Deeply nested imports or absolute paths are not resolved.
|