chore(style): repo-wide prettier sweep before v1.4.6 tag

Long-overdue prettier sweep; prettier had drifted vs. checked-in code
across ~130 files (mostly long-argument line-break wrapping in TS and
table-padding in markdown). Pure formatting — no semantic changes —
and required to clear the v1.4.6 release gate's `pnpm format:check`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-09 02:27:17 +02:00
1 parent 67575180b8
commit 02b99553b9
135 files changed
+2159 -1583

No files matched your search

+69 -17
View File
@@ -8,7 +8,9 @@ const DE_PATH = join(ROOT, "messages/de.json");
// JSON.parse silently keeps the last value when an object has duplicate keys,
// which lets shadowed keys hide bugs. Walk the source manually to surface them.
function findDuplicateKeys(src: string): { path: string; line: number; firstLine: number }[] {
function findDuplicateKeys(
src: string,
): { path: string; line: number; firstLine: number }[] {
const dups: { path: string; line: number; firstLine: number }[] = [];
const pathStack: string[] = [];
let i = 0;
@@ -22,8 +24,10 @@ function findDuplicateKeys(src: string): { path: string; line: number; firstLine
while (i < src.length) {
const c = src[i];
if (c === " " || c === "\t" || c === "\r") i++;
else if (c === "\n") { i++; line++; }
else break;
else if (c === "\n") {
i++;
line++;
} else break;
}
}
@@ -55,23 +59,46 @@ function findDuplicateKeys(src: string): { path: string; line: number; firstLine
const c = src[i];
if (c === "{") return parseObject();
if (c === "[") return parseArray();
if (c === '"') { readString(); return; }
if (c === '"') {
readString();
return;
}
while (i < src.length) {
const ch = src[i];
if (ch === "," || ch === "}" || ch === "]" || ch === " " || ch === "\n" || ch === "\t" || ch === "\r") break;
if (
ch === "," ||
ch === "}" ||
ch === "]" ||
ch === " " ||
ch === "\n" ||
ch === "\t" ||
ch === "\r"
)
break;
if (ch === "\n") line++;
i++;
}
}
function parseArray() {
i++; skipWs();
if (src[i] === "]") { i++; return; }
i++;
skipWs();
if (src[i] === "]") {
i++;
return;
}
while (true) {
parseValue();
skipWs();
if (src[i] === ",") { i++; skipWs(); continue; }
if (src[i] === "]") { i++; return; }
if (src[i] === ",") {
i++;
skipWs();
continue;
}
if (src[i] === "]") {
i++;
return;
}
err("expected , or ] in array");
}
}
@@ -80,13 +107,20 @@ function findDuplicateKeys(src: string): { path: string; line: number; firstLine
i++;
const seen = new Map<string, number>();
skipWs();
if (src[i] === "}") { i++; return; }
if (src[i] === "}") {
i++;
return;
}
while (true) {
skipWs();
const { value: key, line: keyLine } = readString();
const seenAt = seen.get(key);
if (seenAt != null) {
dups.push({ path: [...pathStack, key].join("."), line: keyLine, firstLine: seenAt });
dups.push({
path: [...pathStack, key].join("."),
line: keyLine,
firstLine: seenAt,
});
} else {
seen.set(key, keyLine);
}
@@ -97,8 +131,14 @@ function findDuplicateKeys(src: string): { path: string; line: number; firstLine
parseValue();
pathStack.pop();
skipWs();
if (src[i] === ",") { i++; continue; }
if (src[i] === "}") { i++; return; }
if (src[i] === ",") {
i++;
continue;
}
if (src[i] === "}") {
i++;
return;
}
err("expected , or } in object");
}
}
@@ -114,7 +154,10 @@ describe("i18n locale file integrity", () => {
dups,
`Duplicate keys silently shadow earlier definitions:\n` +
dups
.map((d) => ` ${d.path} at line ${d.line} (first defined at line ${d.firstLine})`)
.map(
(d) =>
` ${d.path} at line ${d.line} (first defined at line ${d.firstLine})`,
)
.join("\n"),
).toEqual([]);
});
@@ -125,14 +168,23 @@ describe("i18n locale file integrity", () => {
dups,
`Duplicate keys silently shadow earlier definitions:\n` +
dups
.map((d) => ` ${d.path} at line ${d.line} (first defined at line ${d.firstLine})`)
.map(
(d) =>
` ${d.path} at line ${d.line} (first defined at line ${d.firstLine})`,
)
.join("\n"),
).toEqual([]);
});
it("en and de share the same key shape (locale parity)", () => {
const en = JSON.parse(readFileSync(EN_PATH, "utf8")) as Record<string, unknown>;
const de = JSON.parse(readFileSync(DE_PATH, "utf8")) as Record<string, unknown>;
const en = JSON.parse(readFileSync(EN_PATH, "utf8")) as Record<
string,
unknown
>;
const de = JSON.parse(readFileSync(DE_PATH, "utf8")) as Record<
string,
unknown
>;
function flatten(obj: unknown, prefix: string, out: string[]) {
if (obj == null || typeof obj !== "object") return;
+10 -9
View File
@@ -205,9 +205,11 @@ describe("withIdempotency", () => {
describe("defaultUserIdResolver (audit C-4)", () => {
function mockHeader(value: string | null) {
vi.mocked(headers).mockResolvedValue({
get: vi.fn().mockImplementation((name: string) =>
name.toLowerCase() === "authorization" ? value : null,
),
get: vi
.fn()
.mockImplementation((name: string) =>
name.toLowerCase() === "authorization" ? value : null,
),
} as unknown as ReturnType<typeof headers> extends Promise<infer T>
? T
: never);
@@ -291,9 +293,7 @@ describe("withIdempotency body-content exclusion (P12)", () => {
'{"data":{"echoed":"sk-ant-api03-xyz"},"error":null}',
],
])("does NOT cache responses containing %s", async (_label, body) => {
const handler = vi.fn(
async () => new NextResponse(body, { status: 201 }),
);
const handler = vi.fn(async () => new NextResponse(body, { status: 201 }));
const wrapped = withIdempotency<[NextRequest]>(handler, async () => "u-1");
await wrapped(makeRequest("POST", { "idempotency-key": "abc-12345678" }));
expect(handler).toHaveBeenCalledTimes(1);
@@ -310,10 +310,11 @@ describe("withIdempotency body-content exclusion (P12)", () => {
const handler = vi.fn(
async () => new NextResponse(body, { status: 422 }),
);
const wrapped = withIdempotency<[NextRequest]>(handler, async () => "u-1");
await wrapped(
makeRequest("POST", { "idempotency-key": "key-12345678" }),
const wrapped = withIdempotency<[NextRequest]>(
handler,
async () => "u-1",
);
await wrapped(makeRequest("POST", { "idempotency-key": "key-12345678" }));
expect(prisma.idempotencyKey.create).toHaveBeenCalledTimes(1);
},
);
+3 -1
View File
@@ -68,7 +68,9 @@ describe("moodLog secret encrypt-at-rest", () => {
for (const update of updates) {
// Each rotation must produce a value that decrypts back to the
// original legacy plaintext — no data loss.
const original = rows.find((r) => r.id === update.id)!.moodLogWebhookSecret;
const original = rows.find(
(r) => r.id === update.id,
)!.moodLogWebhookSecret;
expect(readMoodLogSecret(update.encrypted)).toBe(original);
}
+1 -3
View File
@@ -26,9 +26,7 @@ describe("queryKeys factory", () => {
describe("dependent-key bundles", () => {
it("measurementDependentKeys invalidates analytics/insights/targets", () => {
const keyStrings = measurementDependentKeys.map((k) =>
JSON.stringify(k),
);
const keyStrings = measurementDependentKeys.map((k) => JSON.stringify(k));
expect(keyStrings).toContain(JSON.stringify(["measurements"]));
expect(keyStrings).toContain(JSON.stringify(["analytics"]));
expect(keyStrings).toContain(JSON.stringify(["insights"]));
@@ -33,7 +33,11 @@ vi.mock("@/lib/logging/transports", () => ({
const headersGet = vi.fn<(name: string) => string | null>();
vi.mock("next/headers", () => ({
headers: vi.fn(async () => ({ get: headersGet })),
cookies: vi.fn(async () => ({ get: () => undefined, set: () => {}, delete: () => {} })),
cookies: vi.fn(async () => ({
get: () => undefined,
set: () => {},
delete: () => {},
})),
}));
// --- Imports use the mocked modules above. ---
+3 -3
View File
@@ -14,9 +14,9 @@ describe("getServerTranslator", () => {
it("interpolates {param} placeholders", () => {
const { t } = getServerTranslator("en");
expect(t("telegram.snoozedFor", { name: "Ramipril", duration: "1 hour" })).toBe(
"Ramipril snoozed for 1 hour.",
);
expect(
t("telegram.snoozedFor", { name: "Ramipril", duration: "1 hour" }),
).toBe("Ramipril snoozed for 1 hour.");
});
it("falls back to English when a key is missing in the German bundle", () => {