/** * Validate TypeScript Files in src/ Executor * * Two-layer rule: * Layer 1: every .ts file inside an Nx project must live under src/ * Layer 2: every .ts file anywhere in the workspace must belong to some * Nx project. Orphan files (at workspace root or in a non-project * directory) fail the rule unless explicitly allowlisted. * * `excludePaths` is holistic — its bare dir names and globs exempt files * from BOTH layers. Defaults exempt **\/*.d.ts and **\/jest.config.ts. * * Only the files changed vs the base branch are validated (NEW_AND_MODIFIED_FILES), * so the rule applies cleanly to legacy projects — pre-existing orphan files * are grandfathered and only newly-touched files are checked. * * Configurable via webpieces.config.json: * "validate-ts-in-src": { * "mode": "NEW_AND_MODIFIED_FILES", // "OFF" disables the rule * "excludePaths": [...], // dir names + globs, e.g. "**\/codegen.ts" * "allowedRootFiles": [...], * "turnOffRuleUntilEpoch": 0, // epoch SECONDS; skip the rule until it passes * "turnOffRuleWhileOnBranch": null // branch name; skip the rule while it is checked out * } * * Usage: nx run architecture:validate-ts-in-src */ import type { ExecutorContext } from '@nx/devkit'; export type ValidateTsInSrcMode = 'OFF' | 'NEW_AND_MODIFIED_FILES'; export interface ValidateTsInSrcOptions { mode?: ValidateTsInSrcMode; excludePaths?: string[]; allowedRootFiles?: string[]; turnOffRuleUntilEpoch?: number; turnOffRuleWhileOnBranch?: string | null; } export interface ExecutorResult { success: boolean; } export default function runExecutor(_nxOptions: ValidateTsInSrcOptions, context: ExecutorContext): Promise;