@webpieces/dev-config 0.2.83 → 0.2.84
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.
- package/architecture/executors/validate-code/executor.d.ts +20 -3
- package/architecture/executors/validate-code/executor.js +33 -11
- package/architecture/executors/validate-code/executor.js.map +1 -1
- package/architecture/executors/validate-code/executor.ts +64 -14
- package/architecture/executors/validate-code/schema.json +70 -15
- package/architecture/executors/validate-dtos/executor.d.ts +1 -0
- package/architecture/executors/validate-dtos/executor.js +6 -5
- package/architecture/executors/validate-dtos/executor.js.map +1 -1
- package/architecture/executors/validate-dtos/executor.ts +8 -4
- package/architecture/executors/validate-dtos/schema.json +5 -0
- package/architecture/executors/validate-no-any-unknown/executor.d.ts +2 -0
- package/architecture/executors/validate-no-any-unknown/executor.js +27 -7
- package/architecture/executors/validate-no-any-unknown/executor.js.map +1 -1
- package/architecture/executors/validate-no-any-unknown/executor.ts +31 -7
- package/architecture/executors/validate-no-any-unknown/schema.json +9 -0
- package/architecture/executors/validate-no-inline-types/executor.d.ts +2 -0
- package/architecture/executors/validate-no-inline-types/executor.js +30 -10
- package/architecture/executors/validate-no-inline-types/executor.js.map +1 -1
- package/architecture/executors/validate-no-inline-types/executor.ts +35 -10
- package/architecture/executors/validate-no-inline-types/schema.json +9 -0
- package/architecture/executors/validate-prisma-converters/executor.d.ts +1 -0
- package/architecture/executors/validate-prisma-converters/executor.js +13 -11
- package/architecture/executors/validate-prisma-converters/executor.js.map +1 -1
- package/architecture/executors/validate-prisma-converters/executor.ts +19 -11
- package/architecture/executors/validate-prisma-converters/schema.json +5 -0
- package/architecture/executors/validate-return-types/executor.d.ts +2 -0
- package/architecture/executors/validate-return-types/executor.js +30 -10
- package/architecture/executors/validate-return-types/executor.js.map +1 -1
- package/architecture/executors/validate-return-types/executor.ts +35 -10
- package/architecture/executors/validate-return-types/schema.json +9 -0
- package/package.json +1 -1
|
@@ -82,6 +82,8 @@ import type { ExecutorContext } from '@nx/devkit';
|
|
|
82
82
|
export type NoInlineTypesMode = 'OFF' | 'NEW_METHODS' | 'MODIFIED_AND_NEW_METHODS' | 'MODIFIED_FILES';
|
|
83
83
|
export interface ValidateNoInlineTypesOptions {
|
|
84
84
|
mode?: NoInlineTypesMode;
|
|
85
|
+
disableAllowed?: boolean;
|
|
86
|
+
ignoreModifiedUntilEpoch?: number;
|
|
85
87
|
}
|
|
86
88
|
export interface ExecutorResult {
|
|
87
89
|
success: boolean;
|
|
@@ -470,7 +470,7 @@ function findInlineTypesInFile(filePath, workspaceRoot) {
|
|
|
470
470
|
* Find violations in new methods only (NEW_METHODS mode).
|
|
471
471
|
*/
|
|
472
472
|
// webpieces-disable max-lines-new-methods -- File iteration with diff parsing and method matching
|
|
473
|
-
function findViolationsForNewMethods(workspaceRoot, changedFiles, base, head) {
|
|
473
|
+
function findViolationsForNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed) {
|
|
474
474
|
const violations = [];
|
|
475
475
|
for (const file of changedFiles) {
|
|
476
476
|
const diff = getFileDiff(workspaceRoot, file, base, head);
|
|
@@ -480,7 +480,7 @@ function findViolationsForNewMethods(workspaceRoot, changedFiles, base, head) {
|
|
|
480
480
|
const methods = findMethodsInFile(file, workspaceRoot);
|
|
481
481
|
const inlineTypes = findInlineTypesInFile(file, workspaceRoot);
|
|
482
482
|
for (const inlineType of inlineTypes) {
|
|
483
|
-
if (inlineType.hasDisableComment)
|
|
483
|
+
if (disableAllowed && inlineType.hasDisableComment)
|
|
484
484
|
continue;
|
|
485
485
|
if (!isLineInNewMethod(inlineType.line, methods, newMethodNames))
|
|
486
486
|
continue;
|
|
@@ -498,7 +498,7 @@ function findViolationsForNewMethods(workspaceRoot, changedFiles, base, head) {
|
|
|
498
498
|
* Find violations in new and modified methods (MODIFIED_AND_NEW_METHODS mode).
|
|
499
499
|
*/
|
|
500
500
|
// webpieces-disable max-lines-new-methods -- Combines new method detection with change detection
|
|
501
|
-
function findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head) {
|
|
501
|
+
function findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed) {
|
|
502
502
|
const violations = [];
|
|
503
503
|
for (const file of changedFiles) {
|
|
504
504
|
const diff = getFileDiff(workspaceRoot, file, base, head);
|
|
@@ -507,7 +507,7 @@ function findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, bas
|
|
|
507
507
|
const methods = findMethodsInFile(file, workspaceRoot);
|
|
508
508
|
const inlineTypes = findInlineTypesInFile(file, workspaceRoot);
|
|
509
509
|
for (const inlineType of inlineTypes) {
|
|
510
|
-
if (inlineType.hasDisableComment)
|
|
510
|
+
if (disableAllowed && inlineType.hasDisableComment)
|
|
511
511
|
continue;
|
|
512
512
|
if (!isLineInChangedMethod(inlineType.line, methods, changedLines, newMethodNames))
|
|
513
513
|
continue;
|
|
@@ -524,12 +524,12 @@ function findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, bas
|
|
|
524
524
|
/**
|
|
525
525
|
* Find all violations in modified files (MODIFIED_FILES mode).
|
|
526
526
|
*/
|
|
527
|
-
function findViolationsForModifiedFiles(workspaceRoot, changedFiles) {
|
|
527
|
+
function findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed) {
|
|
528
528
|
const violations = [];
|
|
529
529
|
for (const file of changedFiles) {
|
|
530
530
|
const inlineTypes = findInlineTypesInFile(file, workspaceRoot);
|
|
531
531
|
for (const inlineType of inlineTypes) {
|
|
532
|
-
if (inlineType.hasDisableComment)
|
|
532
|
+
if (disableAllowed && inlineType.hasDisableComment)
|
|
533
533
|
continue;
|
|
534
534
|
violations.push({
|
|
535
535
|
file,
|
|
@@ -602,9 +602,29 @@ function reportViolations(violations, mode) {
|
|
|
602
602
|
console.error(` Current mode: ${mode}`);
|
|
603
603
|
console.error('');
|
|
604
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* Resolve mode considering ignoreModifiedUntilEpoch override.
|
|
607
|
+
* When active, downgrades to OFF. When expired, logs a warning.
|
|
608
|
+
*/
|
|
609
|
+
function resolveMode(normalMode, epoch) {
|
|
610
|
+
if (epoch === undefined || normalMode === 'OFF') {
|
|
611
|
+
return normalMode;
|
|
612
|
+
}
|
|
613
|
+
const nowSeconds = Date.now() / 1000;
|
|
614
|
+
if (nowSeconds < epoch) {
|
|
615
|
+
const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
|
|
616
|
+
console.log(`\n⏭️ Skipping no-inline-types validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);
|
|
617
|
+
console.log('');
|
|
618
|
+
return 'OFF';
|
|
619
|
+
}
|
|
620
|
+
const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
|
|
621
|
+
console.log(`\n⚠️ noInlineTypeLiterals.ignoreModifiedUntilEpoch (${epoch}) has expired (${expiresDate}). Remove it from nx.json. Using normal mode: ${normalMode}\n`);
|
|
622
|
+
return normalMode;
|
|
623
|
+
}
|
|
605
624
|
async function runExecutor(options, context) {
|
|
606
625
|
const workspaceRoot = context.root;
|
|
607
|
-
const mode = options.mode ?? 'OFF';
|
|
626
|
+
const mode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);
|
|
627
|
+
const disableAllowed = options.disableAllowed ?? true;
|
|
608
628
|
if (mode === 'OFF') {
|
|
609
629
|
console.log('\n⏭️ Skipping no-inline-types validation (mode: OFF)');
|
|
610
630
|
console.log('');
|
|
@@ -633,13 +653,13 @@ async function runExecutor(options, context) {
|
|
|
633
653
|
console.log(`📂 Checking ${changedFiles.length} changed file(s)...`);
|
|
634
654
|
let violations = [];
|
|
635
655
|
if (mode === 'NEW_METHODS') {
|
|
636
|
-
violations = findViolationsForNewMethods(workspaceRoot, changedFiles, base, head);
|
|
656
|
+
violations = findViolationsForNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
637
657
|
}
|
|
638
658
|
else if (mode === 'MODIFIED_AND_NEW_METHODS') {
|
|
639
|
-
violations = findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head);
|
|
659
|
+
violations = findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
640
660
|
}
|
|
641
661
|
else if (mode === 'MODIFIED_FILES') {
|
|
642
|
-
violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles);
|
|
662
|
+
violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);
|
|
643
663
|
}
|
|
644
664
|
if (violations.length === 0) {
|
|
645
665
|
console.log('✅ No inline type literals found');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-no-inline-types/executor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;;AAomBH,8BA4DC;;AA7pBD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AAmBjC;;GAEG;AACH,oHAAoH;AACpH,SAAS,yBAAyB,CAAC,aAAqB,EAAE,IAAY,EAAE,IAAa;IACjF,IAAI,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,wBAAwB,UAAU,oBAAoB,EAAE;YAC5E,GAAG,EAAE,aAAa;YAClB,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,MAAM;aACtB,IAAI,EAAE;aACN,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CA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ates 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 * - MODIFIED_AND_NEW_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 type { ExecutorContext } from '@nx/devkit';\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' | 'MODIFIED_AND_NEW_METHODS' | 'MODIFIED_FILES';\n\nexport interface ValidateNoInlineTypesOptions {\n mode?: NoInlineTypesMode;\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 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 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 {\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch {\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 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 {\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 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 (error) {\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 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 (error) {\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\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 (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 (MODIFIED_AND_NEW_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\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 (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[]): 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 (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 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 {\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 {\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\nexport default async function runExecutor(\n options: ValidateNoInlineTypesOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const workspaceRoot = context.root;\n const mode: NoInlineTypesMode = options.mode ?? 'OFF';\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);\n } else if (mode === 'MODIFIED_AND_NEW_METHODS') {\n violations = findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head);\n } else if (mode === 'MODIFIED_FILES') {\n violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles);\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"]}
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/dev-config/architecture/executors/validate-no-inline-types/executor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;;AA4nBH,8BA6DC;;AAtrBD,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,uDAAiC;AAqBjC;;GAEG;AACH,oHAAoH;AACpH,SAAS,yBAAyB,CAAC,aAAqB,EAAE,IAAY,EAAE,IAAa;IACjF,IAAI,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,wBAAwB,UAAU,oBAAoB,EAAE;YAC5E,GAAG,EAAE,aAAa;YAClB,QAAQ,EAAE,OAAO;SACpB,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,MAAM;aACtB,IAAI,EAAE;aACN,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAE5E,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,IAAI,CAAC;gBACD,MAAM,eAAe,GAAG,IAAA,wBAAQ,EAAC,yDAAyD,EAAE;oBACxF,GAAG,EAAE,aAAa;oBAClB,QAAQ,EAAE,OAAO;iBACpB,CAAC,CAAC;gBACH,MAAM,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C,MAAM,qBAAqB,CAAC,CAAC;IAErE,IAAI,UAAU,GAA0B,EAAE,CAAC;IAE3C,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;QACzB,UAAU,GAAG,2BAA2B,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IACtG,CAAC;SAAM,IAAI,IAAI,KAAK,0BAA0B,EAAE,CAAC;QAC7C,UAAU,GAAG,sCAAsC,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IACjH,CAAC;SAAM,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;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 * - MODIFIED_AND_NEW_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 type { ExecutorContext } from '@nx/devkit';\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' | 'MODIFIED_AND_NEW_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 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 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 {\n return changedFiles;\n }\n }\n\n return changedFiles;\n } catch {\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 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 {\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 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 (error) {\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 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 (error) {\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 (MODIFIED_AND_NEW_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 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 {\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 {\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 const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n console.log(`\\n⚠️ noInlineTypeLiterals.ignoreModifiedUntilEpoch (${epoch}) has expired (${expiresDate}). Remove it from nx.json. Using normal mode: ${normalMode}\\n`);\n return normalMode;\n}\n\nexport default async function runExecutor(\n options: ValidateNoInlineTypesOptions,\n context: ExecutorContext\n): Promise<ExecutorResult> {\n const workspaceRoot = context.root;\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 === 'MODIFIED_AND_NEW_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"]}
|
|
@@ -89,6 +89,8 @@ export type NoInlineTypesMode = 'OFF' | 'NEW_METHODS' | 'MODIFIED_AND_NEW_METHOD
|
|
|
89
89
|
|
|
90
90
|
export interface ValidateNoInlineTypesOptions {
|
|
91
91
|
mode?: NoInlineTypesMode;
|
|
92
|
+
disableAllowed?: boolean;
|
|
93
|
+
ignoreModifiedUntilEpoch?: number;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
export interface ExecutorResult {
|
|
@@ -535,7 +537,8 @@ function findViolationsForNewMethods(
|
|
|
535
537
|
workspaceRoot: string,
|
|
536
538
|
changedFiles: string[],
|
|
537
539
|
base: string,
|
|
538
|
-
head
|
|
540
|
+
head: string | undefined,
|
|
541
|
+
disableAllowed: boolean
|
|
539
542
|
): InlineTypeViolation[] {
|
|
540
543
|
const violations: InlineTypeViolation[] = [];
|
|
541
544
|
|
|
@@ -549,7 +552,7 @@ function findViolationsForNewMethods(
|
|
|
549
552
|
const inlineTypes = findInlineTypesInFile(file, workspaceRoot);
|
|
550
553
|
|
|
551
554
|
for (const inlineType of inlineTypes) {
|
|
552
|
-
if (inlineType.hasDisableComment) continue;
|
|
555
|
+
if (disableAllowed && inlineType.hasDisableComment) continue;
|
|
553
556
|
if (!isLineInNewMethod(inlineType.line, methods, newMethodNames)) continue;
|
|
554
557
|
|
|
555
558
|
violations.push({
|
|
@@ -572,7 +575,8 @@ function findViolationsForModifiedAndNewMethods(
|
|
|
572
575
|
workspaceRoot: string,
|
|
573
576
|
changedFiles: string[],
|
|
574
577
|
base: string,
|
|
575
|
-
head
|
|
578
|
+
head: string | undefined,
|
|
579
|
+
disableAllowed: boolean
|
|
576
580
|
): InlineTypeViolation[] {
|
|
577
581
|
const violations: InlineTypeViolation[] = [];
|
|
578
582
|
|
|
@@ -585,7 +589,7 @@ function findViolationsForModifiedAndNewMethods(
|
|
|
585
589
|
const inlineTypes = findInlineTypesInFile(file, workspaceRoot);
|
|
586
590
|
|
|
587
591
|
for (const inlineType of inlineTypes) {
|
|
588
|
-
if (inlineType.hasDisableComment) continue;
|
|
592
|
+
if (disableAllowed && inlineType.hasDisableComment) continue;
|
|
589
593
|
if (!isLineInChangedMethod(inlineType.line, methods, changedLines, newMethodNames)) continue;
|
|
590
594
|
|
|
591
595
|
violations.push({
|
|
@@ -603,14 +607,14 @@ function findViolationsForModifiedAndNewMethods(
|
|
|
603
607
|
/**
|
|
604
608
|
* Find all violations in modified files (MODIFIED_FILES mode).
|
|
605
609
|
*/
|
|
606
|
-
function findViolationsForModifiedFiles(workspaceRoot: string, changedFiles: string[]): InlineTypeViolation[] {
|
|
610
|
+
function findViolationsForModifiedFiles(workspaceRoot: string, changedFiles: string[], disableAllowed: boolean): InlineTypeViolation[] {
|
|
607
611
|
const violations: InlineTypeViolation[] = [];
|
|
608
612
|
|
|
609
613
|
for (const file of changedFiles) {
|
|
610
614
|
const inlineTypes = findInlineTypesInFile(file, workspaceRoot);
|
|
611
615
|
|
|
612
616
|
for (const inlineType of inlineTypes) {
|
|
613
|
-
if (inlineType.hasDisableComment) continue;
|
|
617
|
+
if (disableAllowed && inlineType.hasDisableComment) continue;
|
|
614
618
|
|
|
615
619
|
violations.push({
|
|
616
620
|
file,
|
|
@@ -689,12 +693,33 @@ function reportViolations(violations: InlineTypeViolation[], mode: NoInlineTypes
|
|
|
689
693
|
console.error('');
|
|
690
694
|
}
|
|
691
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Resolve mode considering ignoreModifiedUntilEpoch override.
|
|
698
|
+
* When active, downgrades to OFF. When expired, logs a warning.
|
|
699
|
+
*/
|
|
700
|
+
function resolveMode(normalMode: NoInlineTypesMode, epoch: number | undefined): NoInlineTypesMode {
|
|
701
|
+
if (epoch === undefined || normalMode === 'OFF') {
|
|
702
|
+
return normalMode;
|
|
703
|
+
}
|
|
704
|
+
const nowSeconds = Date.now() / 1000;
|
|
705
|
+
if (nowSeconds < epoch) {
|
|
706
|
+
const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
|
|
707
|
+
console.log(`\n⏭️ Skipping no-inline-types validation (ignoreModifiedUntilEpoch active, expires: ${expiresDate})`);
|
|
708
|
+
console.log('');
|
|
709
|
+
return 'OFF';
|
|
710
|
+
}
|
|
711
|
+
const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
|
|
712
|
+
console.log(`\n⚠️ noInlineTypeLiterals.ignoreModifiedUntilEpoch (${epoch}) has expired (${expiresDate}). Remove it from nx.json. Using normal mode: ${normalMode}\n`);
|
|
713
|
+
return normalMode;
|
|
714
|
+
}
|
|
715
|
+
|
|
692
716
|
export default async function runExecutor(
|
|
693
717
|
options: ValidateNoInlineTypesOptions,
|
|
694
718
|
context: ExecutorContext
|
|
695
719
|
): Promise<ExecutorResult> {
|
|
696
720
|
const workspaceRoot = context.root;
|
|
697
|
-
const mode: NoInlineTypesMode = options.mode ?? 'OFF';
|
|
721
|
+
const mode: NoInlineTypesMode = resolveMode(options.mode ?? 'OFF', options.ignoreModifiedUntilEpoch);
|
|
722
|
+
const disableAllowed = options.disableAllowed ?? true;
|
|
698
723
|
|
|
699
724
|
if (mode === 'OFF') {
|
|
700
725
|
console.log('\n⏭️ Skipping no-inline-types validation (mode: OFF)');
|
|
@@ -734,11 +759,11 @@ export default async function runExecutor(
|
|
|
734
759
|
let violations: InlineTypeViolation[] = [];
|
|
735
760
|
|
|
736
761
|
if (mode === 'NEW_METHODS') {
|
|
737
|
-
violations = findViolationsForNewMethods(workspaceRoot, changedFiles, base, head);
|
|
762
|
+
violations = findViolationsForNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
738
763
|
} else if (mode === 'MODIFIED_AND_NEW_METHODS') {
|
|
739
|
-
violations = findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head);
|
|
764
|
+
violations = findViolationsForModifiedAndNewMethods(workspaceRoot, changedFiles, base, head, disableAllowed);
|
|
740
765
|
} else if (mode === 'MODIFIED_FILES') {
|
|
741
|
-
violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles);
|
|
766
|
+
violations = findViolationsForModifiedFiles(workspaceRoot, changedFiles, disableAllowed);
|
|
742
767
|
}
|
|
743
768
|
|
|
744
769
|
if (violations.length === 0) {
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
"enum": ["OFF", "NEW_METHODS", "MODIFIED_AND_NEW_METHODS", "MODIFIED_FILES"],
|
|
10
10
|
"description": "OFF: skip validation. NEW_METHODS: only new methods in diff. MODIFIED_AND_NEW_METHODS: new methods + methods with changes. MODIFIED_FILES: all inline types in modified files.",
|
|
11
11
|
"default": "OFF"
|
|
12
|
+
},
|
|
13
|
+
"disableAllowed": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "Whether disable comments work. When false, no escape hatch.",
|
|
16
|
+
"default": true
|
|
17
|
+
},
|
|
18
|
+
"ignoreModifiedUntilEpoch": {
|
|
19
|
+
"type": "number",
|
|
20
|
+
"description": "Epoch seconds. Until this time, skip validation entirely. When expired, normal mode resumes. Omit when not needed."
|
|
12
21
|
}
|
|
13
22
|
},
|
|
14
23
|
"required": []
|
|
@@ -47,6 +47,7 @@ import type { ExecutorContext } from '@nx/devkit';
|
|
|
47
47
|
export type PrismaConverterMode = 'OFF' | 'MODIFIED_FILES';
|
|
48
48
|
export interface ValidatePrismaConvertersOptions {
|
|
49
49
|
mode?: PrismaConverterMode;
|
|
50
|
+
disableAllowed?: boolean;
|
|
50
51
|
schemaPath?: string;
|
|
51
52
|
convertersPaths?: string[];
|
|
52
53
|
ignoreModifiedUntilEpoch?: number;
|
|
@@ -221,7 +221,7 @@ function checkStandaloneFunction(node, ctx) {
|
|
|
221
221
|
const startPos = node.getStart(ctx.sourceFile);
|
|
222
222
|
const pos = ctx.sourceFile.getLineAndCharacterOfPosition(startPos);
|
|
223
223
|
const line = pos.line + 1;
|
|
224
|
-
if (hasDisableComment(ctx.fileLines, line) || isDeprecated(node))
|
|
224
|
+
if ((ctx.disableAllowed && hasDisableComment(ctx.fileLines, line)) || isDeprecated(node))
|
|
225
225
|
return null;
|
|
226
226
|
return {
|
|
227
227
|
file: ctx.filePath,
|
|
@@ -283,7 +283,7 @@ function checkConverterMethod(node, ctx) {
|
|
|
283
283
|
const startPos = node.getStart(ctx.sourceFile);
|
|
284
284
|
const pos = ctx.sourceFile.getLineAndCharacterOfPosition(startPos);
|
|
285
285
|
const line = pos.line + 1;
|
|
286
|
-
if (hasDisableComment(ctx.fileLines, line) || isDeprecated(node))
|
|
286
|
+
if ((ctx.disableAllowed && hasDisableComment(ctx.fileLines, line)) || isDeprecated(node))
|
|
287
287
|
return [];
|
|
288
288
|
const returnTypeText = getTypeText(node.type, ctx.sourceFile);
|
|
289
289
|
const { inner: innerType, isAsync } = unwrapPromise(returnTypeText);
|
|
@@ -304,7 +304,7 @@ function checkConverterMethod(node, ctx) {
|
|
|
304
304
|
* Find converter method violations in a single file.
|
|
305
305
|
* Checks class methods for proper Dbo parameter patterns and flags standalone functions.
|
|
306
306
|
*/
|
|
307
|
-
function findConverterViolationsInFile(filePath, workspaceRoot, prismaModels) {
|
|
307
|
+
function findConverterViolationsInFile(filePath, workspaceRoot, prismaModels, disableAllowed) {
|
|
308
308
|
const fullPath = path.join(workspaceRoot, filePath);
|
|
309
309
|
if (!fs.existsSync(fullPath))
|
|
310
310
|
return [];
|
|
@@ -314,6 +314,7 @@ function findConverterViolationsInFile(filePath, workspaceRoot, prismaModels) {
|
|
|
314
314
|
fileLines: content.split('\n'),
|
|
315
315
|
sourceFile: ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true),
|
|
316
316
|
prismaModels,
|
|
317
|
+
disableAllowed,
|
|
317
318
|
};
|
|
318
319
|
const violations = [];
|
|
319
320
|
function visitNode(node) {
|
|
@@ -335,7 +336,7 @@ function findConverterViolationsInFile(filePath, workspaceRoot, prismaModels) {
|
|
|
335
336
|
* These Dto instances must only be created inside converter classes.
|
|
336
337
|
*/
|
|
337
338
|
// webpieces-disable max-lines-new-methods -- AST traversal for new-expression detection with prisma model matching
|
|
338
|
-
function findDtoCreationOutsideConverters(filePath, workspaceRoot, prismaModels, convertersPaths) {
|
|
339
|
+
function findDtoCreationOutsideConverters(filePath, workspaceRoot, prismaModels, convertersPaths, disableAllowed) {
|
|
339
340
|
const fullPath = path.join(workspaceRoot, filePath);
|
|
340
341
|
if (!fs.existsSync(fullPath))
|
|
341
342
|
return [];
|
|
@@ -352,7 +353,7 @@ function findDtoCreationOutsideConverters(filePath, workspaceRoot, prismaModels,
|
|
|
352
353
|
const startPos = node.getStart(sourceFile);
|
|
353
354
|
const pos = sourceFile.getLineAndCharacterOfPosition(startPos);
|
|
354
355
|
const line = pos.line + 1;
|
|
355
|
-
if (!hasDisableComment(fileLines, line)) {
|
|
356
|
+
if (!disableAllowed || !hasDisableComment(fileLines, line)) {
|
|
356
357
|
const dirs = convertersPaths.map((p) => `"${p}"`).join(', ');
|
|
357
358
|
violations.push({
|
|
358
359
|
file: filePath,
|
|
@@ -411,20 +412,20 @@ function resolveBase(workspaceRoot) {
|
|
|
411
412
|
/**
|
|
412
413
|
* Collect all violations from converter and non-converter files.
|
|
413
414
|
*/
|
|
414
|
-
function collectAllViolations(changedFiles, convertersPaths, workspaceRoot, prismaModels) {
|
|
415
|
+
function collectAllViolations(changedFiles, convertersPaths, workspaceRoot, prismaModels, disableAllowed) {
|
|
415
416
|
const converterFiles = changedFiles.filter((f) => convertersPaths.some((cp) => f.startsWith(cp)));
|
|
416
417
|
const nonConverterFiles = changedFiles.filter((f) => !convertersPaths.some((cp) => f.startsWith(cp)));
|
|
417
418
|
const allViolations = [];
|
|
418
419
|
if (converterFiles.length > 0) {
|
|
419
420
|
console.log(`📂 Checking ${converterFiles.length} converter file(s)...`);
|
|
420
421
|
for (const file of converterFiles) {
|
|
421
|
-
allViolations.push(...findConverterViolationsInFile(file, workspaceRoot, prismaModels));
|
|
422
|
+
allViolations.push(...findConverterViolationsInFile(file, workspaceRoot, prismaModels, disableAllowed));
|
|
422
423
|
}
|
|
423
424
|
}
|
|
424
425
|
if (nonConverterFiles.length > 0) {
|
|
425
426
|
console.log(`📂 Checking ${nonConverterFiles.length} non-converter file(s) for Dto creation...`);
|
|
426
427
|
for (const file of nonConverterFiles) {
|
|
427
|
-
allViolations.push(...findDtoCreationOutsideConverters(file, workspaceRoot, prismaModels, convertersPaths));
|
|
428
|
+
allViolations.push(...findDtoCreationOutsideConverters(file, workspaceRoot, prismaModels, convertersPaths, disableAllowed));
|
|
428
429
|
}
|
|
429
430
|
}
|
|
430
431
|
return allViolations;
|
|
@@ -432,7 +433,7 @@ function collectAllViolations(changedFiles, convertersPaths, workspaceRoot, pris
|
|
|
432
433
|
/**
|
|
433
434
|
* Run validation after early-exit checks have passed.
|
|
434
435
|
*/
|
|
435
|
-
function validateChangedFiles(workspaceRoot, schemaPath, convertersPaths, base, mode) {
|
|
436
|
+
function validateChangedFiles(workspaceRoot, schemaPath, convertersPaths, base, mode, disableAllowed) {
|
|
436
437
|
const head = process.env['NX_HEAD'];
|
|
437
438
|
console.log(` Base: ${base}`);
|
|
438
439
|
console.log(` Head: ${head ?? 'working tree (includes uncommitted changes)'}`);
|
|
@@ -450,7 +451,7 @@ function validateChangedFiles(workspaceRoot, schemaPath, convertersPaths, base,
|
|
|
450
451
|
console.log('✅ No TypeScript files changed');
|
|
451
452
|
return { success: true };
|
|
452
453
|
}
|
|
453
|
-
const allViolations = collectAllViolations(changedFiles, convertersPaths, workspaceRoot, prismaModels);
|
|
454
|
+
const allViolations = collectAllViolations(changedFiles, convertersPaths, workspaceRoot, prismaModels, disableAllowed);
|
|
454
455
|
if (allViolations.length === 0) {
|
|
455
456
|
console.log('✅ All converter patterns are valid');
|
|
456
457
|
return { success: true };
|
|
@@ -503,6 +504,7 @@ async function runExecutor(options, context) {
|
|
|
503
504
|
console.log('');
|
|
504
505
|
return { success: true };
|
|
505
506
|
}
|
|
506
|
-
|
|
507
|
+
const disableAllowed = options.disableAllowed ?? true;
|
|
508
|
+
return validateChangedFiles(workspaceRoot, schemaPath, convertersPaths, base, mode, disableAllowed);
|
|
507
509
|
}
|
|
508
510
|
//# sourceMappingURL=executor.js.map
|