@webpieces/code-rules 0.0.1 → 0.2.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +4 -3
  2. package/src/cli.d.ts +1 -0
  3. package/src/cli.js +19 -0
  4. package/src/cli.js.map +1 -0
  5. package/src/diff-utils.d.ts +24 -0
  6. package/src/{diff-utils.ts → diff-utils.js} +30 -38
  7. package/src/diff-utils.js.map +1 -0
  8. package/src/from-shared-config.d.ts +28 -0
  9. package/src/from-shared-config.js +119 -0
  10. package/src/from-shared-config.js.map +1 -0
  11. package/src/index.js +33 -0
  12. package/src/index.js.map +1 -0
  13. package/src/validate-catch-error-pattern.d.ts +47 -0
  14. package/src/{validate-catch-error-pattern.ts → validate-catch-error-pattern.js} +74 -195
  15. package/src/validate-catch-error-pattern.js.map +1 -0
  16. package/src/validate-code.d.ts +98 -0
  17. package/src/{validate-code.ts → validate-code.js} +65 -259
  18. package/src/validate-code.js.map +1 -0
  19. package/src/validate-dtos.d.ts +41 -0
  20. package/src/{validate-dtos.ts → validate-dtos.js} +88 -215
  21. package/src/validate-dtos.js.map +1 -0
  22. package/src/validate-modified-files.d.ts +24 -0
  23. package/src/{validate-modified-files.ts → validate-modified-files.js} +46 -115
  24. package/src/validate-modified-files.js.map +1 -0
  25. package/src/validate-modified-methods.d.ts +30 -0
  26. package/src/{validate-modified-methods.ts → validate-modified-methods.js} +94 -196
  27. package/src/validate-modified-methods.js.map +1 -0
  28. package/src/validate-new-methods.d.ts +27 -0
  29. package/src/{validate-new-methods.ts → validate-new-methods.js} +63 -133
  30. package/src/validate-new-methods.js.map +1 -0
  31. package/src/validate-no-any-unknown.d.ts +41 -0
  32. package/src/{validate-no-any-unknown.ts → validate-no-any-unknown.js} +69 -146
  33. package/src/validate-no-any-unknown.js.map +1 -0
  34. package/src/validate-no-destructure.d.ts +51 -0
  35. package/src/{validate-no-destructure.ts → validate-no-destructure.js} +80 -166
  36. package/src/validate-no-destructure.js.map +1 -0
  37. package/src/validate-no-direct-api-resolver.d.ts +46 -0
  38. package/src/{validate-no-direct-api-resolver.ts → validate-no-direct-api-resolver.js} +112 -211
  39. package/src/validate-no-direct-api-resolver.js.map +1 -0
  40. package/src/validate-no-implicit-any.d.ts +36 -0
  41. package/src/{validate-no-implicit-any.ts → validate-no-implicit-any.js} +94 -141
  42. package/src/validate-no-implicit-any.js.map +1 -0
  43. package/src/validate-no-inline-types.d.ts +90 -0
  44. package/src/{validate-no-inline-types.ts → validate-no-inline-types.js} +93 -198
  45. package/src/validate-no-inline-types.js.map +1 -0
  46. package/src/validate-no-unmanaged-exceptions.d.ts +43 -0
  47. package/src/{validate-no-unmanaged-exceptions.ts → validate-no-unmanaged-exceptions.js} +71 -140
  48. package/src/validate-no-unmanaged-exceptions.js.map +1 -0
  49. package/src/validate-prisma-converters.d.ts +59 -0
  50. package/src/{validate-prisma-converters.ts → validate-prisma-converters.js} +120 -307
  51. package/src/validate-prisma-converters.js.map +1 -0
  52. package/src/validate-return-types.d.ts +28 -0
  53. package/src/{validate-return-types.ts → validate-return-types.js} +84 -168
  54. package/src/validate-return-types.js.map +1 -0
  55. package/LICENSE +0 -373
  56. package/jest.config.ts +0 -20
  57. package/project.json +0 -22
  58. package/src/cli.ts +0 -17
  59. package/src/from-shared-config.ts +0 -118
  60. package/tsconfig.json +0 -22
  61. package/tsconfig.lib.json +0 -10
  62. package/tsconfig.spec.json +0 -14
  63. /package/src/{index.ts → index.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-no-inline-types.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/validate-no-inline-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;;AAuoBH,+BA4DC;;AAjsBD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7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QACnC,UAAU,GAAG,8BAA8B,CAAC,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;IAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAEnC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["/**\n * Validate No Inline Types Executor\n *\n * Validates that inline type literals AND tuple types are not used in type positions.\n * Prefer named types/interfaces/classes for clarity and reusability.\n *\n * ============================================================================\n * VIOLATIONS (BAD) - These patterns are flagged:\n * ============================================================================\n *\n * 1. INLINE TYPE LITERALS { }\n * -------------------------\n * - Inline parameter type: function foo(arg: { x: number }) { }\n * - Inline return type: function foo(): { x: number } { }\n * - Inline variable type: const config: { timeout: number } = { timeout: 5 };\n * - Inline property type: class C { data: { id: number }; }\n * - Inline in union: type T = { x: number } | null;\n * - Inline in intersection: type T = { x: number } & { y: number };\n * - Inline in generic: Promise<{ data: string }>\n * - Inline in array: function foo(): { id: string }[] { }\n * - Nested inline in alias: type T = { data: { nested: number } }; // inner { } flagged\n * - Inline in tuple: type T = [{ x: number }, string];\n *\n * 2. TUPLE TYPES [ ]\n * ----------------\n * - Tuple return type: function foo(): [Items[], number] { }\n * - Tuple parameter type: function foo(arg: [string, number]) { }\n * - Tuple variable type: const result: [Data[], number] = getData();\n * - Tuple in generic: Promise<[Items[], number]>\n * - Tuple in union: type T = [A, B] | null;\n * - Nested tuple: type T = { data: [A, B] };\n *\n * ============================================================================\n * ALLOWED (GOOD) - These patterns pass validation:\n * ============================================================================\n *\n * 1. TYPE ALIAS DEFINITIONS (direct body only)\n * -----------------------------------------\n * - Type alias with literal: type MyConfig = { timeout: number };\n * - Type alias with tuple: type MyResult = [Items[], number];\n * - Interface definition: interface MyData { id: number }\n * - Class definition: class UserData { id: number; name: string; }\n *\n * 2. USING NAMED TYPES\n * ------------------\n * - Named param type: function foo(arg: MyConfig) { }\n * - Named return type: function foo(): MyConfig { }\n * - Named with null: function foo(): MyConfig | null { }\n * - Named with undefined: function foo(): MyConfig | undefined { }\n * - Union of named types: type Either = TypeA | TypeB;\n * - Named in generic: Promise<MyResult>\n * - Named tuple alias: function foo(): MyTupleResult { }\n *\n * 3. PRIMITIVES AND BUILT-INS\n * -------------------------\n * - Primitive types: function foo(): string { }\n * - Primitive arrays: function foo(): string[] { }\n * - Built-in generics: function foo(): Promise<string> { }\n * - Void return: function foo(): void { }\n *\n * ============================================================================\n * MODES\n * ============================================================================\n * - OFF: Skip validation entirely\n * - NEW_METHODS: Only validate in new methods (detected via git diff)\n * - NEW_AND_MODIFIED_METHODS: Validate in new methods + methods with changes\n * - MODIFIED_FILES: Validate all violations in modified files\n *\n * ============================================================================\n * ESCAPE HATCH\n * ============================================================================\n * Add comment above the violation:\n * // webpieces-disable no-inline-types -- [your justification]\n * function foo(arg: { x: number }) { }\n *\n * Use sparingly! Common valid reasons:\n * - Prisma payload types that require inline generics\n * - Third-party library APIs that expect inline types\n * - Legacy code being incrementally migrated\n */\n\nimport { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as ts from 'typescript';\n\nexport type NoInlineTypesMode = 'OFF' | 'NEW_METHODS' | 'NEW_AND_MODIFIED_METHODS' | 'MODIFIED_FILES';\n\nexport interface ValidateNoInlineTypesOptions {\n mode?: NoInlineTypesMode;\n disableAllowed?: boolean;\n ignoreModifiedUntilEpoch?: number;\n}\n\nexport interface ExecutorResult {\n success: boolean;\n}\n\ninterface InlineTypeViolation {\n file: string;\n line: number;\n column: number;\n context: string;\n}\n\n/**\n * Get changed TypeScript files between base and head (or working tree if head not specified).\n */\n// webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths\nfunction getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: string): string[] {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const output = execSync(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const changedFiles = output\n .trim()\n .split('\\n')\n .filter((f) => f && !f.includes('.spec.ts') && !f.includes('.test.ts'));\n\n if (!head) {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const untrackedOutput = execSync(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n const untrackedFiles = untrackedOutput\n .trim()\n .split('\\n')\n .filter((f) => f && !f.includes('.spec.ts') && !f.includes('.test.ts'));\n const allFiles = new Set([...changedFiles, ...untrackedFiles]);\n return Array.from(allFiles);\n } catch (err: unknown) {\n //const error = toError(err);\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch (err: unknown) {\n //const error = toError(err);\n return [];\n }\n}\n\n/**\n * Get the diff content for a specific file.\n */\nfunction getFileDiff(workspaceRoot: string, file: string, base: string, head?: string): string {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const diffTarget = head ? `${base} ${head}` : base;\n const diff = execSync(`git diff ${diffTarget} -- \"${file}\"`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n });\n\n if (!diff && !head) {\n const fullPath = path.join(workspaceRoot, file);\n if (fs.existsSync(fullPath)) {\n const isUntracked = execSync(`git ls-files --others --exclude-standard \"${file}\"`, {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n }).trim();\n\n if (isUntracked) {\n const content = fs.readFileSync(fullPath, 'utf-8');\n const lines = content.split('\\n');\n return lines.map((line) => `+${line}`).join('\\n');\n }\n }\n }\n\n return diff;\n } catch (err: unknown) {\n //const error = toError(err);\n return '';\n }\n}\n\n/**\n * Parse diff to extract changed line numbers (both additions and modifications).\n */\nfunction getChangedLineNumbers(diffContent: string): Set<number> {\n const changedLines = new Set<number>();\n const lines = diffContent.split('\\n');\n let currentLine = 0;\n\n for (const line of lines) {\n const hunkMatch = line.match(/^@@ -\\d+(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/);\n if (hunkMatch) {\n currentLine = parseInt(hunkMatch[1], 10);\n continue;\n }\n\n if (line.startsWith('+') && !line.startsWith('+++')) {\n changedLines.add(currentLine);\n currentLine++;\n } else if (line.startsWith('-') && !line.startsWith('---')) {\n // Deletions don't increment line number\n } else {\n currentLine++;\n }\n }\n\n return changedLines;\n}\n\n/**\n * Check if a line contains a webpieces-disable comment for no-inline-types.\n */\nfunction hasDisableComment(lines: string[], lineNumber: number): boolean {\n const startCheck = Math.max(0, lineNumber - 5);\n for (let i = lineNumber - 2; i >= startCheck; i--) {\n const line = lines[i]?.trim() ?? '';\n if (line.startsWith('function ') || line.startsWith('class ') || line.endsWith('}')) {\n break;\n }\n if (line.includes('webpieces-disable') && line.includes('no-inline-types')) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if a TypeLiteral or TupleType node is in an allowed context.\n * Only allowed if the DIRECT parent is a TypeAliasDeclaration.\n *\n * ALLOWED:\n * type MyConfig = { x: number }; // TypeLiteral direct child of TypeAliasDeclaration\n * type MyTuple = [A, B]; // TupleType direct child of TypeAliasDeclaration\n *\n * NOT ALLOWED (flagged):\n * type T = { x: number } | null; // Parent is UnionType, not TypeAliasDeclaration\n * type T = { data: { nested: number } }; // Inner TypeLiteral's parent is PropertySignature\n * function foo(): [A, B] { } // TupleType's parent is FunctionDeclaration\n * type T = Prisma.GetPayload<{ include: {...} }>; // TypeLiteral in generic argument\n *\n * NOTE: Prisma types require inline type literals in generic arguments. Use the escape hatch:\n * // webpieces-disable no-inline-types -- Prisma API requires inline type argument\n * type T = Prisma.GetPayload<{ include: {...} }>;\n */\nfunction isInAllowedContext(node: ts.TypeLiteralNode | ts.TupleTypeNode): boolean {\n const parent = node.parent;\n if (!parent) return false;\n\n // Only allowed if it's the DIRECT body of a type alias\n if (ts.isTypeAliasDeclaration(parent)) {\n return true;\n }\n return false;\n}\n\n/**\n * Get a description of the context where the inline type or tuple appears.\n *\n * Returns human-readable context like:\n * - \"inline parameter type\"\n * - \"tuple return type\"\n * - \"inline type in generic argument\"\n */\n// webpieces-disable max-lines-new-methods -- Context detection requires checking many AST node types\nfunction getViolationContext(node: ts.TypeLiteralNode | ts.TupleTypeNode, sourceFile: ts.SourceFile): string {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const isTuple = ts.isTupleTypeNode(node);\n const prefix = isTuple ? 'tuple' : 'inline';\n\n let current: ts.Node = node;\n while (current.parent) {\n const parent = current.parent;\n if (ts.isParameter(parent)) {\n return `${prefix} parameter type`;\n }\n if (ts.isFunctionDeclaration(parent) || ts.isMethodDeclaration(parent) || ts.isArrowFunction(parent)) {\n if (parent.type === current) {\n return `${prefix} return type`;\n }\n }\n if (ts.isVariableDeclaration(parent)) {\n return `${prefix} variable type`;\n }\n if (ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent)) {\n if (parent.type === current) {\n return `${prefix} property type`;\n }\n // Check if it's nested inside another type literal\n let ancestor: ts.Node | undefined = parent.parent;\n while (ancestor) {\n if (ts.isTypeLiteralNode(ancestor)) {\n return `nested ${prefix} type`;\n }\n if (ts.isTypeAliasDeclaration(ancestor)) {\n return `nested ${prefix} type in type alias`;\n }\n ancestor = ancestor.parent;\n }\n }\n if (ts.isUnionTypeNode(parent) || ts.isIntersectionTypeNode(parent)) {\n return `${prefix} type in union/intersection`;\n }\n // Safely check parent.parent before accessing it\n if (parent.parent && ts.isTypeReferenceNode(parent.parent) && ts.isTypeNode(parent)) {\n return `${prefix} type in generic argument`;\n }\n // Direct parent is TypeReferenceNode (e.g., Prisma.GetPayload<{...}>)\n if (ts.isTypeReferenceNode(parent)) {\n return `${prefix} type in generic argument`;\n }\n if (ts.isArrayTypeNode(parent)) {\n return `${prefix} type in array`;\n }\n if (ts.isTupleTypeNode(parent) && !isTuple) {\n return `inline type in tuple`;\n }\n current = parent;\n }\n return isTuple ? 'tuple type' : 'inline type literal';\n } catch (err: unknown) {\n //const error = toError(err);\n // Defensive: return generic context if AST traversal fails\n return ts.isTupleTypeNode(node) ? 'tuple type' : 'inline type literal';\n }\n}\n\ninterface MethodInfo {\n name: string;\n startLine: number;\n endLine: number;\n}\n\n/**\n * Find all methods/functions in a file with their line ranges.\n */\n// webpieces-disable max-lines-new-methods -- AST traversal requires inline visitor function\nfunction findMethodsInFile(filePath: string, workspaceRoot: string): MethodInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const methods: MethodInfo[] = [];\n\n // webpieces-disable max-lines-new-methods -- AST visitor pattern requires handling multiple node types\n function visit(node: ts.Node): void {\n let methodName: string | undefined;\n let startLine: number | undefined;\n let endLine: number | undefined;\n\n if (ts.isMethodDeclaration(node) && node.name) {\n methodName = node.name.getText(sourceFile);\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n startLine = start.line + 1;\n endLine = end.line + 1;\n } else if (ts.isFunctionDeclaration(node) && node.name) {\n methodName = node.name.getText(sourceFile);\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n startLine = start.line + 1;\n endLine = end.line + 1;\n } else if (ts.isArrowFunction(node)) {\n if (ts.isVariableDeclaration(node.parent) && ts.isIdentifier(node.parent.name)) {\n methodName = node.parent.name.getText(sourceFile);\n const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());\n startLine = start.line + 1;\n endLine = end.line + 1;\n }\n }\n\n if (methodName && startLine !== undefined && endLine !== undefined) {\n methods.push({ name: methodName, startLine, endLine });\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return methods;\n}\n\n/**\n * Check if a line is within any method's range and if that method has changes.\n */\nfunction isLineInChangedMethod(\n line: number,\n methods: MethodInfo[],\n changedLines: Set<number>,\n newMethodNames: Set<string>\n): boolean {\n for (const method of methods) {\n if (line >= method.startLine && line <= method.endLine) {\n // Check if this method is new or has changes\n if (newMethodNames.has(method.name)) {\n return true;\n }\n // Check if any line in the method range has changes\n for (let l = method.startLine; l <= method.endLine; l++) {\n if (changedLines.has(l)) {\n return true;\n }\n }\n }\n }\n return false;\n}\n\n/**\n * Check if a line is within a new method.\n */\nfunction isLineInNewMethod(line: number, methods: MethodInfo[], newMethodNames: Set<string>): boolean {\n for (const method of methods) {\n if (line >= method.startLine && line <= method.endLine && newMethodNames.has(method.name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Parse diff to find newly added method signatures.\n */\nfunction findNewMethodSignaturesInDiff(diffContent: string): Set<string> {\n const newMethods = new Set<string>();\n const lines = diffContent.split('\\n');\n\n const patterns = [\n /^\\+\\s*(?:export\\s+)?(?:async\\s+)?function\\s+(\\w+)\\s*\\(/,\n /^\\+\\s*(?:export\\s+)?(?:const|let)\\s+(\\w+)\\s*=\\s*(?:async\\s*)?\\(/,\n /^\\+\\s*(?:export\\s+)?(?:const|let)\\s+(\\w+)\\s*=\\s*(?:async\\s+)?function/,\n /^\\+\\s*(?:(?:public|private|protected)\\s+)?(?:static\\s+)?(?:async\\s+)?(\\w+)\\s*\\(/,\n ];\n\n for (const line of lines) {\n if (line.startsWith('+') && !line.startsWith('+++')) {\n for (const pattern of patterns) {\n const match = line.match(pattern);\n if (match) {\n const methodName = match[1];\n if (methodName && !['if', 'for', 'while', 'switch', 'catch', 'constructor'].includes(methodName)) {\n newMethods.add(methodName);\n }\n break;\n }\n }\n }\n }\n\n return newMethods;\n}\n\ninterface InlineTypeInfo {\n line: number;\n column: number;\n context: string;\n hasDisableComment: boolean;\n}\n\n/**\n * Find all inline type literals AND tuple types in a file.\n *\n * Detects:\n * - TypeLiteral nodes: { x: number }\n * - TupleType nodes: [A, B]\n *\n * Both are flagged unless they are the DIRECT body of a type alias.\n */\n// webpieces-disable max-lines-new-methods -- AST traversal with visitor pattern\nfunction findInlineTypesInFile(filePath: string, workspaceRoot: string): InlineTypeInfo[] {\n const fullPath = path.join(workspaceRoot, filePath);\n if (!fs.existsSync(fullPath)) return [];\n\n const content = fs.readFileSync(fullPath, 'utf-8');\n const fileLines = content.split('\\n');\n const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);\n\n const inlineTypes: InlineTypeInfo[] = [];\n\n function visit(node: ts.Node): void {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // Check for inline type literals: { x: number }\n if (ts.isTypeLiteralNode(node)) {\n if (!isInAllowedContext(node)) {\n const startPos = node.getStart(sourceFile);\n if (startPos >= 0) {\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const column = pos.character + 1;\n const context = getViolationContext(node, sourceFile);\n const disabled = hasDisableComment(fileLines, line);\n\n inlineTypes.push({\n line,\n column,\n context,\n hasDisableComment: disabled,\n });\n }\n }\n }\n\n // Check for tuple types: [A, B]\n if (ts.isTupleTypeNode(node)) {\n if (!isInAllowedContext(node)) {\n const startPos = node.getStart(sourceFile);\n if (startPos >= 0) {\n const pos = sourceFile.getLineAndCharacterOfPosition(startPos);\n const line = pos.line + 1;\n const column = pos.character + 1;\n const context = getViolationContext(node, sourceFile);\n const disabled = hasDisableComment(fileLines, line);\n\n inlineTypes.push({\n line,\n column,\n context,\n hasDisableComment: disabled,\n });\n }\n }\n }\n } catch (err: unknown) {\n //const error = toError(err);\n // Skip nodes that cause errors during analysis\n }\n\n ts.forEachChild(node, visit);\n }\n\n visit(sourceFile);\n return inlineTypes;\n}\n\n/**\n * Find violations in new methods only (NEW_METHODS mode).\n */\n// webpieces-disable max-lines-new-methods -- File iteration with diff parsing and method matching\nfunction findViolationsForNewMethods(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean\n): InlineTypeViolation[] {\n const violations: InlineTypeViolation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const newMethodNames = findNewMethodSignaturesInDiff(diff);\n\n if (newMethodNames.size === 0) continue;\n\n const methods = findMethodsInFile(file, workspaceRoot);\n const inlineTypes = findInlineTypesInFile(file, workspaceRoot);\n\n for (const inlineType of inlineTypes) {\n if (disableAllowed && inlineType.hasDisableComment) continue;\n if (!isLineInNewMethod(inlineType.line, methods, newMethodNames)) continue;\n\n violations.push({\n file,\n line: inlineType.line,\n column: inlineType.column,\n context: inlineType.context,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * Find violations in new and modified methods (NEW_AND_MODIFIED_METHODS mode).\n */\n// webpieces-disable max-lines-new-methods -- Combines new method detection with change detection\nfunction findViolationsForModifiedAndNewMethods(\n workspaceRoot: string,\n changedFiles: string[],\n base: string,\n head: string | undefined,\n disableAllowed: boolean\n): InlineTypeViolation[] {\n const violations: InlineTypeViolation[] = [];\n\n for (const file of changedFiles) {\n const diff = getFileDiff(workspaceRoot, file, base, head);\n const newMethodNames = findNewMethodSignaturesInDiff(diff);\n const changedLines = getChangedLineNumbers(diff);\n\n const methods = findMethodsInFile(file, workspaceRoot);\n const inlineTypes = findInlineTypesInFile(file, workspaceRoot);\n\n for (const inlineType of inlineTypes) {\n if (disableAllowed && inlineType.hasDisableComment) continue;\n if (!isLineInChangedMethod(inlineType.line, methods, changedLines, newMethodNames)) continue;\n\n violations.push({\n file,\n line: inlineType.line,\n column: inlineType.column,\n context: inlineType.context,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * Find all violations in modified files (MODIFIED_FILES mode).\n */\nfunction findViolationsForModifiedFiles(workspaceRoot: string, changedFiles: string[], disableAllowed: boolean): InlineTypeViolation[] {\n const violations: InlineTypeViolation[] = [];\n\n for (const file of changedFiles) {\n const inlineTypes = findInlineTypesInFile(file, workspaceRoot);\n\n for (const inlineType of inlineTypes) {\n if (disableAllowed && inlineType.hasDisableComment) continue;\n\n violations.push({\n file,\n line: inlineType.line,\n column: inlineType.column,\n context: inlineType.context,\n });\n }\n }\n\n return violations;\n}\n\n/**\n * Auto-detect the base branch by finding the merge-base with origin/main.\n */\nfunction detectBase(workspaceRoot: string): string | null {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const mergeBase = execSync('git merge-base HEAD origin/main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n } catch (err: unknown) {\n //const error = toError(err);\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const mergeBase = execSync('git merge-base HEAD main', {\n cwd: workspaceRoot,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n\n if (mergeBase) {\n return mergeBase;\n }\n } catch (err2: unknown) {\n //const error2 = toError(err2);\n // Ignore\n }\n }\n return null;\n}\n\n/**\n * Report violations to console.\n */\nfunction reportViolations(violations: InlineTypeViolation[], mode: NoInlineTypesMode): void {\n console.error('');\n console.error('❌ Inline type literals found! Use named types instead.');\n console.error('');\n console.error('📚 Named types improve code clarity and reusability:');\n console.error('');\n console.error(' BAD: function foo(arg: { x: number }) { }');\n console.error(' GOOD: type MyConfig = { x: number };');\n console.error(' function foo(arg: MyConfig) { }');\n console.error('');\n console.error(' BAD: type Nullable = { x: number } | null;');\n console.error(' GOOD: type MyData = { x: number };');\n console.error(' type Nullable = MyData | null;');\n console.error('');\n\n for (const v of violations) {\n console.error(` ❌ ${v.file}:${v.line}:${v.column}`);\n console.error(` ${v.context}`);\n }\n console.error('');\n\n console.error(' To fix: Extract inline types to named type aliases or interfaces');\n console.error('');\n console.error(' Escape hatch (use sparingly):');\n console.error(' // webpieces-disable no-inline-types -- [your reason]');\n console.error('');\n console.error(` Current mode: ${mode}`);\n console.error('');\n}\n\n/**\n * Resolve mode considering ignoreModifiedUntilEpoch override.\n * When active, downgrades to OFF. When expired, logs a warning.\n */\nfunction resolveMode(normalMode: NoInlineTypesMode, epoch: number | undefined): NoInlineTypesMode {\n if (epoch === undefined || normalMode === 'OFF') {\n return normalMode;\n }\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n console.log(`\\n⏭️ Skipping no-inline-types validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);\n console.log('');\n return 'OFF';\n }\n return normalMode;\n}\n\nexport default async function runValidator(\n options: ValidateNoInlineTypesOptions,\n workspaceRoot: string\n): Promise<ExecutorResult> {\n const mode: NoInlineTypesMode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);\n const disableAllowed = options.disableAllowed ?? true;\n\n if (mode === 'OFF') {\n console.log('\\n⏭️ Skipping no-inline-types validation (mode: OFF)');\n console.log('');\n return { success: true };\n }\n\n console.log('\\n📏 Validating No Inline Types\\n');\n console.log(` Mode: ${mode}`);\n\n let base = process.env['NX_BASE'];\n const head = process.env['NX_HEAD'];\n\n if (!base) {\n base = detectBase(workspaceRoot) ?? undefined;\n\n if (!base) {\n console.log('\\n⏭️ Skipping no-inline-types validation (could not detect base branch)');\n console.log('');\n return { success: true };\n }\n }\n\n console.log(` Base: ${base}`);\n console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);\n console.log('');\n\n const changedFiles = getChangedTypeScriptFiles(workspaceRoot, base, head);\n\n if (changedFiles.length === 0) {\n console.log('✅ No TypeScript files changed');\n return { success: true };\n }\n\n console.log(`📂 Checking ${changedFiles.length} changed file(s)...`);\n\n let violations: InlineTypeViolation[] = [];\n\n if (mode === 'NEW_METHODS') {\n violations = findViolationsForNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else if (mode === 'NEW_AND_MODIFIED_METHODS') {\n violations = findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed);\n } else if (mode === 'MODIFIED_FILES') {\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);\n }\n\n if (violations.length === 0) {\n console.log('✅ No inline type literals found');\n return { success: true };\n }\n\n reportViolations(violations, mode);\n\n return { success: false };\n}\n"]}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Validate No Unmanaged Exceptions Executor
3
+ *
4
+ * Validates that try/catch blocks are not used outside chokepoints.
5
+ * Uses LINE-BASED detection (not method-based) for git diff filtering.
6
+ *
7
+ * ============================================================================
8
+ * VIOLATIONS (BAD) - These patterns are flagged:
9
+ * ============================================================================
10
+ *
11
+ * - try { — any try/catch block in non-test code
12
+ *
13
+ * ============================================================================
14
+ * ALLOWED (skip — NOT violations)
15
+ * ============================================================================
16
+ *
17
+ * - Test files (.spec.ts, .test.ts, __tests__/)
18
+ * - Lines with // webpieces-disable no-unmanaged-exceptions -- [reason]
19
+ *
20
+ * ============================================================================
21
+ * MODES (LINE-BASED)
22
+ * ============================================================================
23
+ * - OFF: Skip validation entirely
24
+ * - MODIFIED_CODE: Flag try/catch on changed lines (lines in diff hunks)
25
+ * - MODIFIED_FILES: Flag ALL try/catch in files that were modified
26
+ *
27
+ * ============================================================================
28
+ * ESCAPE HATCH
29
+ * ============================================================================
30
+ * Add comment above the violation:
31
+ * // webpieces-disable no-unmanaged-exceptions -- [your justification]
32
+ * try {
33
+ */
34
+ export type NoUnmanagedExceptionsMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';
35
+ export interface ValidateNoUnmanagedExceptionsOptions {
36
+ mode?: NoUnmanagedExceptionsMode;
37
+ disableAllowed?: boolean;
38
+ ignoreModifiedUntilEpoch?: number;
39
+ }
40
+ export interface ExecutorResult {
41
+ success: boolean;
42
+ }
43
+ export default function runValidator(options: ValidateNoUnmanagedExceptionsOptions, workspaceRoot: string): Promise<ExecutorResult>;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Validate No Unmanaged Exceptions Executor
3
4
  *
@@ -31,48 +32,30 @@
31
32
  * // webpieces-disable no-unmanaged-exceptions -- [your justification]
32
33
  * try {
33
34
  */
34
-
35
- import { execSync } from 'child_process';
36
- import * as fs from 'fs';
37
- import * as path from 'path';
38
-
39
- export type NoUnmanagedExceptionsMode = 'OFF' | 'MODIFIED_CODE' | 'MODIFIED_FILES';
40
-
41
- export interface ValidateNoUnmanagedExceptionsOptions {
42
- mode?: NoUnmanagedExceptionsMode;
43
- disableAllowed?: boolean;
44
- ignoreModifiedUntilEpoch?: number;
45
- }
46
-
47
- export interface ExecutorResult {
48
- success: boolean;
49
- }
50
-
51
- interface TryCatchViolation {
52
- file: string;
53
- line: number;
54
- context: string;
55
- }
56
-
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.default = runValidator;
37
+ const tslib_1 = require("tslib");
38
+ const child_process_1 = require("child_process");
39
+ const fs = tslib_1.__importStar(require("fs"));
40
+ const path = tslib_1.__importStar(require("path"));
57
41
  /**
58
42
  * Check if a file is a test file that should be skipped.
59
43
  */
60
- function isTestFile(filePath: string): boolean {
44
+ function isTestFile(filePath) {
61
45
  return filePath.includes('.spec.ts') ||
62
46
  filePath.includes('.test.ts') ||
63
47
  filePath.includes('__tests__/');
64
48
  }
65
-
66
49
  /**
67
50
  * Get changed TypeScript files between base and head (or working tree if head not specified).
68
51
  * Excludes test files.
69
52
  */
70
53
  // webpieces-disable max-lines-new-methods -- Git command handling with untracked files requires multiple code paths
71
- function getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: string): string[] {
54
+ function getChangedTypeScriptFiles(workspaceRoot, base, head) {
72
55
  // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
73
56
  try {
74
57
  const diffTarget = head ? `${base} ${head}` : base;
75
- const output = execSync(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {
58
+ const output = (0, child_process_1.execSync)(`git diff --name-only ${diffTarget} -- '*.ts' '*.tsx'`, {
76
59
  cwd: workspaceRoot,
77
60
  encoding: 'utf-8',
78
61
  });
@@ -80,11 +63,10 @@ function getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: s
80
63
  .trim()
81
64
  .split('\n')
82
65
  .filter((f) => f && !isTestFile(f));
83
-
84
66
  if (!head) {
85
67
  // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
86
68
  try {
87
- const untrackedOutput = execSync(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {
69
+ const untrackedOutput = (0, child_process_1.execSync)(`git ls-files --others --exclude-standard '*.ts' '*.tsx'`, {
88
70
  cwd: workspaceRoot,
89
71
  encoding: 'utf-8',
90
72
  });
@@ -94,39 +76,37 @@ function getChangedTypeScriptFiles(workspaceRoot: string, base: string, head?: s
94
76
  .filter((f) => f && !isTestFile(f));
95
77
  const allFiles = new Set([...changedFiles, ...untrackedFiles]);
96
78
  return Array.from(allFiles);
97
- // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
98
- } catch {
79
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
80
+ }
81
+ catch {
99
82
  return changedFiles;
100
83
  }
101
84
  }
102
-
103
85
  return changedFiles;
104
- // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
105
- } catch {
86
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
87
+ }
88
+ catch {
106
89
  return [];
107
90
  }
108
91
  }
109
-
110
92
  /**
111
93
  * Get the diff content for a specific file.
112
94
  */
113
- function getFileDiff(workspaceRoot: string, file: string, base: string, head?: string): string {
95
+ function getFileDiff(workspaceRoot, file, base, head) {
114
96
  // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
115
97
  try {
116
98
  const diffTarget = head ? `${base} ${head}` : base;
117
- const diff = execSync(`git diff ${diffTarget} -- "${file}"`, {
99
+ const diff = (0, child_process_1.execSync)(`git diff ${diffTarget} -- "${file}"`, {
118
100
  cwd: workspaceRoot,
119
101
  encoding: 'utf-8',
120
102
  });
121
-
122
103
  if (!diff && !head) {
123
104
  const fullPath = path.join(workspaceRoot, file);
124
105
  if (fs.existsSync(fullPath)) {
125
- const isUntracked = execSync(`git ls-files --others --exclude-standard "${file}"`, {
106
+ const isUntracked = (0, child_process_1.execSync)(`git ls-files --others --exclude-standard "${file}"`, {
126
107
  cwd: workspaceRoot,
127
108
  encoding: 'utf-8',
128
109
  }).trim();
129
-
130
110
  if (isUntracked) {
131
111
  const content = fs.readFileSync(fullPath, 'utf-8');
132
112
  const lines = content.split('\n');
@@ -134,47 +114,44 @@ function getFileDiff(workspaceRoot: string, file: string, base: string, head?: s
134
114
  }
135
115
  }
136
116
  }
137
-
138
117
  return diff;
139
- // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
140
- } catch {
118
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
119
+ }
120
+ catch {
141
121
  return '';
142
122
  }
143
123
  }
144
-
145
124
  /**
146
125
  * Parse diff to extract changed line numbers (additions only - lines starting with +).
147
126
  */
148
- function getChangedLineNumbers(diffContent: string): Set<number> {
149
- const changedLines = new Set<number>();
127
+ function getChangedLineNumbers(diffContent) {
128
+ const changedLines = new Set();
150
129
  const lines = diffContent.split('\n');
151
130
  let currentLine = 0;
152
-
153
131
  for (const line of lines) {
154
132
  const hunkMatch = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
155
133
  if (hunkMatch) {
156
134
  currentLine = parseInt(hunkMatch[1], 10);
157
135
  continue;
158
136
  }
159
-
160
137
  if (line.startsWith('+') && !line.startsWith('+++')) {
161
138
  changedLines.add(currentLine);
162
139
  currentLine++;
163
- } else if (line.startsWith('-') && !line.startsWith('---')) {
140
+ }
141
+ else if (line.startsWith('-') && !line.startsWith('---')) {
164
142
  // Deletions don't increment line number
165
- } else {
143
+ }
144
+ else {
166
145
  currentLine++;
167
146
  }
168
147
  }
169
-
170
148
  return changedLines;
171
149
  }
172
-
173
150
  /**
174
151
  * Check if a line contains a disable comment for no-unmanaged-exceptions.
175
152
  * Recognizes both webpieces-disable and eslint-disable-next-line @webpieces/ formats.
176
153
  */
177
- function hasDisableComment(lines: string[], lineNumber: number): boolean {
154
+ function hasDisableComment(lines, lineNumber) {
178
155
  const startCheck = Math.max(0, lineNumber - 5);
179
156
  for (let i = lineNumber - 2; i >= startCheck; i--) {
180
157
  const line = lines[i]?.trim() ?? '';
@@ -190,139 +167,111 @@ function hasDisableComment(lines: string[], lineNumber: number): boolean {
190
167
  }
191
168
  return false;
192
169
  }
193
-
194
170
  const TRY_PATTERN = /\btry\s*\{/;
195
-
196
- interface TryCatchInfo {
197
- line: number;
198
- context: string;
199
- hasDisableComment: boolean;
200
- }
201
-
202
171
  /**
203
172
  * Find all try/catch patterns in a file using line-based scanning.
204
173
  */
205
- function findTryCatchInFile(filePath: string, workspaceRoot: string, disableAllowed: boolean): TryCatchInfo[] {
174
+ function findTryCatchInFile(filePath, workspaceRoot, disableAllowed) {
206
175
  const fullPath = path.join(workspaceRoot, filePath);
207
- if (!fs.existsSync(fullPath)) return [];
208
-
176
+ if (!fs.existsSync(fullPath))
177
+ return [];
209
178
  const content = fs.readFileSync(fullPath, 'utf-8');
210
179
  const fileLines = content.split('\n');
211
- const violations: TryCatchInfo[] = [];
212
-
180
+ const violations = [];
213
181
  for (let i = 0; i < fileLines.length; i++) {
214
182
  const line = fileLines[i];
215
183
  const trimmed = line.trim();
216
184
  // Skip comment lines (JSDoc, block comments, line comments)
217
- if (trimmed.startsWith('*') || trimmed.startsWith('//') || trimmed.startsWith('/*')) continue;
218
- if (!TRY_PATTERN.test(line)) continue;
219
-
185
+ if (trimmed.startsWith('*') || trimmed.startsWith('//') || trimmed.startsWith('/*'))
186
+ continue;
187
+ if (!TRY_PATTERN.test(line))
188
+ continue;
220
189
  const lineNum = i + 1;
221
190
  const disabled = hasDisableComment(fileLines, lineNum);
222
-
223
191
  if (!disableAllowed && disabled) {
224
192
  violations.push({ line: lineNum, context: line.trim(), hasDisableComment: false });
225
- } else {
193
+ }
194
+ else {
226
195
  violations.push({ line: lineNum, context: line.trim(), hasDisableComment: disabled });
227
196
  }
228
197
  }
229
-
230
198
  return violations;
231
199
  }
232
-
233
200
  /**
234
201
  * MODIFIED_CODE mode: Flag violations on changed lines in diff hunks.
235
202
  */
236
- function findViolationsForModifiedCode(
237
- workspaceRoot: string,
238
- changedFiles: string[],
239
- base: string,
240
- head: string | undefined,
241
- disableAllowed: boolean,
242
- ): TryCatchViolation[] {
243
- const violations: TryCatchViolation[] = [];
244
-
203
+ function findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed) {
204
+ const violations = [];
245
205
  for (const file of changedFiles) {
246
206
  const diff = getFileDiff(workspaceRoot, file, base, head);
247
207
  const changedLines = getChangedLineNumbers(diff);
248
-
249
- if (changedLines.size === 0) continue;
250
-
208
+ if (changedLines.size === 0)
209
+ continue;
251
210
  const allViolations = findTryCatchInFile(file, workspaceRoot, disableAllowed);
252
-
253
211
  for (const v of allViolations) {
254
- if (disableAllowed && v.hasDisableComment) continue;
255
- if (!changedLines.has(v.line)) continue;
256
-
212
+ if (disableAllowed && v.hasDisableComment)
213
+ continue;
214
+ if (!changedLines.has(v.line))
215
+ continue;
257
216
  violations.push({ file, line: v.line, context: v.context });
258
217
  }
259
218
  }
260
-
261
219
  return violations;
262
220
  }
263
-
264
221
  /**
265
222
  * MODIFIED_FILES mode: Flag ALL violations in files that were modified.
266
223
  */
267
- function findViolationsForModifiedFiles(
268
- workspaceRoot: string,
269
- changedFiles: string[],
270
- disableAllowed: boolean,
271
- ): TryCatchViolation[] {
272
- const violations: TryCatchViolation[] = [];
273
-
224
+ function findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed) {
225
+ const violations = [];
274
226
  for (const file of changedFiles) {
275
227
  const allViolations = findTryCatchInFile(file, workspaceRoot, disableAllowed);
276
-
277
228
  for (const v of allViolations) {
278
- if (disableAllowed && v.hasDisableComment) continue;
229
+ if (disableAllowed && v.hasDisableComment)
230
+ continue;
279
231
  violations.push({ file, line: v.line, context: v.context });
280
232
  }
281
233
  }
282
-
283
234
  return violations;
284
235
  }
285
-
286
236
  /**
287
237
  * Auto-detect the base branch by finding the merge-base with origin/main.
288
238
  */
289
- function detectBase(workspaceRoot: string): string | null {
239
+ function detectBase(workspaceRoot) {
290
240
  // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
291
241
  try {
292
- const mergeBase = execSync('git merge-base HEAD origin/main', {
242
+ const mergeBase = (0, child_process_1.execSync)('git merge-base HEAD origin/main', {
293
243
  cwd: workspaceRoot,
294
244
  encoding: 'utf-8',
295
245
  stdio: ['pipe', 'pipe', 'pipe'],
296
246
  }).trim();
297
-
298
247
  if (mergeBase) {
299
248
  return mergeBase;
300
249
  }
301
- // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
302
- } catch {
250
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
251
+ }
252
+ catch {
303
253
  // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
304
254
  try {
305
- const mergeBase = execSync('git merge-base HEAD main', {
255
+ const mergeBase = (0, child_process_1.execSync)('git merge-base HEAD main', {
306
256
  cwd: workspaceRoot,
307
257
  encoding: 'utf-8',
308
258
  stdio: ['pipe', 'pipe', 'pipe'],
309
259
  }).trim();
310
-
311
260
  if (mergeBase) {
312
261
  return mergeBase;
313
262
  }
314
- // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
315
- } catch {
263
+ // webpieces-disable catch-error-pattern -- intentional swallow of git command failure
264
+ }
265
+ catch {
316
266
  // Ignore
317
267
  }
318
268
  }
319
269
  return null;
320
270
  }
321
-
322
271
  /**
323
272
  * Report violations to console.
324
273
  */
325
- function reportViolations(violations: TryCatchViolation[], mode: NoUnmanagedExceptionsMode, disableAllowed: boolean): void {
274
+ function reportViolations(violations, mode, disableAllowed) {
326
275
  console.error('');
327
276
  console.error('\u274c Unmanaged try/catch blocks found! Exceptions should bubble to chokepoints.');
328
277
  console.error('');
@@ -330,13 +279,11 @@ function reportViolations(violations: TryCatchViolation[], mode: NoUnmanagedExce
330
279
  console.error(' Exceptions should bubble to chokepoints (filter in Node.js, globalErrorHandler in Angular)');
331
280
  console.error(' where they are logged with traceId for debugging.');
332
281
  console.error('');
333
-
334
282
  for (const v of violations) {
335
283
  console.error(` \u274c ${v.file}:${v.line}`);
336
284
  console.error(` ${v.context}`);
337
285
  }
338
286
  console.error('');
339
-
340
287
  if (disableAllowed) {
341
288
  console.error(' Escape hatch (use sparingly):');
342
289
  console.error(' // webpieces-disable no-unmanaged-exceptions -- [your reason]');
@@ -344,7 +291,8 @@ function reportViolations(violations: TryCatchViolation[], mode: NoUnmanagedExce
344
291
  console.error(' When try/catch IS used, the catch block MUST follow:');
345
292
  console.error(' catch (err: unknown) { const error = toError(err); ... }');
346
293
  console.error(' or: catch (err: unknown) { //const error = toError(err); }');
347
- } else {
294
+ }
295
+ else {
348
296
  console.error(' Escape hatch: DISABLED (disableAllowed: false)');
349
297
  console.error(' Disable comments are ignored. Remove the try/catch.');
350
298
  }
@@ -352,11 +300,10 @@ function reportViolations(violations: TryCatchViolation[], mode: NoUnmanagedExce
352
300
  console.error(` Current mode: ${mode}`);
353
301
  console.error('');
354
302
  }
355
-
356
303
  /**
357
304
  * Resolve mode considering ignoreModifiedUntilEpoch override.
358
305
  */
359
- function resolveMode(normalMode: NoUnmanagedExceptionsMode, epoch: number | undefined): NoUnmanagedExceptionsMode {
306
+ function resolveMode(normalMode, epoch) {
360
307
  if (epoch === undefined || normalMode === 'OFF') {
361
308
  return normalMode;
362
309
  }
@@ -369,63 +316,47 @@ function resolveMode(normalMode: NoUnmanagedExceptionsMode, epoch: number | unde
369
316
  }
370
317
  return normalMode;
371
318
  }
372
-
373
- export default async function runValidator(
374
- options: ValidateNoUnmanagedExceptionsOptions,
375
- workspaceRoot: string
376
- ): Promise<ExecutorResult> {
377
- const mode: NoUnmanagedExceptionsMode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);
319
+ async function runValidator(options, workspaceRoot) {
320
+ const mode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);
378
321
  const disableAllowed = options.disableAllowed ?? true;
379
-
380
322
  if (mode === 'OFF') {
381
323
  console.log('\n\u23ed\ufe0f Skipping no-unmanaged-exceptions validation (mode: OFF)');
382
324
  console.log('');
383
325
  return { success: true };
384
326
  }
385
-
386
327
  console.log('\n\ud83d\udccf Validating No Unmanaged Exceptions\n');
387
328
  console.log(` Mode: ${mode}`);
388
-
389
329
  let base = process.env['NX_BASE'];
390
330
  const head = process.env['NX_HEAD'];
391
-
392
331
  if (!base) {
393
332
  base = detectBase(workspaceRoot) ?? undefined;
394
-
395
333
  if (!base) {
396
334
  console.log('\n\u23ed\ufe0f Skipping no-unmanaged-exceptions validation (could not detect base branch)');
397
335
  console.log('');
398
336
  return { success: true };
399
337
  }
400
338
  }
401
-
402
339
  console.log(` Base: ${base}`);
403
340
  console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);
404
341
  console.log('');
405
-
406
342
  const changedFiles = getChangedTypeScriptFiles(workspaceRoot, base, head);
407
-
408
343
  if (changedFiles.length === 0) {
409
344
  console.log('\u2705 No TypeScript files changed');
410
345
  return { success: true };
411
346
  }
412
-
413
347
  console.log(`\ud83d\udcc2 Checking ${changedFiles.length} changed file(s)...`);
414
-
415
- let violations: TryCatchViolation[] = [];
416
-
348
+ let violations = [];
417
349
  if (mode === 'MODIFIED_CODE') {
418
350
  violations = findViolationsForModifiedCode(workspaceRoot, changedFiles, base, head, disableAllowed);
419
- } else if (mode === 'MODIFIED_FILES') {
351
+ }
352
+ else if (mode === 'MODIFIED_FILES') {
420
353
  violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);
421
354
  }
422
-
423
355
  if (violations.length === 0) {
424
356
  console.log('\u2705 No unmanaged try/catch blocks found');
425
357
  return { success: true };
426
358
  }
427
-
428
359
  reportViolations(violations, mode, disableAllowed);
429
-
430
360
  return { success: false };
431
361
  }
362
+ //# sourceMappingURL=validate-no-unmanaged-exceptions.js.map