fix(ci): ignore generated website translation staging (#2511)

Ignore generator-owned website translation staging output while preserving authored lint errors and complete diagnostics.

Verified with a real checker regression, a production translation build, complete coverage, developer/CI regression checks and native lanes.

Fixes #2508
This commit is contained in:
Ysopwnable 2026-10-13 14:32:22 +08:00 committed by GitHub
parent 18d56f5321
commit 18831491cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 1 deletions

2
.gitignore vendored
View File

@ -72,3 +72,5 @@ Thumbs.db
# Complete static website output, including generated language editions.
website/_site/
# Temporary translation output prepared before replacing the complete site.
website/.i18n-*/

View File

@ -1,6 +1,6 @@
import { spawnSync } from "node:child_process";
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
import { join, sep } from "node:path";
import { dirname, join, sep } from "node:path";
import { fileURLToPath } from "node:url";
import { expect, it } from "vitest";
import { z } from "zod";
@ -138,6 +138,36 @@ it("keeps lint errors failing and visible alongside the retained warnings", asyn
);
});
it("excludes translation staging while retaining authored website errors", async () => {
const root = await fixture();
for (const name of [".gitignore", ".oxlintrc.json"])
await writeFile(join(root, name), await readFile(join(repository, name)));
const authored = "website/public/assets/authored.js";
const staged =
"website/.i18n-regression/site/examples/notes-electron/main.js";
for (const name of [authored, staged]) {
const path = join(root, name);
await mkdir(dirname(path), { recursive: true });
await writeFile(
path,
'const source = require("node:fs");\nconsole.log(source);\n',
);
}
const result = invoke(root, "lint");
expect(result.error).toBeUndefined();
expect(result.status).toBe(1);
expect(result.stdout).toContain("1 errors, 0 warnings");
expect(result.stderr).toContain(authored);
expect(await lintDiagnostics(root)).toEqual([
expect.objectContaining({
severity: "error",
code: "typescript(no-var-requires)",
filename: authored,
}),
]);
});
it("keeps malformed source failing with its parser diagnostic", async () => {
const root = await fixture();
await writeFile(join(root, "src/malformed.js"), "const value = ;\n");