Repository navigation
fix(i18n): lint visible English literals, and wire the header caption - #181
Conversation
The caption on every chromed page's mega-menu was a JSX literal, so it stayed English in every locale. `navigation.featured_caption` already held the same string, so this is a wiring fix and needs no new key. The hook belongs in `FeaturedArticleColumn`, not the exported component: that inner component owns the markup. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AhcbUT9cprRA3oWuNcTWdH
Its `<title>` gave a decorative brand animation an English accessible name, inside a `role="status"` region that already names itself from a translated label — so a screen reader read "WeMeditate Animated Logo" over the loading message in every locale. `FloralDividerSvg`, `HeaderIllustrationSvg` and `LeafSvg` all set aria-hidden before the spread, which lets a caller opt back in. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AhcbUT9cprRA3oWuNcTWdH
Neither guard under `tests/guards/` could see visible copy: both match
source text, so `<p>Inspiration comes from within</p>` and
`title="Meditate Now"` passed, and `a11y-literals` said so in its own
docblock. Four `no-restricted-syntax` selectors read the AST instead,
over JSX text and over alt, aria-label, label, placeholder, subtitle and
title — including a braced literal and either arm of a ternary.
Two consecutive ASCII letters is the prose test, so a separator or a
lone initial passes. A key inside `t('a.b')` is not a Literal child of
the attribute, so a resolved call never trips it.
`tests/guards/jsx-literals.test.ts` asks ESLint itself whether the
selectors match. A selector that matches nothing fails open, which would
make lint green and ship every literal.
Four sites keep the old literals behind a commented region, each naming
why: the error details panel and the unimplemented-node notice render in
DEV only, the Sentry page exists to throw test errors, and the player
upsell and `DiscoverMeditation` need keys that do not exist upstream yet
(#178, and this ticket's third phase).
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AhcbUT9cprRA3oWuNcTWdH
Review found three gaps and one false claim.
A braced literal and a backticked one were both missed, so the string
this branch fixes in `HeaderDropdown` passed again the moment someone
wrote `{'Inspiration comes from within'}`. Both spellings are now
covered, for JSX children and for every copy prop — excluding a
`<style>` or `<script>` child, whose backticks hold CSS.
`alt` gets its own message: an untranslated alt is as often decorative,
and `alt=""` is the right fix there, which this branch's own
`AnimatedLogoSvg` change shows. A message offering only `t()` nudges
toward translating chrome.
The config comment claimed `aria-label={SOME_CONST}` as its motivation,
which the rule cannot see and the guard beside it says so. It now states
what the selectors do read, and that an identifier passes.
`a11y-literals` is kept for the reason that is actually true: it strips
comments, so no `eslint-disable` silences it. The reason it gave —
invisible in `pnpm test:run` — was backwards, since lint runs first in
both CI and the local gate.
Also: `repoRoot` from `_source-scan` instead of a second definition, one
`lintText` per case asserting the reported lines, and a fixture spread
from `EN_TRANSLATIONS` rather than cast.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AhcbUT9cprRA3oWuNcTWdH
The bullet said two guards under `tests/guards/` enforce it, which was never true of visible text and is no longer the whole story. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AhcbUT9cprRA3oWuNcTWdH
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 456ae9e | Commit Preview URL Branch Preview URL |
Oct 10 2026, 08:13 PM |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape is right. A lint rule in the one place every author already runs beats the same rule as prose in AGENTS.md, and phase 1 matches the ticket. The six disable regions are the rule's price, not scope creep.
The rule's reach does not hold. It enumerates AST paths, so it covers the spellings someone thought of. Five prop names this repo uses for copy are missing, and braced copy in children position escapes through && or a ternary — the same ternary the rule catches on a prop. Widening costs two lines and keeps lint at 0, so take it now rather than wait for the named-rule follow-up.
Two guards now cover one concern, and #165 asked whether a11y-literals.test.ts survives. Its kept reason is real but unexercised: no region here hides anything it would catch.
Findings
should-fix—COPY_PROPSmissesdescription,text,buttonText,caption,heading(eslint.config.js:9).should-fix—{cond && 'copy'}and{cond ? 'a' : 'b'}as children pass unflagged (eslint.config.js:190).consider— a whole-file disable belongs in the block'signores(pages/sentry/+Page.tsx:1).consider— "catches every spelling" names three (tests/guards/jsx-literals.test.ts:43).
What was checked
- Read #165 and the whole diff:
eslint.config.js, both guards,HeaderDropdown,AnimatedLogoSvgand its consumers (Spinner.tsx:109-118names itself;SplashLoaderhas no production mount). - Ran this branch's config in a scratch worktree. Baseline reproduces at 0 errors; probes confirm four escaping shapes; the widened selectors still report 0 across all three scoped globs.
- No contract surface moves: no
server/, nopayload-types.ts. - Grepped for live leaks: both holes are latent — the escaping shapes carry only class names, and the unenumerated props take literals only in JSDoc.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`description`, `text`, `buttonText`, `caption` and `heading` are what this tree calls copy far more often than `subtitle`: 16 prop declarations under `components/**` use one of them. `<TechniqueCard description="Sit quietly" />` passed the rule the ticket added it for. Lint stays at 0 errors over all three scoped globs. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X14a5zgbn88jrtpwtxoHXU
`{cond && 'copy'}` and `{cond ? 'a' : 'b'}` in children position passed the
rule, as did `title={cond && 'copy'}` and a braced string in a fragment — the
same ternary the prop selectors already report. Children enumerated two paths
where a prop enumerated three.
`copyBraced` is now the one definition of "a brace, directly or through a
branch", shared by both positions, so the two cannot drift apart again.
Lint stays at 0 errors over all three scoped globs.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01X14a5zgbn88jrtpwtxoHXU
"every spelling" was three spellings, and the ones that escaped were the ones a reader assumes it covers. A green suite is not proof of completeness, so the name states what the case checks rather than claiming the set is closed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X14a5zgbn88jrtpwtxoHXU
A whole-file `eslint-disable` is config written in the wrong place: the block already names `*.stories.tsx` and `components/ladle/**` in `ignores`, and a developer's error-trigger page belongs beside them. The file-level form also silenced every future `no-restricted-syntax` rule there, since the id is shared across all three selectors. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X14a5zgbn88jrtpwtxoHXU
The bullet enumerated five prop names and the rule now names ten, so the list belongs in one place. It also said nothing about a braced string or a branch arm, which the rule now rejects, and nothing about `ignores` as the home for a tree that is not visitor copy at all. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01X14a5zgbn88jrtpwtxoHXU
|
All four review findings adopted, pushed as 456ae9e.
Nine shapes measured escaping before, reporting after. Lint holds at 0 errors. Gate: lint, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
useT(), so it stops being English in every locale.Change outline
The rule is the change. It states, in the one place every component author already runs, what
AGENTS.mdonly said in prose.Contract — what a component may write where a visitor reads
eslint.config.js, overcomponents/**,layouts/**andpages/**:An identifier still passes —
aria-label={CLOSE}is not aLiteral— so the rule bounds thespellings rather than proving intent. See the detail block for the follow-up that would close that.
Components — the two that stopped speaking English
Spinner's logo variant already wraps it inrole="status"with a translatedaria-labeland ansr-onlycopy of that label (components/atoms/Spinner/Spinner.tsx:109-118), so a screen readerread the English title over the translated status message. Translating the
<title>would have beenthe symptom fix.
Files — the guard family after this
tests/guards/ ├── _source-scan.ts # repo root, file list, comment blanking ├── a11y-literals.test.ts # text matching, and unsuppressible: it strips comments, │ # so no eslint-disable silences the #56 subset ├── translation-keys.test.ts # every t() key resolves in the committed snapshot +└── jsx-literals.test.ts # asks ESLint whether the new selectors match anythingPreview
Phases
HeaderDropdownrenders its caption throughuseT()DiscoverMeditation's six strings, once feat(translations): add the keys WeMeditate Web still hardcodes SahajCloud#917 and fix(translations): wm-web-translations returns no English strings SahajCloud#918 landTest results
tsc --noEmit, 82 files / 815 teststests/guards/jsx-literals.test.ts5 passed,HeaderDropdown.locale.test.tsx1 passedpnpm build— the diff touchespages/sentry/+Page.tsx, and only a build catches a+filesecurityReview.triggerPatternno-restricted-syntaxis 0.05ms per file againstprettier/prettier's5.66ms, and the new guard adds ~1.4s of CPU in one Vitest worker, 86% of it ESLint cold start
Manual verification
not "Inspiration comes from within".
pnpm ladle, port 61000), theHeaderDropdownstory still shows the caption — it fallsback to the committed English snapshot there. Not run in this session; no dev server.
longer says "WeMeditate Animated Logo".
SplashLoader(
components/atoms/SplashLoader/SplashLoader.tsx:154) has no status role, so there the logo is nowpurely branding and its optional
textprop carries the message — worth a look if that is wrong.Notes for reviewer
merging it closes the ticket with its third phase undone. Re-open it then, or let the two upstream
tickets carry phase 3 — your call, but it is not automatic. The six
DiscoverMeditationstringshave no upstream keys (feat(translations): add the keys WeMeditate Web still hardcodes SahajCloud#917, which also covers the component's two English default
props — those are default parameter values, which no JSX selector can see), and
pnpm sync:translationsrefuses to run at all while production's global returns200 {}(fix(translations): wm-web-translations returns no English strings SahajCloud#918, re-measured 2026-10-10). Both are now
Blocked by:lines on the ticket.commented
eslint-disable no-restricted-syntaxregions across four files, each naming why: theerror-details panel and the RichText unimplemented-node notice render in DEV only, the RichText
debug button's label is a block type behind a
debugprop that defaults to false, the playerupsell needs keys (filed as fix(i18n): the meditation player's upsell copy stays English #178), and
DiscoverMeditationis phase 3.pages/sentry/**is no longer one of them — it is a whole tree that is never visitor copy, so itsits in the block's
ignoresbeside the stories and Ladle.The judgement worth checking is the DEV-only pair: both
ErrorFallbackcall sites passshowDetails={import.meta.env.DEV}(layouts/LayoutRoot.tsx:49,pages/_error/+Page.tsx:33), andthe RichText converter returns
nullunlessimport.meta.env.DEV.tests/guards/a11y-literals.test.tsis kept rather than deleted, and its caveat rewritten tothe one reason that survives scrutiny: it strips comments, so an
eslint-disablecannot silence it,and the screen-reader subset feat(i18n): consume CMS wm-web-translations + BCP-47 locale codes #56 was about stays enforced whatever a later
region suppresses. Deleting it is a defensible call and it is yours, not mine.
Detail
react/jsx-no-literalswas weighed and lost. The plugin is already installed andreact.configs.flat.recommendedis already in this config, and the rule shipsnoStrings,allowedStringsandnoAttributeStrings. ButallowedStringsis exact-match, so every separator andentity in the tree would become an enumerated allowlist, and its prop checking is all-props rather
than the ones that carry copy. The
/[A-Za-z]{2}/prose test and the named prop set are what makethe rule green on today's tree.
Why
>and never a descendant.JSXAttribute[name.name=/…/] Literal[…]would catch everynesting in one line, but it also matches the key inside
title={t('navigation.featured_caption')}—that key is a
Literalunder the attribute. So each accepted shape gets its own direct-child path.Why the brace paths are composed rather than listed. The children position and the prop position
each need the bare brace, a ternary arm and an
&&arm, which is six paths written twice.copyBracedis the one definition both call, so the positions cannot drift apart again — which is exactly how
{cond && 'copy'}shipped unflagged whiletitle={cond ? 'a' : 'b'}was caught.Why the test drives ESLint rather than re-implementing the selectors. A selector that matches
nothing fails open:
pnpm lintgoes green and every literal ships. The repo's existing guard says thesame of its own regexes, so the new file asks ESLint itself, with
lintTextresolving config byfilePath— which is also what pins the scope and the story/test exclusions. Each case is named forthe spellings it asserts, so a green suite is not read as proof that the set is closed.
The follow-ups this leaves, none of them in scope here:
(
plugins: { copy: { rules: … } }) could resolve a single-init module-scope identifier throughcontext.sourceCode.getScope(), which is the only wayaria-label={SOME_CONST}is ever caught. Itwould also give suppressions a specific id, where
no-restricted-syntaxis shared.Copytype.TFunctionreturns plainstring(lib/i18n.ts:149), so nothing in thetype system separates copy from any other string. Branding it and typing copy-carrying props
Copywould let
tscreject the three categories no selector or source scan reaches: default parametervalues, lookup tables in
.tsfiles, and composed strings.components/dev/directory for DEV-only chrome, exempted by glob the waycomponents/ladle/**and now
pages/sentry/**are, instead of the two remaining per-site exclusions that each restate theimport.meta.env.DEVgate differently.usePageContextmock idiom. The new locale test joins four others inliningvi.mock('vike-react/usePageContext', …). A factory intests/_helpers/is worth it now, but ittouches five unrelated test files.
SOURCE_GLOBSina11y-literals.test.ts, and the stories/tests filter in_source-scan.ts— with nothing tyingthem together.
eslint.config.jsimporting fromtests/is the wrong direction, so the fix is ashared module neither owns.
Part of #165
🤖 Generated with Claude Code
https://claude.ai/code/session_01AhcbUT9cprRA3oWuNcTWdH