Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { readdirSync, readFileSync, statSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "@suaveplan/testing/runner";
const here = dirname(fileURLToPath(import.meta.url));
const srcRoot = resolve(here, "..", "src");
function walk(dir: string): string[] {
const out: string[] = [];
for (const name of readdirSync(dir)) {
const full = join(dir, name);
const st = statSync(full);
if (st.isDirectory()) out.push(...walk(full));
else if (full.endsWith(".ts")) out.push(full);
}
return out;
}
describe("zod import discipline", () => {
it("every src file uses default-import z (never named { z })", {
timeout: 5000,
}, () => {
const offenders: string[] = [];
for (const file of walk(srcRoot)) {
const text = readFileSync(file, "utf8");
// Named-form: import { z } from "zod"
if (/import\s*\{\s*z\s*\}\s*from\s*["']zod["']/.test(text)) {
offenders.push(file);
}
}
expect(offenders).toEqual([]);
});
});