Skip to content

Commit 3fa169d

Browse files
committed
fix(i18n): fix lint test and review findings
1 parent 998dda9 commit 3fa169d

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎packages/config-eslint/i18n-keys.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ export function getI18nDotKeySelectors(config) {
3232

3333
function i18nDotKeySelectors(dotKey) {
3434
const call = "CallExpression:matches([callee.name='t'], [callee.property.name='t'])"
35-
return [`${call}[arguments.0.value=${dotKey}]`, `${call}[arguments.0.quasis.0.value.raw=${dotKey}]`]
35+
return [`${call}[arguments.0.value=${dotKey}]`, `${call}[arguments.0.quasis.0.value.cooked=${dotKey}]`]
3636
}

‎packages/config-eslint/i18n-keys.test.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import assert from "node:assert/strict"
22
import { describe, it } from "node:test"
3+
import { URL } from "node:url"
34

45
import { Linter } from "eslint"
56
import typescriptEslint from "typescript-eslint"
@@ -20,6 +21,7 @@ describe("i18n dot-form keys", () => {
2021
't("chat.commandExecution.exitStatus", { exitCode })',
2122
'i18next.t("settings.autoApprove.title")',
2223
"t(`chat.errors.${name}`)",
24+
"t(`chat\\u002ecommandExecution.exitStatus`)",
2325
]) {
2426
it(`flags: ${code}`, () => {
2527
assert.equal(lint(code).length, 1)

‎scripts/check-i18n-interpolation.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ for (const rel of files) {
9191
),
9292
)
9393
// A plural key lives under key_one, key_other, and so on.
94-
const values = [keyPath, `${keyPath}_one`, `${keyPath}_other`]
94+
const values = [keyPath, `${keyPath}_zero`, `${keyPath}_one`, `${keyPath}_other`]
9595
.map((k) => lookup(resource, k))
9696
.filter((v) => typeof v === "string")
9797
const missing = new Set(values.flatMap(placeholders).filter((name) => !passed.has(name)))

0 commit comments

Comments
 (0)