Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(lint): compare the prose skip against a posix path\n\n`lint:ui-tokens` fails on a Windows checkout with 15 violations, every one of\nthem English out of a translation catalogue:\n\n src\lib\i18n\en.ts:237: text-to-speech (to-speech is not a token this theme defines)\n src\lib\i18n\en.ts:690: to-dos (dos is not a token this theme defines)\n src\lib\i18n\it.ts:818: to-do (do is not a token this theme defines)\n\n`holdsProseNotClasses` exists precisely to prevent this, and its own doc\ncomment names these exact strings. It never fires on Windows: `path.relative`\nreturns the platform separator, so the value it tests is `src\lib\i18n\en.ts`,\nand `startsWith('src/lib/i18n/')` and `includes('/__tests__/')` both miss.\nThe catalogues are then read as class lists, where "text-to-speech" parses as\n`text-` plus an undefined token.\n\nThe gate is in `.husky/pre-push`, so on Windows it blocks every push with a\nfailure the author cannot have caused and cannot silence — the suggested\nremedy ("choose a defined semantic token") does not apply to prose.\n\nNormalising to `/` before the comparisons is the whole change; the same walk\nalready yields platform paths to every other check, which are separator-blind.\n\nVerified on this host: `node scripts/lint-undefined-scales.mjs` goes from\n15 violations to `no undefined colour scales or tokens (30 shade-bearing\nscales, 68 shadeless colours, 18 shadows)`, and reverting the two-line change\nbrings all 15 back.\n

Nguyen Thanh Datd3bc9148ab95
diff --git a/app/scripts/lint-undefined-scales.mjs b/app/scripts/lint-undefined-scales.mjs
index 83672724b8..7e7a2e2d07 100644
--- a/app/scripts/lint-undefined-scales.mjs
+++ b/app/scripts/lint-undefined-scales.mjs
@@ -354,10 +354,16 @@ function* walk(dir) {
* is loose enough to trip on those, so only it skips them.
*/
function holdsProseNotClasses(relative) {
+ // `path.relative` yields the platform separator, so on Windows these paths
+ // arrive as `src\\lib\\i18n\\en.ts` and every `/`-spelled test below misses.
+ // The skip then never fires and the catalogues are scanned as class lists:
+ // "text-to-speech" is read as `text-` + an undefined token.
+ const posix = relative.split(path.sep).join('/');
+
return (
- relative.startsWith('src/lib/i18n/') ||
- relative.includes('/__tests__/') ||
- /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(relative)
+ posix.startsWith('src/lib/i18n/') ||
+ posix.includes('/__tests__/') ||
+ /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(posix)
);
}