mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Reduce low-value validation overhead
This commit is contained in:
parent
e5afddd14f
commit
880ef3f35f
3 changed files with 6 additions and 39 deletions
|
|
@ -26,9 +26,11 @@ const projectTypeScriptRules = {
|
|||
"react-hooks/rules-of-hooks": "error",
|
||||
};
|
||||
const testTypeScriptRelaxations = {
|
||||
"@typescript-eslint/no-deprecated": "off",
|
||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||
"@typescript-eslint/no-unsafe-return": "off",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
||||
"@typescript-eslint/require-await": "off",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,27 +7,6 @@ import { describe, expect, it } from "vitest";
|
|||
const repoRoot = process.cwd();
|
||||
|
||||
describe("development scripts", () => {
|
||||
it("propagates check:ci script failures", async () => {
|
||||
const cwd = await tempWorkspace();
|
||||
const scripts = await readPackageScripts();
|
||||
await writeFile(path.join(cwd, "fail.mjs"), "process.exit(7);\n");
|
||||
await writeJson(path.join(cwd, "package.json"), {
|
||||
scripts: {
|
||||
"check:ci": scripts["check:ci"],
|
||||
"typecheck:ci": "node fail.mjs",
|
||||
"test:ci": 'node -e "process.exit(0)"',
|
||||
"lint:ci": 'node -e "process.exit(0)"',
|
||||
"format:check:ci": 'node -e "process.exit(0)"',
|
||||
"build:styles:check": 'node -e "process.exit(0)"',
|
||||
build: 'node -e "process.exit(0)"',
|
||||
},
|
||||
});
|
||||
|
||||
const result = runNpmScript("check:ci", cwd);
|
||||
|
||||
expect(result.status).toBe(7);
|
||||
});
|
||||
|
||||
it("fails style builds when CSS files are missing from the style order file", async () => {
|
||||
const cwd = await tempWorkspace();
|
||||
await mkdir(path.join(cwd, "src", "styles"), { recursive: true });
|
||||
|
|
@ -257,20 +236,6 @@ function runNodeScript(script: string, args: string[] = [], cwd = repoRoot, env:
|
|||
});
|
||||
}
|
||||
|
||||
function runNpmScript(script: string, cwd = repoRoot) {
|
||||
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
||||
return spawnSync(npmCommand, ["run", script], {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
shell: false,
|
||||
});
|
||||
}
|
||||
|
||||
async function readPackageScripts(): Promise<Record<string, string>> {
|
||||
const packageJson = JSON.parse(await readFile(path.join(repoRoot, "package.json"), "utf8")) as { scripts: Record<string, string> };
|
||||
return packageJson.scripts;
|
||||
}
|
||||
|
||||
async function writeJson(file: string, value: unknown): Promise<void> {
|
||||
await writeFile(file, `${JSON.stringify(value, null, 2)}\n`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ import { describe, expect, it } from "vitest";
|
|||
const repoRoot = process.cwd();
|
||||
const ESLINT_STARTUP_TEST_TIMEOUT_MS = 10_000;
|
||||
const generatedAppServerImportRoot = "../../generated" + "/app-server";
|
||||
const eslint = new ESLint({
|
||||
cwd: repoRoot,
|
||||
overrideConfigFile: path.join(repoRoot, "eslint.config.mjs"),
|
||||
});
|
||||
|
||||
describe("eslint config", () => {
|
||||
it(
|
||||
|
|
@ -538,10 +542,6 @@ export type Item = MessageStreamItem;
|
|||
});
|
||||
|
||||
async function lintSource(filePath: string, source: string): Promise<string[]> {
|
||||
const eslint = new ESLint({
|
||||
cwd: repoRoot,
|
||||
overrideConfigFile: path.join(repoRoot, "eslint.config.mjs"),
|
||||
});
|
||||
const [result] = await eslint.lintText(source, { filePath: path.join(repoRoot, filePath) });
|
||||
return (result?.messages ?? []).map((message) => message.ruleId ?? message.message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue