diff --git a/.fallowrc.json b/.fallowrc.json index 785ae90..a5b6fa8 100644 --- a/.fallowrc.json +++ b/.fallowrc.json @@ -17,7 +17,8 @@ "apps/**/instrumentation.ts", "apps/**/instrumentation-client.ts", "apps/storybook/test-runner.config.ts", - "scripts/**/*.mjs" + "scripts/**/*.mjs", + "turbo/generators/**/*.test.mjs" ], "publicPackages": ["@repo/core-*"], "ignoreDependencies": [ @@ -42,7 +43,9 @@ "@opentelemetry/sdk-node", "@sentry/opentelemetry", "@stryker-mutator/core", - "@stryker-mutator/vitest-runner" + "@stryker-mutator/vitest-runner", + "@trpc/client", + "@trpc/react-query" ], "ignoreExportsUsedInFile": true, "rules": { @@ -54,11 +57,53 @@ "unused-dev-dependencies": "warn", "unlisted-dependencies": "warn", "circular-dependencies": "error", - "duplicate-code": "warn" + "duplicate-code": "warn", + "duplicate-exports": "off" }, "health": { "maxCyclomatic": 25, "maxCognitive": 30, "maxCrap": 400 - } + }, + "usedClassMembers": ["validateSession"], + "duplicates": { + "ignore": [ + "**/*.test.ts", + "**/*.test.tsx", + "**/*.stories.tsx", + "**/__fixtures__/**", + "**/__factories__/**", + "**/__seeds__/**", + "**/di/bind-production.ts", + "**/di/bind-dev-seed.ts", + "**/di/symbols.ts", + "**/integrations/api/**", + "**/ui/trpc.ts", + "**/feature.manifest.ts", + "**/vitest.config.ts", + "scripts/work/**", + "**/*.test.mjs", + "**/*.test.js", + "**/*.mock.ts", + "**/instrumentation/sentry/init-client*.ts", + "**/instrumentation/di/bind-*.ts", + "packages/core-eslint/rules/component-must-have-*.js", + "scripts/compliance/**", + "**/setup/no-instrumentation.ts", + "packages/core-eslint/rules/no-undeclared-*.js" + ], + "minOccurrences": 2, + "minTokens": 70, + "threshold": 3.0 + }, + "ignoreExports": [ + { + "file": "apps/cms/src/app/**/not-found.tsx", + "exports": ["generateMetadata"] + }, + { + "file": "apps/web-next/src/server/bind-production.ts", + "exports": ["__getInstrumentationForTests"] + } + ] } diff --git a/packages/auth/src/ui/query.ts b/packages/auth/src/ui/query.ts deleted file mode 100644 index ebb110c..0000000 --- a/packages/auth/src/ui/query.ts +++ /dev/null @@ -1,5 +0,0 @@ -// React Query option builders for auth feature procedures. -// Sign-in/up/out are mutations — no query options needed. -// This file is intentionally minimal; expand if read procedures get added. - -export {}; diff --git a/scripts/library-decisions/check.mjs b/scripts/library-decisions/check.mjs index 8608ea1..d5f7a25 100644 --- a/scripts/library-decisions/check.mjs +++ b/scripts/library-decisions/check.mjs @@ -294,6 +294,63 @@ export function checkRenovatePr( * * An empty array means the commit is clean. */ +/** Parse a trace's frontmatter; error entry when decision !== approved. */ +function decisionError(content, relPath, dep) { + const fm = parseFrontmatter(content); + if (fm.decision !== "approved") { + return { + pkgJson: relPath, + dep, + reason: "not-approved", + decision: fm.decision, + }; + } + return null; +} + +/** + * Validate one new runtime dep against its staged or committed trace. + * Returns an error entry, or null when an approved trace covers the dep. + */ +function checkDepTrace(dep, relPath, staged, repoRoot, stagedAgainst) { + const stagedTrace = findStagedTrace(dep, staged); + if (!stagedTrace) { + // Fall back to an already-committed trace — if one exists and is + // approved, the dep was previously evaluated and doesn't need + // re-staging just because a new package adopts it. + const committedTrace = findExistingTrace(dep, repoRoot); + if (!committedTrace) { + return { pkgJson: relPath, dep, reason: "no-trace" }; + } + try { + const content = fs.readFileSync(committedTrace, "utf8"); + return decisionError(content, relPath, dep); + } catch (e) { + return { + pkgJson: relPath, + dep, + reason: "parse-error", + detail: String(e.message), + }; + } + } + try { + const traceRef = stagedAgainst ? `HEAD:${stagedTrace}` : `:${stagedTrace}`; + const content = execSync(`git show "${traceRef}"`, { + cwd: repoRoot, + encoding: "utf8", + }); + return decisionError(content, relPath, dep); + } catch (e) { + return { + pkgJson: relPath, + dep, + reason: "parse-error", + detail: String(e.message), + }; + } +} + export function checkLibraryDecisions( repoRoot = DEFAULT_REPO_ROOT, { stagedAgainst } = {}, @@ -309,62 +366,14 @@ export function checkLibraryDecisions( if (tier === "app" || tier === "skip") continue; for (const dep of getNewRuntimeDeps(relPath, repoRoot, stagedAgainst)) { - const stagedTrace = findStagedTrace(dep, staged); - if (!stagedTrace) { - // Fall back to an already-committed trace — if one exists and is - // approved, the dep was previously evaluated and doesn't need - // re-staging just because a new package adopts it. - const committedTrace = findExistingTrace(dep, repoRoot); - if (committedTrace) { - try { - const content = fs.readFileSync(committedTrace, "utf8"); - const fm = parseFrontmatter(content); - if (fm.decision !== "approved") { - errors.push({ - pkgJson: relPath, - dep, - reason: "not-approved", - decision: fm.decision, - }); - } - } catch (e) { - errors.push({ - pkgJson: relPath, - dep, - reason: "parse-error", - detail: String(e.message), - }); - } - continue; - } - errors.push({ pkgJson: relPath, dep, reason: "no-trace" }); - continue; - } - try { - const traceRef = stagedAgainst - ? `HEAD:${stagedTrace}` - : `:${stagedTrace}`; - const content = execSync(`git show "${traceRef}"`, { - cwd: repoRoot, - encoding: "utf8", - }); - const fm = parseFrontmatter(content); - if (fm.decision !== "approved") { - errors.push({ - pkgJson: relPath, - dep, - reason: "not-approved", - decision: fm.decision, - }); - } - } catch (e) { - errors.push({ - pkgJson: relPath, - dep, - reason: "parse-error", - detail: String(e.message), - }); - } + const error = checkDepTrace( + dep, + relPath, + staged, + repoRoot, + stagedAgainst, + ); + if (error) errors.push(error); } }