oxlint-tailwindcss 0.6.0 → 0.6.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 CHANGED
@@ -652,7 +652,7 @@ Does NOT convert complex expressions — only simple `var(--name)` wrappers:
652
652
 
653
653
  Enforces a consistent order for variant prefixes.
654
654
 
655
- Uses the design system's variant order when available, falls back to a sensible static default. Only checks classes with 2+ variants.
655
+ Uses the design system's variant order when available, falls back to a sensible static default. Only checks classes with 2+ variants. Pseudo-element variants (`before:`, `after:`, `placeholder:`, etc.) are always kept innermost (closest to the utility) regardless of the ordering source — placing them before element-selecting variants like `[&>svg]:` or `has-[.active]:` produces broken CSS in Tailwind v4.
656
656
 
657
657
  **Options:**
658
658
 
package/dist/index.cjs CHANGED
@@ -3325,6 +3325,18 @@ const noContradictingVariants = (0, _oxlint_plugins.defineRule)({
3325
3325
  });
3326
3326
  //#endregion
3327
3327
  //#region src/rules/consistent-variant-order.ts
3328
+ const PSEUDO_ELEMENTS = new Set([
3329
+ "before",
3330
+ "after",
3331
+ "file",
3332
+ "placeholder",
3333
+ "selection",
3334
+ "marker",
3335
+ "backdrop",
3336
+ "first-line",
3337
+ "first-letter",
3338
+ "details-content"
3339
+ ]);
3328
3340
  const DEFAULT_VARIANT_ORDER = [
3329
3341
  "*",
3330
3342
  "**",
@@ -3470,9 +3482,14 @@ const consistentVariantOrder = (0, _oxlint_plugins.defineRule)({
3470
3482
  const variants = extractVariants(cls);
3471
3483
  if (variants.length < 2) return null;
3472
3484
  const sorted = [...variants].sort((a, b) => getVariantPriority(a) - getVariantPriority(b));
3473
- if (variants.every((v, i) => v === sorted[i])) return null;
3485
+ const nonPseudo = [];
3486
+ const pseudo = [];
3487
+ for (const v of sorted) if (PSEUDO_ELEMENTS.has(v)) pseudo.push(v);
3488
+ else nonPseudo.push(v);
3489
+ const final = nonPseudo.length > 0 && pseudo.length > 0 ? [...nonPseudo, ...pseudo] : sorted;
3490
+ if (variants.every((v, i) => v === final[i])) return null;
3474
3491
  const utility = extractUtility(cls);
3475
- return sorted.join(":") + ":" + utility;
3492
+ return final.join(":") + ":" + utility;
3476
3493
  }
3477
3494
  function check(locations) {
3478
3495
  for (const loc of locations) {
package/dist/index.mjs CHANGED
@@ -3329,6 +3329,18 @@ const noContradictingVariants = defineRule({
3329
3329
  });
3330
3330
  //#endregion
3331
3331
  //#region src/rules/consistent-variant-order.ts
3332
+ const PSEUDO_ELEMENTS = new Set([
3333
+ "before",
3334
+ "after",
3335
+ "file",
3336
+ "placeholder",
3337
+ "selection",
3338
+ "marker",
3339
+ "backdrop",
3340
+ "first-line",
3341
+ "first-letter",
3342
+ "details-content"
3343
+ ]);
3332
3344
  const DEFAULT_VARIANT_ORDER = [
3333
3345
  "*",
3334
3346
  "**",
@@ -3474,9 +3486,14 @@ const consistentVariantOrder = defineRule({
3474
3486
  const variants = extractVariants(cls);
3475
3487
  if (variants.length < 2) return null;
3476
3488
  const sorted = [...variants].sort((a, b) => getVariantPriority(a) - getVariantPriority(b));
3477
- if (variants.every((v, i) => v === sorted[i])) return null;
3489
+ const nonPseudo = [];
3490
+ const pseudo = [];
3491
+ for (const v of sorted) if (PSEUDO_ELEMENTS.has(v)) pseudo.push(v);
3492
+ else nonPseudo.push(v);
3493
+ const final = nonPseudo.length > 0 && pseudo.length > 0 ? [...nonPseudo, ...pseudo] : sorted;
3494
+ if (variants.every((v, i) => v === final[i])) return null;
3478
3495
  const utility = extractUtility(cls);
3479
- return sorted.join(":") + ":" + utility;
3496
+ return final.join(":") + ":" + utility;
3480
3497
  }
3481
3498
  function check(locations) {
3482
3499
  for (const loc of locations) {