Repository navigation
Description
Needs your OK: this adds checks on the translation catalogs and lint rules against hard-coded text. Nothing anyone sees changes. Swap pipeline:proposed for pipeline:ready to have it built.
What happens
Once text lives in src/messages/*.json (#620), nothing stops a translation from missing keys, breaking ICU syntax or dropping a {name}. Nothing stops new English being typed straight into a component either.
Fix, in outline
- A catalog check that
pnpm testruns (a unit test oversrc/messages/, so CI covers it with no workflow change). It checks that:- every catalog's completeness is known per namespace against
en.json, and each language inSHIPPEDis complete for its audience (participant:participant,email,common; organizer:organizer,auth,common; site:site,common); - every message compiles with
icu-minify, which uses the same ICU parser as use-intl's full formatter; - placeholders and tags match the English source;
- no key is unused.
- every catalog's completeness is known per namespace against
- Keys are literal, so the unused-key check can see them. Map enum values to keys through a typed table (
const STATUS_KEY = { open: 'status.open', … } as const), nevert(`status.${s}`). - Lint for hard-coded text:
react/jsx-no-literalswithnoStrings: true, ignoreProps: truefor JSX text;- a small custom rule, in the local ESLint plugin from OpenSignup has no message catalogs or translator, so none of its text can be translated #620, that reports a string literal on text-bearing props:
aria-label,aria-description,title,placeholder,altandlabel. - Both are turned on per directory as each area moves to the catalog, starting with none.
Watch for
noAttributeStringsdoesn't work here. It flags everyclassNameandhref, and eslint-plugin-react 7.37.5 (what the lockfile resolves) has no per-attribute option.- Pin
icu-minifyas a devDependency at the exact version next-intl resolves, so the check runs the parser production runs.
Order
After #620, because the catalogs, SHIPPED and the local ESLint plugin come from it.
Done when
- The check fails on a missing key, broken ICU, a dropped placeholder and an unused key (tests with fixture catalogs).
- The lint rules fail on a fixture with JSX text and one with
aria-label="…". pnpm lint && pnpm typecheck && pnpm knip && pnpm testpass.
Planned with the owner in https://claude.ai/code/session_01EFKmj716ZY3b3SwR8TV8Y2 and checked against the code on main at 35288fa. The full plan is private to the owner's account: https://claude.ai/artifact/VgQH6U2s2EVx3LX991fJi8 (a Claude session on that account can open it with the Artifact tool's read action). This is step 0.4 there.
Activity