oxlint-tailwindcss 0.7.0 → 0.7.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
@@ -842,7 +842,7 @@ The class parser correctly handles:
842
842
 
843
843
  ## Known limitations
844
844
 
845
- - **`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.
845
+ - **`enforce-canonical`**: Named classes are canonicalized via the precomputed map (covers everything in `getClassList()` plus a curated list of legacy v3 spellings like `break-words`, `flex-grow`, `start-N`, `bg-gradient-to-*`). Arbitrary/CSS-var forms (`p-[2px]`, `bg-(--c)`) are canonicalized dynamically via the worker. Some valid v4 classes that don't appear in `getClassList()` and have no canonical rewrite (e.g. `border-1` is valid as a dynamic numeric value but isn't enumerated) are left untouched.
846
846
  - **`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.
847
847
  - **`no-dark-without-light`**: Groups by utility prefix heuristic. May not perfectly match all multi-part utility prefixes.
848
848
  - **`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.
package/dist/index.cjs CHANGED
@@ -1024,6 +1024,47 @@ async function main() {
1024
1024
  }
1025
1025
  }
1026
1026
 
1027
+ // Legacy v3 classes that produce valid CSS in v4 but are not enumerated by
1028
+ // getClassList(). Tailwind's canonicalizeCandidates() still rewrites them to
1029
+ // their v4 equivalent, so we feed them in explicitly. Without this pass,
1030
+ // classes like \`break-words\` would be invisible to enforce-canonical
1031
+ // (issue #16).
1032
+ // - Fixed renames mirror the internal v3->v4 map in tailwindcss/canonicalize.
1033
+ // - Pattern renames (start-* -> inset-s-*, end-* -> inset-e-*) are derived
1034
+ // from the inset-{s,e}-* utilities present in validClasses so we cover
1035
+ // every numeric/named value the design system exposes.
1036
+ const legacyCandidates = [
1037
+ 'order-none',
1038
+ 'break-words',
1039
+ 'overflow-ellipsis',
1040
+ 'flex-grow', 'flex-grow-0', 'flex-grow-1',
1041
+ 'flex-shrink', 'flex-shrink-0', 'flex-shrink-1',
1042
+ 'decoration-clone', 'decoration-slice',
1043
+ 'bg-gradient-to-t', 'bg-gradient-to-tr', 'bg-gradient-to-r', 'bg-gradient-to-br',
1044
+ 'bg-gradient-to-b', 'bg-gradient-to-bl', 'bg-gradient-to-l', 'bg-gradient-to-tl',
1045
+ ];
1046
+ for (const cls of validClasses) {
1047
+ if (cls.startsWith('inset-s-')) legacyCandidates.push('start-' + cls.slice(8));
1048
+ else if (cls.startsWith('-inset-s-')) legacyCandidates.push('-start-' + cls.slice(9));
1049
+ else if (cls.startsWith('inset-e-')) legacyCandidates.push('end-' + cls.slice(8));
1050
+ else if (cls.startsWith('-inset-e-')) legacyCandidates.push('-end-' + cls.slice(9));
1051
+ }
1052
+ const legacyToProcess = legacyCandidates.filter(cls => !validSet.has(cls));
1053
+ if (legacyToProcess.length > 0) {
1054
+ const legacyCssResults = ds.candidatesToCss(legacyToProcess);
1055
+ for (let i = 0; i < legacyToProcess.length; i++) {
1056
+ if (legacyCssResults[i] == null) continue;
1057
+ const cls = legacyToProcess[i];
1058
+ const result = ds.canonicalizeCandidates([cls]);
1059
+ if (result[0] && result[0] !== cls) {
1060
+ canonical[cls] = result[0];
1061
+ }
1062
+ // Mark as valid so no-unknown-classes doesn't flag legacy spellings.
1063
+ validClasses.push(cls);
1064
+ validSet.add(cls);
1065
+ }
1066
+ }
1067
+
1027
1068
  // Sort order — include extra candidates so bare utilities (rounded, blur, etc.) get order
1028
1069
  const allForOrder = [...classNames];
1029
1070
  for (const cls of validClasses) {
@@ -1191,7 +1232,7 @@ async function main() {
1191
1232
  main().catch(e => { process.stderr.write(e.message); process.exit(1); });
1192
1233
  `;
1193
1234
  const CACHE_DIR = (0, node_path.join)((0, node_os.tmpdir)(), "oxlint-tailwindcss");
1194
- const CACHE_VERSION = 11;
1235
+ const CACHE_VERSION = 13;
1195
1236
  /**
1196
1237
  * Two-level disk cache for monorepo deduplication:
1197
1238
  *
package/dist/index.mjs CHANGED
@@ -1028,6 +1028,47 @@ async function main() {
1028
1028
  }
1029
1029
  }
1030
1030
 
1031
+ // Legacy v3 classes that produce valid CSS in v4 but are not enumerated by
1032
+ // getClassList(). Tailwind's canonicalizeCandidates() still rewrites them to
1033
+ // their v4 equivalent, so we feed them in explicitly. Without this pass,
1034
+ // classes like \`break-words\` would be invisible to enforce-canonical
1035
+ // (issue #16).
1036
+ // - Fixed renames mirror the internal v3->v4 map in tailwindcss/canonicalize.
1037
+ // - Pattern renames (start-* -> inset-s-*, end-* -> inset-e-*) are derived
1038
+ // from the inset-{s,e}-* utilities present in validClasses so we cover
1039
+ // every numeric/named value the design system exposes.
1040
+ const legacyCandidates = [
1041
+ 'order-none',
1042
+ 'break-words',
1043
+ 'overflow-ellipsis',
1044
+ 'flex-grow', 'flex-grow-0', 'flex-grow-1',
1045
+ 'flex-shrink', 'flex-shrink-0', 'flex-shrink-1',
1046
+ 'decoration-clone', 'decoration-slice',
1047
+ 'bg-gradient-to-t', 'bg-gradient-to-tr', 'bg-gradient-to-r', 'bg-gradient-to-br',
1048
+ 'bg-gradient-to-b', 'bg-gradient-to-bl', 'bg-gradient-to-l', 'bg-gradient-to-tl',
1049
+ ];
1050
+ for (const cls of validClasses) {
1051
+ if (cls.startsWith('inset-s-')) legacyCandidates.push('start-' + cls.slice(8));
1052
+ else if (cls.startsWith('-inset-s-')) legacyCandidates.push('-start-' + cls.slice(9));
1053
+ else if (cls.startsWith('inset-e-')) legacyCandidates.push('end-' + cls.slice(8));
1054
+ else if (cls.startsWith('-inset-e-')) legacyCandidates.push('-end-' + cls.slice(9));
1055
+ }
1056
+ const legacyToProcess = legacyCandidates.filter(cls => !validSet.has(cls));
1057
+ if (legacyToProcess.length > 0) {
1058
+ const legacyCssResults = ds.candidatesToCss(legacyToProcess);
1059
+ for (let i = 0; i < legacyToProcess.length; i++) {
1060
+ if (legacyCssResults[i] == null) continue;
1061
+ const cls = legacyToProcess[i];
1062
+ const result = ds.canonicalizeCandidates([cls]);
1063
+ if (result[0] && result[0] !== cls) {
1064
+ canonical[cls] = result[0];
1065
+ }
1066
+ // Mark as valid so no-unknown-classes doesn't flag legacy spellings.
1067
+ validClasses.push(cls);
1068
+ validSet.add(cls);
1069
+ }
1070
+ }
1071
+
1031
1072
  // Sort order — include extra candidates so bare utilities (rounded, blur, etc.) get order
1032
1073
  const allForOrder = [...classNames];
1033
1074
  for (const cls of validClasses) {
@@ -1195,7 +1236,7 @@ async function main() {
1195
1236
  main().catch(e => { process.stderr.write(e.message); process.exit(1); });
1196
1237
  `;
1197
1238
  const CACHE_DIR = join(tmpdir(), "oxlint-tailwindcss");
1198
- const CACHE_VERSION = 11;
1239
+ const CACHE_VERSION = 13;
1199
1240
  /**
1200
1241
  * Two-level disk cache for monorepo deduplication:
1201
1242
  *