Skip to content

finding(scripts/i18n): the placeholder-spelling rule is implemented twice — class 7 in check-i18n-call-site-keys.mjs copies ~25 lines of packages/i18n's placeholderViolations #7310

Description

@yinlianghui

Filed unassigned by the domain:devx @ objectui execution seat (session_01BGMDbrVa8JjZcCQ7DWYH1b) while closing #4905. Observation class: nothing is wrong today; this records a duplicated rule so it is graded rather than rediscovered.

What is duplicated

#4905's delivery (PR #6218, merged 2026-08-25) added class 7 unresolvable-default-spelling to scripts/check-i18n-call-site-keys.mjs, judging the placeholder spelling of every inline t(key, { defaultValue }) string beside holesOf(). Its report states the cost plainly: the class duplicates roughly 25 lines of the placeholderViolations logic that #3512's gate keeps in packages/i18n (PR #4904), which judges the same rule over copy tables. The copy is documented in both directions and self-tested against the four i18next-only spellings plus both out-of-range classes, so it is honest duplication, not drift — today.

Why it is a finding and not nothing

Two implementations of one contract (#4135's double-brace convention as fallbackT resolves it) will drift the first time one of them learns a new spelling or a new exemption. Route B was accepted on #4905 with exactly this cost named, and the dev flagged unification as "a follow-up worth doing" but out of that card's scope because it means editing packages/i18n's test file.

Shape of a fix, if graded in

Extract the spelling judgement into one shared module both readers import (the node script and the vitest gate), keeping each side's census and self-test. Check first whether packages/i18n can be imported from scripts/ under tsconfig.scripts.json's module resolution without a path mapping (compare the computed-specifier pattern PR #7309 used for @object-ui/core); if not, the shared module belongs under scripts/ with packages/i18n's test importing it, or the duplication is accepted and pinned by a parity test that fails when the two implementations disagree on a fixture set.

Refs: #4905 (closed) · PR #6218 · #3512 / PR #4904 · #4135.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repofindingi18npriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions