Repository navigation
Conversation
A call such as `$_('welcome', { values: { name } })` kept its params inside
`values`, which `ParamsSource` had no way to name, so `param-mismatch` saw no
params at all and reported neither the missing nor the unused ones.
`ParamsSource` gains `property`, the property of the argument that holds the
params object, and the svelte-i18n preset points it at `options.values`.
A call that passes options without `values`, or none, now reports `[]` rather
than an unreadable params object, so the missing placeholders still show up.
Fixes #156
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
$_('welcome', { values: { name } })keeps its message params insidevalues, andParamsSourcehad no way to name that property. The svelte-i18n preset recorded no params for such a call, soparam-mismatchreported neither the missingnamenor the unusedwhoat the call site.ParamsSourcegainsproperty, the dot-separated path to the object that holds the params, and the svelte-i18n preset points it atoptions.values. The preset's single callee list splits in two:$_,$t,_andttake message params, while$format,$json,formatandjsonkeep their second argument as Intl options.A call that passes options without
values, or none at all, now records[]instead of an unreadable params object, so a missing placeholder still gets reported. An unreadablevaluessource ({ values },{ values: opts },{ values: { ...opts } }) stays unknown and the check skips it.values#156User prompts
opencode-go/deepseek-v4.1-flash, harness:pivalues#156 on a new branch.Verification
Repro from the issue: a component with
$_('greeting')and$_('welcome', { values: { who: 'Alice', unused: 'Bob' } })against{ "welcome": "Hello {name}" }, checked with the built CLI.Before (base
f49a4d74):After (this branch):
$_('greeting')stays quiet in both runs, because a call with no options has no params to compare.Gates run on this branch:
pnpm lint,pnpm knip,pnpm typecheck,pnpm test(969 passing),pnpm build,pnpm exec x18n check --strict.pnpm -C docs run generate --checkfails oncontent/6.references/4.lsp-protocol.md, which is already stale onmainand unrelated to this change. The config page this PR regenerates is up to date.Tests added:
scanners.test.tscovers params undervalues, an options object without it, an unreadablevalues, a spread, and a string argument skipped before the params object.presets.test.tscovers the issue's component and asserts the diagnostic text andusage.params.Drafted with an agent (
pi,opencode-go/deepseek-v4.1-flash). The human gave the task and corrected the issue state. No human has reviewed the diff yet.