oxlint-tailwindcss 1.7.0 → 1.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
@@ -990,6 +990,13 @@ the box. If you find one that doesn't, open an issue.
990
990
  - Tailwind CSS v4
991
991
  - oxlint >= 1.43.0
992
992
 
993
+ > **oxlint 1.77.0 crashes the language server.** Not a plugin bug, but you'll hit it through us:
994
+ > 1.77.0 panics the oxlint **language server** on any diagnostic from any JS plugin
995
+ > (`disable_fix.rs:52`, then SIGABRT and a restart loop). The upstream repro uses a different plugin
996
+ > — [oxc#25278](https://github.com/oxc-project/oxc/issues/25278) — and the fix
997
+ > ([oxc#25280](https://github.com/oxc-project/oxc/pull/25280)) is not released yet. The CLI is
998
+ > unaffected, so CI is fine; if you use the editor extension, pin `oxlint@1.76.0` for now.
999
+
993
1000
  ## License
994
1001
 
995
1002
  MIT
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@ let node_crypto = require("node:crypto");
3
3
  let node_fs = require("node:fs");
4
4
  let node_path = require("node:path");
5
5
  let node_os = require("node:os");
6
- //#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.js
6
+ //#region ../../node_modules/.pnpm/@oxlint+plugins@1.77.0/node_modules/@oxlint/plugins/index.js
7
7
  /**
8
8
  * Define a plugin.
9
9
  *
@@ -960,6 +960,14 @@ function roundRemValue(className) {
960
960
  //#region src/design-system/cache.ts
961
961
  const EMPTY_DECLARATIONS = [];
962
962
  const EMPTY_TOKEN_VALUES = [];
963
+ /** Off-scale numeric value: `w-45`, `min-h-17.5`, `gap-13`. */
964
+ const DYNAMIC_NUMERIC_RE = /^(.+)-\d+\.?\d*$/;
965
+ /**
966
+ * Off-scale percentage: `from-33%`, `via-51%`, `mask-b-from-70%`. The integer is
967
+ * not an accident — Tailwind compiles `from-33%` and does NOT compile
968
+ * `from-33.5%`, so a decimal here would be tolerance with nothing behind it.
969
+ */
970
+ const DYNAMIC_PERCENT_RE = /^(.+)-\d+%$/;
963
971
  var DesignSystemCache = class DesignSystemCache {
964
972
  canonicalMap = /* @__PURE__ */ new Map();
965
973
  deprecatedMap = /* @__PURE__ */ new Map();
@@ -976,7 +984,7 @@ var DesignSystemCache = class DesignSystemCache {
976
984
  variantFactsMap = /* @__PURE__ */ new Map();
977
985
  arbitraryEquivMap = /* @__PURE__ */ new Map();
978
986
  _validClasses = [];
979
- _knownPrefixes = null;
987
+ _prefixSets = null;
980
988
  _maxOrder = 0n;
981
989
  _prefix = "";
982
990
  componentSet = /* @__PURE__ */ new Set();
@@ -1116,15 +1124,56 @@ var DesignSystemCache = class DesignSystemCache {
1116
1124
  if (!this._prefixOrderMap) this._prefixOrderMap = this.buildPrefixOrderMap();
1117
1125
  return this._prefixOrderMap.get(prefix);
1118
1126
  }
1119
- getKnownPrefixes() {
1120
- if (!this._knownPrefixes) {
1121
- this._knownPrefixes = /* @__PURE__ */ new Set();
1127
+ /**
1128
+ * The two prefix sets the off-scale heuristics need, derived in ONE pass over
1129
+ * the ~23 600 valid class names.
1130
+ *
1131
+ * `known` is every dash-bounded prefix. `percent` is the subset that has at
1132
+ * least one enumerated class ending in `%`, and it exists because Tailwind
1133
+ * enumerates only 21 of the 101 percentages it compiles (0, 5, …, 100): a
1134
+ * `from-33%` is as real as a `w-45`, and was reported as a typo of `from-35%`
1135
+ * — a quick-fix that silently moves the gradient stop.
1136
+ *
1137
+ * The narrower set is the point. Accepting `<any known prefix>-N%` would reach
1138
+ * the ~1 780 prefixes Tailwind has, when only 22 take a percentage, and the
1139
+ * directional rules guard their replacements with `isValid` alone (no design
1140
+ * system to refute them), so `ml-33%` → `ms-33%` would start being reported and
1141
+ * autofixed from one dead class to another. Derived rather than listed: it
1142
+ * self-extends when a plugin enumerates percentage classes and self-prunes when
1143
+ * Tailwind stops emitting them.
1144
+ */
1145
+ prefixSets() {
1146
+ if (!this._prefixSets) {
1147
+ const known = /* @__PURE__ */ new Set();
1148
+ const percent = /* @__PURE__ */ new Set();
1122
1149
  for (const cls of this._validClasses) {
1123
1150
  const dash = cls.lastIndexOf("-");
1124
- if (dash > 0) this._knownPrefixes.add(cls.slice(0, dash));
1151
+ if (dash <= 0) continue;
1152
+ const prefix = cls.slice(0, dash);
1153
+ known.add(prefix);
1154
+ if (cls.endsWith("%")) percent.add(prefix);
1125
1155
  }
1156
+ this._prefixSets = {
1157
+ known,
1158
+ percent
1159
+ };
1126
1160
  }
1127
- return this._knownPrefixes;
1161
+ return this._prefixSets;
1162
+ }
1163
+ getKnownPrefixes() {
1164
+ return this.prefixSets().known;
1165
+ }
1166
+ /**
1167
+ * The utility prefix of an off-scale dynamic value, or null when the shape
1168
+ * doesn't match or the prefix doesn't take that kind of value. Shared by
1169
+ * `isValid` and `getOrder` so the two can't drift on what "dynamic" means.
1170
+ */
1171
+ dynamicValuePrefix(bare) {
1172
+ const numeric = DYNAMIC_NUMERIC_RE.exec(bare);
1173
+ if (numeric) return this.getKnownPrefixes().has(numeric[1]) ? numeric[1] : null;
1174
+ const percent = DYNAMIC_PERCENT_RE.exec(bare);
1175
+ if (percent) return this.prefixSets().percent.has(percent[1]) ? percent[1] : null;
1176
+ return null;
1128
1177
  }
1129
1178
  /**
1130
1179
  * Is this class name in the precomputed set VERBATIM?
@@ -1206,13 +1255,10 @@ var DesignSystemCache = class DesignSystemCache {
1206
1255
  if (slashIdx > 0) {
1207
1256
  const base = bare.slice(0, slashIdx);
1208
1257
  if (this.validitySet.has(base)) return true;
1209
- if (/^(.+)-(\d+\.?\d*)$/.test(base)) {
1210
- const dashIdx = base.lastIndexOf("-");
1211
- if (dashIdx > 0 && this.getKnownPrefixes().has(base.slice(0, dashIdx))) return true;
1212
- }
1258
+ const numericBase = DYNAMIC_NUMERIC_RE.exec(base);
1259
+ if (numericBase && this.getKnownPrefixes().has(numericBase[1])) return true;
1213
1260
  }
1214
- const numericMatch = /^(.+)-(\d+\.?\d*)$/.exec(bare);
1215
- if (numericMatch && this.getKnownPrefixes().has(numericMatch[1])) return true;
1261
+ if (this.dynamicValuePrefix(bare) !== null) return true;
1216
1262
  if (hasArbitraryValue(className)) return true;
1217
1263
  if (bare.includes("(") && bare.includes(")")) return true;
1218
1264
  return false;
@@ -1280,9 +1326,8 @@ var DesignSystemCache = class DesignSystemCache {
1280
1326
  }
1281
1327
  }
1282
1328
  if (baseOrder === void 0) {
1283
- const stripped = splitImportant(utility).bare;
1284
- const numericMatch = /^(.+)-(\d+\.?\d*)$/.exec(stripped);
1285
- if (numericMatch && this.getKnownPrefixes().has(numericMatch[1])) baseOrder = this.findOrderByPrefix(numericMatch[1] + "-");
1329
+ const prefix = this.dynamicValuePrefix(splitImportant(utility).bare);
1330
+ if (prefix) baseOrder = this.findOrderByPrefix(prefix + "-");
1286
1331
  }
1287
1332
  if (baseOrder === void 0) return null;
1288
1333
  if (!hasVariant) return baseOrder;
@@ -3692,7 +3737,12 @@ const noUnknownClasses = defineRule({
3692
3737
  const { variant, bare, position } = strippedUtility(cls);
3693
3738
  if (validity === "valid" && !variant && cache.isKnownClass(bare)) continue;
3694
3739
  if (cache.deprecatedReplacement(bare)) continue;
3695
- if (validity === "missing-prefix") {
3740
+ const compiles = cache.isKnownClass(bare) ? true : verified?.get(bare);
3741
+ const prefixWritten = !cache.prefix || variant.startsWith(`${cache.prefix}:`);
3742
+ let effectiveValidity = validity;
3743
+ if (validity === "unknown" && compiles === true) effectiveValidity = prefixWritten ? "valid" : "missing-prefix";
3744
+ else if (validity === "missing-prefix" && compiles === false) effectiveValidity = "unknown";
3745
+ if (effectiveValidity === "missing-prefix") {
3696
3746
  const fixed = `${cache.prefix}:${cls}`;
3697
3747
  reportWithSuggestion(loc, classes, cls, fixed, "missingPrefix", {
3698
3748
  className: cls,
@@ -3701,9 +3751,17 @@ const noUnknownClasses = defineRule({
3701
3751
  }, split);
3702
3752
  continue;
3703
3753
  }
3704
- if (cache.isMarkerClass(bare) && (!cache.prefix || variant.startsWith(`${cache.prefix}:`))) continue;
3705
- const compiles = cache.isKnownClass(bare) ? true : verified?.get(bare);
3706
- if (validity === "unknown" || compiles === false) {
3754
+ if (cache.isMarkerClass(bare)) {
3755
+ if (prefixWritten) continue;
3756
+ const fixed = `${cache.prefix}:${cls}`;
3757
+ reportWithSuggestion(loc, classes, cls, fixed, "missingPrefix", {
3758
+ className: cls,
3759
+ prefix: cache.prefix,
3760
+ suggestion: fixed
3761
+ }, split);
3762
+ continue;
3763
+ }
3764
+ if (effectiveValidity === "unknown" || compiles === false) {
3707
3765
  const suggestionBare = findBestSuggestion(bare, cache.validClasses);
3708
3766
  const suggestion = suggestionBare ? variant + reattachImportant(suggestionBare, position) : null;
3709
3767
  if (suggestion) reportWithSuggestion(loc, classes, cls, suggestion, "unknownWithSuggestion", {
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.d.ts
1
+ //#region ../../node_modules/.pnpm/@oxlint+plugins@1.77.0/node_modules/@oxlint/plugins/index.d.ts
2
2
  //#endregion
3
3
  //#region src-js/plugins/tokens.d.ts
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.d.ts
1
+ //#region ../../node_modules/.pnpm/@oxlint+plugins@1.77.0/node_modules/@oxlint/plugins/index.d.ts
2
2
  //#endregion
3
3
  //#region src-js/plugins/tokens.d.ts
4
4
  /**
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { tmpdir, userInfo } from "node:os";
7
7
  //#region \0rolldown/runtime.js
8
8
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
9
9
  //#endregion
10
- //#region ../../node_modules/.pnpm/@oxlint+plugins@1.76.0/node_modules/@oxlint/plugins/index.js
10
+ //#region ../../node_modules/.pnpm/@oxlint+plugins@1.77.0/node_modules/@oxlint/plugins/index.js
11
11
  /**
12
12
  * Define a plugin.
13
13
  *
@@ -964,6 +964,14 @@ function roundRemValue(className) {
964
964
  //#region src/design-system/cache.ts
965
965
  const EMPTY_DECLARATIONS = [];
966
966
  const EMPTY_TOKEN_VALUES = [];
967
+ /** Off-scale numeric value: `w-45`, `min-h-17.5`, `gap-13`. */
968
+ const DYNAMIC_NUMERIC_RE = /^(.+)-\d+\.?\d*$/;
969
+ /**
970
+ * Off-scale percentage: `from-33%`, `via-51%`, `mask-b-from-70%`. The integer is
971
+ * not an accident — Tailwind compiles `from-33%` and does NOT compile
972
+ * `from-33.5%`, so a decimal here would be tolerance with nothing behind it.
973
+ */
974
+ const DYNAMIC_PERCENT_RE = /^(.+)-\d+%$/;
967
975
  var DesignSystemCache = class DesignSystemCache {
968
976
  canonicalMap = /* @__PURE__ */ new Map();
969
977
  deprecatedMap = /* @__PURE__ */ new Map();
@@ -980,7 +988,7 @@ var DesignSystemCache = class DesignSystemCache {
980
988
  variantFactsMap = /* @__PURE__ */ new Map();
981
989
  arbitraryEquivMap = /* @__PURE__ */ new Map();
982
990
  _validClasses = [];
983
- _knownPrefixes = null;
991
+ _prefixSets = null;
984
992
  _maxOrder = 0n;
985
993
  _prefix = "";
986
994
  componentSet = /* @__PURE__ */ new Set();
@@ -1120,15 +1128,56 @@ var DesignSystemCache = class DesignSystemCache {
1120
1128
  if (!this._prefixOrderMap) this._prefixOrderMap = this.buildPrefixOrderMap();
1121
1129
  return this._prefixOrderMap.get(prefix);
1122
1130
  }
1123
- getKnownPrefixes() {
1124
- if (!this._knownPrefixes) {
1125
- this._knownPrefixes = /* @__PURE__ */ new Set();
1131
+ /**
1132
+ * The two prefix sets the off-scale heuristics need, derived in ONE pass over
1133
+ * the ~23 600 valid class names.
1134
+ *
1135
+ * `known` is every dash-bounded prefix. `percent` is the subset that has at
1136
+ * least one enumerated class ending in `%`, and it exists because Tailwind
1137
+ * enumerates only 21 of the 101 percentages it compiles (0, 5, …, 100): a
1138
+ * `from-33%` is as real as a `w-45`, and was reported as a typo of `from-35%`
1139
+ * — a quick-fix that silently moves the gradient stop.
1140
+ *
1141
+ * The narrower set is the point. Accepting `<any known prefix>-N%` would reach
1142
+ * the ~1 780 prefixes Tailwind has, when only 22 take a percentage, and the
1143
+ * directional rules guard their replacements with `isValid` alone (no design
1144
+ * system to refute them), so `ml-33%` → `ms-33%` would start being reported and
1145
+ * autofixed from one dead class to another. Derived rather than listed: it
1146
+ * self-extends when a plugin enumerates percentage classes and self-prunes when
1147
+ * Tailwind stops emitting them.
1148
+ */
1149
+ prefixSets() {
1150
+ if (!this._prefixSets) {
1151
+ const known = /* @__PURE__ */ new Set();
1152
+ const percent = /* @__PURE__ */ new Set();
1126
1153
  for (const cls of this._validClasses) {
1127
1154
  const dash = cls.lastIndexOf("-");
1128
- if (dash > 0) this._knownPrefixes.add(cls.slice(0, dash));
1155
+ if (dash <= 0) continue;
1156
+ const prefix = cls.slice(0, dash);
1157
+ known.add(prefix);
1158
+ if (cls.endsWith("%")) percent.add(prefix);
1129
1159
  }
1160
+ this._prefixSets = {
1161
+ known,
1162
+ percent
1163
+ };
1130
1164
  }
1131
- return this._knownPrefixes;
1165
+ return this._prefixSets;
1166
+ }
1167
+ getKnownPrefixes() {
1168
+ return this.prefixSets().known;
1169
+ }
1170
+ /**
1171
+ * The utility prefix of an off-scale dynamic value, or null when the shape
1172
+ * doesn't match or the prefix doesn't take that kind of value. Shared by
1173
+ * `isValid` and `getOrder` so the two can't drift on what "dynamic" means.
1174
+ */
1175
+ dynamicValuePrefix(bare) {
1176
+ const numeric = DYNAMIC_NUMERIC_RE.exec(bare);
1177
+ if (numeric) return this.getKnownPrefixes().has(numeric[1]) ? numeric[1] : null;
1178
+ const percent = DYNAMIC_PERCENT_RE.exec(bare);
1179
+ if (percent) return this.prefixSets().percent.has(percent[1]) ? percent[1] : null;
1180
+ return null;
1132
1181
  }
1133
1182
  /**
1134
1183
  * Is this class name in the precomputed set VERBATIM?
@@ -1210,13 +1259,10 @@ var DesignSystemCache = class DesignSystemCache {
1210
1259
  if (slashIdx > 0) {
1211
1260
  const base = bare.slice(0, slashIdx);
1212
1261
  if (this.validitySet.has(base)) return true;
1213
- if (/^(.+)-(\d+\.?\d*)$/.test(base)) {
1214
- const dashIdx = base.lastIndexOf("-");
1215
- if (dashIdx > 0 && this.getKnownPrefixes().has(base.slice(0, dashIdx))) return true;
1216
- }
1262
+ const numericBase = DYNAMIC_NUMERIC_RE.exec(base);
1263
+ if (numericBase && this.getKnownPrefixes().has(numericBase[1])) return true;
1217
1264
  }
1218
- const numericMatch = /^(.+)-(\d+\.?\d*)$/.exec(bare);
1219
- if (numericMatch && this.getKnownPrefixes().has(numericMatch[1])) return true;
1265
+ if (this.dynamicValuePrefix(bare) !== null) return true;
1220
1266
  if (hasArbitraryValue(className)) return true;
1221
1267
  if (bare.includes("(") && bare.includes(")")) return true;
1222
1268
  return false;
@@ -1284,9 +1330,8 @@ var DesignSystemCache = class DesignSystemCache {
1284
1330
  }
1285
1331
  }
1286
1332
  if (baseOrder === void 0) {
1287
- const stripped = splitImportant(utility).bare;
1288
- const numericMatch = /^(.+)-(\d+\.?\d*)$/.exec(stripped);
1289
- if (numericMatch && this.getKnownPrefixes().has(numericMatch[1])) baseOrder = this.findOrderByPrefix(numericMatch[1] + "-");
1333
+ const prefix = this.dynamicValuePrefix(splitImportant(utility).bare);
1334
+ if (prefix) baseOrder = this.findOrderByPrefix(prefix + "-");
1290
1335
  }
1291
1336
  if (baseOrder === void 0) return null;
1292
1337
  if (!hasVariant) return baseOrder;
@@ -3696,7 +3741,12 @@ const noUnknownClasses = defineRule({
3696
3741
  const { variant, bare, position } = strippedUtility(cls);
3697
3742
  if (validity === "valid" && !variant && cache.isKnownClass(bare)) continue;
3698
3743
  if (cache.deprecatedReplacement(bare)) continue;
3699
- if (validity === "missing-prefix") {
3744
+ const compiles = cache.isKnownClass(bare) ? true : verified?.get(bare);
3745
+ const prefixWritten = !cache.prefix || variant.startsWith(`${cache.prefix}:`);
3746
+ let effectiveValidity = validity;
3747
+ if (validity === "unknown" && compiles === true) effectiveValidity = prefixWritten ? "valid" : "missing-prefix";
3748
+ else if (validity === "missing-prefix" && compiles === false) effectiveValidity = "unknown";
3749
+ if (effectiveValidity === "missing-prefix") {
3700
3750
  const fixed = `${cache.prefix}:${cls}`;
3701
3751
  reportWithSuggestion(loc, classes, cls, fixed, "missingPrefix", {
3702
3752
  className: cls,
@@ -3705,9 +3755,17 @@ const noUnknownClasses = defineRule({
3705
3755
  }, split);
3706
3756
  continue;
3707
3757
  }
3708
- if (cache.isMarkerClass(bare) && (!cache.prefix || variant.startsWith(`${cache.prefix}:`))) continue;
3709
- const compiles = cache.isKnownClass(bare) ? true : verified?.get(bare);
3710
- if (validity === "unknown" || compiles === false) {
3758
+ if (cache.isMarkerClass(bare)) {
3759
+ if (prefixWritten) continue;
3760
+ const fixed = `${cache.prefix}:${cls}`;
3761
+ reportWithSuggestion(loc, classes, cls, fixed, "missingPrefix", {
3762
+ className: cls,
3763
+ prefix: cache.prefix,
3764
+ suggestion: fixed
3765
+ }, split);
3766
+ continue;
3767
+ }
3768
+ if (effectiveValidity === "unknown" || compiles === false) {
3711
3769
  const suggestionBare = findBestSuggestion(bare, cache.validClasses);
3712
3770
  const suggestion = suggestionBare ? variant + reattachImportant(suggestionBare, position) : null;
3713
3771
  if (suggestion) reportWithSuggestion(loc, classes, cls, suggestion, "unknownWithSuggestion", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxlint-tailwindcss",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Tailwind CSS linting rules for oxlint",
5
5
  "keywords": [
6
6
  "css",
@@ -57,10 +57,10 @@
57
57
  "devDependencies": {
58
58
  "@oxlint/plugins": "catalog:",
59
59
  "@tailwindcss/typography": "^0.5.20",
60
- "@types/node": "^26.1.1",
60
+ "@types/node": "^26.1.2",
61
61
  "oxlint": "catalog:",
62
62
  "tailwindcss-animate": "^1.0.7",
63
- "tsdown": "^0.22.12",
63
+ "tsdown": "^0.22.14",
64
64
  "tw-animate-css": "^1.4.0",
65
65
  "typescript": "^7.0.2",
66
66
  "vitest": "^4.1.10"