Fail the build when a component calls a key messages/ does not define

Featurekamo-internal
Shipped
August 4, 2026 at 5:59 PM UTC
Author
kamo
Commit
4b14389

next-intl renders the key path verbatim for a missing key, and messages/ is gitignored here — populated at image-build time from kamo-translation-dictionary — so a rename that lands in only one of the two repos ships as visible gibberish with nothing to catch it. That is how the department contact fields came to render **************** on the settings screen, and how the entire HMDA demographics form (39 labels) shipped against a namespace that only contained `lar`. scripts/check-i18n-keys.mjs resolves each translator binding's namespace, then checks every literal key, the static prefix of every template-literal key, and the values passed against the {placeholders} in the message — in both directions, since an unsupplied ICU argument throws MissingValueError and an unused one silently drops data. It understands ICU brace escaping and plural sub-messages, and treats <tag> as a placeholder only for t.rich/t.markup. 1737 files in ~1.4s. Wired into `npm test` and into the Dockerfile ahead of the build, with --require-messages there so a skipped dictionary sync fails loudly instead of turning the guard into a no-op. Typing t() against `typeof en` was tried first and rejected: a JSON import widens values to `string`, so next-intl cannot infer placeholders and rejects correct calls like t('...range', {start, end, total}); it also tripled typecheck time (81s -> 249s) and would have needed ~150 edits to non-buggy code. Call-site fixes for what it found: - dropped a `default:` option passed to t() in the chat components and LanguageButton; next-intl has no such fallback option, so it was dead weight. - commerce lowStock passed {count} for {available}, MultiFileUploader {types} for {list}, and audioVideo master volume {pct} for {percent} — all three threw at format time. - DnsSetupStudio passed a {domain} its subtitle does not use.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing