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 records `[]` rather
than an unreadable params object, so the missing placeholders still show up.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
0froq
marked this pull request as ready for review
November 13, 2026 21:57
Member
Author
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "9a034557d4771a63c3f54f123c61bd858188cbd3",
"result": {
"overallSummary": "Fixes #156: svelte-i18n puts a message's params inside `options.values`, which `ParamsSource` could not express, so `param-mismatch` never saw those params. The PR adds an optional `property` path to `ParamsSource` and teaches the JS scanner to read the params object from it, then points the svelte-i18n preset's translators at `options.values` (and stops treating formatter calls' Intl options as params).",
"groups": [
{
"key": "params-property",
"label": "Params source property",
"summary": "Adds the generic capability: `ParamsSource.property`, a dot-separated path to the object holding the params, exposed in the public type and the config schema, and consumed by the scanner. The scanner now resolves the params object through that property and distinguishes \"call passes no options\" (`[]`, still comparable) from \"params cannot be read\" (`undefined`, check skipped).",
"category": "core",
"filePaths": [
"packages/core/src/types/config.ts",
"packages/core/src/schema.ts",
"packages/builtins/src/scanners/shared/js.ts"
],
"critical": true,
"fileNotes": [
{
"path": "packages/builtins/src/scanners/shared/js.ts",
"text": "The shared `paramObject` helper is the crux: `null` means the call has no params (so a missing placeholder is still reported) while `undefined` means unreadable (`opts`, `{ ...opts }`), which skips the check. Keep that distinction intact when refactoring — `paramNames` and `paramValues` both depend on it."
},
{
"path": "packages/core/src/types/config.ts",
"text": "`property` is optional, so existing presets keep their second-argument behaviour unchanged."
}
]
},
{
"key": "svelte-i18n-preset",
"label": "svelte-i18n preset",
"summary": "Splits the preset's callee list so only the translators (`$_`, `$t`, `_`, `t`) read message params, now from `arg: 1` + `property: 'values'`. The formatters (`$format`, `$json`, `format`, `json`) no longer pretend their second argument holds params, which also stops false `param-mismatch` reports on Intl options objects.",
"category": "api",
"filePaths": [
"packages/builtins/src/presets/svelte-i18n/index.ts"
],
"fileNotes": [
{
"path": "packages/builtins/src/presets/svelte-i18n/index.ts",
"text": "Behaviour change beyond the issue: formatter calls previously inherited the params spec, so an Intl options object like `{ number: { style: 'currency' } }` was compared against placeholders. Worth confirming no user relied on that."
}
]
},
{
"key": "tests",
"label": "Tests",
"summary": "Covers the new behaviour from both sides: a scanner-level test for the `property` lookup across all arg positions and unreadable forms, and an end-to-end svelte-i18n test reproducing the issue's component so the resulting `param-mismatch` message is pinned.",
"category": "tests",
"filePaths": [
"packages/builtins/test/presets.test.ts",
"packages/builtins/test/scanners.test.ts"
]
},
{
"key": "docs",
"label": "Config reference",
"summary": "Documents `ParamsSource.property` in the config reference next to `arg` and `options`, with the `t(key, { values: { n } })` example.",
"category": "docs",
"filePaths": [
"docs/content/6.references/1.config.md"
]
},
{
"key": "snapshots",
"label": "Schema/type snapshots",
"summary": "Generated snapshots updated mechanically for the new optional `property` field in both the published schema and the `.d.ts` API surface.",
"category": "other",
"filePaths": [
"packages/core/test/__snapshots__/config.test.ts.snap",
"test/__snapshots__/tsnapi/@x18n/core/index.snapshot.d.ts"
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-13T21:58:11.303Z",
"model": "openai-compatible/opencode-go/deepseek-v4.1-flash",
"locale": "en"
}
} |
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.
Fixes #156
Description
$_('welcome', { values: { name } })keeps its message params insidevalues, and the call spec had no way to name that. The preset recorded no params, soparam-mismatchsaid nothing about the call.ParamsSourcegainedproperty, the dot-separated path to the object that holds the params, and the svelte-i18n preset points it atoptions.values. The preset's callee list split in two, because only the translators read message params:$_,$t,_andtpoint atoptions.values, while$format,$json,formatandjsonkeep their second argument as Intl options.A call that passes options without
values, or no options at all, records an empty params list instead of an unreadable object, so a missing placeholder still gets reported. Whenvaluesitself cannot be read, as in{ values },{ values: opts }or{ values: { ...opts } }, the params stay unknown and the check skips the call.Test
The component from the issue, with
$_('greeting')and$_('welcome', { values: { who: 'Alice', unused: 'Bob' } }), checked through the CLI built from the repo onmainand then on this branch.On
main:On this branch:
$_('greeting')stays quiet in both runs, since a call without options has no params to compare.