oxlint-tailwindcss 1.11.0 → 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 CHANGED
@@ -528,6 +528,9 @@ unconditionally.
528
528
  <div className="hover:flex dark:flex" />
529
529
  <div className="absolute after:absolute" />
530
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" />
531
534
  ```
532
535
 
533
536
  Only flags when the exact same utility exists both as base and with a conditional variant. Variants
@@ -539,7 +542,14 @@ are not flagged.
539
542
  are override fragments where the "redundant" variant is often load-bearing (it beats a same-group
540
543
  class the component merges in), so they are skipped to avoid false positives.
541
544
 
542
- **No options.** **No autofix.**
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.**
543
553
 
544
554
  ---
545
555
 
package/dist/index.cjs CHANGED
@@ -6703,6 +6703,32 @@ const noHardcodedColors = defineRule({
6703
6703
  });
6704
6704
  //#endregion
6705
6705
  //#region src/rules/no-contradicting-variants.ts
6706
+ const STATIC_PROP_GROUPS = /* @__PURE__ */ new Map([
6707
+ ["block", "display"],
6708
+ ["inline-block", "display"],
6709
+ ["inline", "display"],
6710
+ ["flex", "display"],
6711
+ ["inline-flex", "display"],
6712
+ ["grid", "display"],
6713
+ ["inline-grid", "display"],
6714
+ ["table", "display"],
6715
+ ["inline-table", "display"],
6716
+ ["table-caption", "display"],
6717
+ ["table-cell", "display"],
6718
+ ["table-column", "display"],
6719
+ ["table-column-group", "display"],
6720
+ ["table-footer-group", "display"],
6721
+ ["table-header-group", "display"],
6722
+ ["table-row-group", "display"],
6723
+ ["table-row", "display"],
6724
+ ["flow-root", "display"],
6725
+ ["contents", "display"],
6726
+ ["list-item", "display"],
6727
+ ["hidden", "display"],
6728
+ ["visible", "visibility"],
6729
+ ["invisible", "visibility"],
6730
+ ["collapse", "visibility"]
6731
+ ]);
6706
6732
  const noContradictingVariants = defineRule({
6707
6733
  meta: {
6708
6734
  type: "suggestion",
@@ -6717,24 +6743,42 @@ const noContradictingVariants = defineRule({
6717
6743
  },
6718
6744
  createOnce(context) {
6719
6745
  const getDS = createLazyLoader(context);
6720
- function variantFactsLookup() {
6721
- const ds = softGetDS(getDS);
6722
- if (!ds) return () => void 0;
6723
- return (variant) => ds.cache.getVariantFacts(variant);
6724
- }
6725
6746
  function check(locations) {
6726
- const factsFor = variantFactsLookup();
6747
+ const ds = softGetDS(getDS);
6748
+ const cache = ds ? ds.cache : null;
6749
+ const factsFor = (v) => ds ? ds.cache.getVariantFacts(v) : void 0;
6750
+ const propsOf = (bare) => {
6751
+ if (cache) {
6752
+ const props = cache.getCssProperties(bare);
6753
+ if (props.length > 0) return props;
6754
+ }
6755
+ const group = STATIC_PROP_GROUPS.get(bare);
6756
+ return group ? [group] : [];
6757
+ };
6727
6758
  for (const loc of locations) {
6728
6759
  if (!isFinalClassList(loc)) continue;
6729
6760
  const classes = splitClasses(loc.value);
6730
6761
  const baseUtilities = /* @__PURE__ */ new Set();
6731
6762
  for (const cls of classes) if (extractVariants(cls).length === 0) baseUtilities.add(cls);
6732
- for (const cls of classes) {
6763
+ for (let i = 0; i < classes.length; i++) {
6764
+ const cls = classes[i];
6733
6765
  const variants = extractVariants(cls);
6734
6766
  if (variants.length === 0) continue;
6735
6767
  if (variants.some((v) => changesTarget(v, factsFor(v)))) continue;
6736
6768
  const utility = extractUtility(cls);
6737
- if (baseUtilities.has(utility)) context.report({
6769
+ if (!baseUtilities.has(utility)) continue;
6770
+ const bare = splitImportant(utility).bare;
6771
+ const candidateProps = propsOf(bare);
6772
+ if (candidateProps.length > 0) {
6773
+ if (classes.some((other, j) => {
6774
+ if (j === i) return false;
6775
+ if (extractVariants(other).some((v) => changesTarget(v, factsFor(v)))) return false;
6776
+ const otherBare = splitImportant(extractUtility(other)).bare;
6777
+ if (otherBare === bare) return false;
6778
+ return propsOf(otherBare).some((p) => candidateProps.includes(p));
6779
+ })) continue;
6780
+ }
6781
+ context.report({
6738
6782
  node: loc.node,
6739
6783
  messageId: "redundantVariant",
6740
6784
  data: {
package/dist/index.mjs CHANGED
@@ -6707,6 +6707,32 @@ const noHardcodedColors = defineRule({
6707
6707
  });
6708
6708
  //#endregion
6709
6709
  //#region src/rules/no-contradicting-variants.ts
6710
+ const STATIC_PROP_GROUPS = /* @__PURE__ */ new Map([
6711
+ ["block", "display"],
6712
+ ["inline-block", "display"],
6713
+ ["inline", "display"],
6714
+ ["flex", "display"],
6715
+ ["inline-flex", "display"],
6716
+ ["grid", "display"],
6717
+ ["inline-grid", "display"],
6718
+ ["table", "display"],
6719
+ ["inline-table", "display"],
6720
+ ["table-caption", "display"],
6721
+ ["table-cell", "display"],
6722
+ ["table-column", "display"],
6723
+ ["table-column-group", "display"],
6724
+ ["table-footer-group", "display"],
6725
+ ["table-header-group", "display"],
6726
+ ["table-row-group", "display"],
6727
+ ["table-row", "display"],
6728
+ ["flow-root", "display"],
6729
+ ["contents", "display"],
6730
+ ["list-item", "display"],
6731
+ ["hidden", "display"],
6732
+ ["visible", "visibility"],
6733
+ ["invisible", "visibility"],
6734
+ ["collapse", "visibility"]
6735
+ ]);
6710
6736
  const noContradictingVariants = defineRule({
6711
6737
  meta: {
6712
6738
  type: "suggestion",
@@ -6721,24 +6747,42 @@ const noContradictingVariants = defineRule({
6721
6747
  },
6722
6748
  createOnce(context) {
6723
6749
  const getDS = createLazyLoader(context);
6724
- function variantFactsLookup() {
6725
- const ds = softGetDS(getDS);
6726
- if (!ds) return () => void 0;
6727
- return (variant) => ds.cache.getVariantFacts(variant);
6728
- }
6729
6750
  function check(locations) {
6730
- const factsFor = variantFactsLookup();
6751
+ const ds = softGetDS(getDS);
6752
+ const cache = ds ? ds.cache : null;
6753
+ const factsFor = (v) => ds ? ds.cache.getVariantFacts(v) : void 0;
6754
+ const propsOf = (bare) => {
6755
+ if (cache) {
6756
+ const props = cache.getCssProperties(bare);
6757
+ if (props.length > 0) return props;
6758
+ }
6759
+ const group = STATIC_PROP_GROUPS.get(bare);
6760
+ return group ? [group] : [];
6761
+ };
6731
6762
  for (const loc of locations) {
6732
6763
  if (!isFinalClassList(loc)) continue;
6733
6764
  const classes = splitClasses(loc.value);
6734
6765
  const baseUtilities = /* @__PURE__ */ new Set();
6735
6766
  for (const cls of classes) if (extractVariants(cls).length === 0) baseUtilities.add(cls);
6736
- for (const cls of classes) {
6767
+ for (let i = 0; i < classes.length; i++) {
6768
+ const cls = classes[i];
6737
6769
  const variants = extractVariants(cls);
6738
6770
  if (variants.length === 0) continue;
6739
6771
  if (variants.some((v) => changesTarget(v, factsFor(v)))) continue;
6740
6772
  const utility = extractUtility(cls);
6741
- if (baseUtilities.has(utility)) context.report({
6773
+ if (!baseUtilities.has(utility)) continue;
6774
+ const bare = splitImportant(utility).bare;
6775
+ const candidateProps = propsOf(bare);
6776
+ if (candidateProps.length > 0) {
6777
+ if (classes.some((other, j) => {
6778
+ if (j === i) return false;
6779
+ if (extractVariants(other).some((v) => changesTarget(v, factsFor(v)))) return false;
6780
+ const otherBare = splitImportant(extractUtility(other)).bare;
6781
+ if (otherBare === bare) return false;
6782
+ return propsOf(otherBare).some((p) => candidateProps.includes(p));
6783
+ })) continue;
6784
+ }
6785
+ context.report({
6742
6786
  node: loc.node,
6743
6787
  messageId: "redundantVariant",
6744
6788
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-tailwindcss",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Tailwind CSS linting rules for oxlint",
5
5
  "keywords": [
6
6
  "css",