@webpieces/dev-config 0.2.94 → 0.2.97

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 (183) hide show
  1. package/config/eslint/base.mjs +1 -1
  2. package/executors.json +6 -91
  3. package/package.json +6 -19
  4. package/{executors → src/executors}/help/executor.d.ts +4 -2
  5. package/src/executors/help/executor.js.map +1 -0
  6. package/{executors → src/executors}/validate-eslint-sync/executor.d.ts +3 -2
  7. package/src/executors/validate-eslint-sync/executor.js.map +1 -0
  8. package/{executors → src/executors}/validate-versions-locked/executor.js +5 -3
  9. package/src/executors/validate-versions-locked/executor.js.map +1 -0
  10. package/src/generators/init/generator.js.map +1 -1
  11. package/src/index.d.ts +1 -1
  12. package/src/index.js +1 -1
  13. package/src/index.js.map +1 -1
  14. package/src/plugin.d.ts +86 -0
  15. package/{plugin.js → src/plugin.js} +31 -15
  16. package/src/plugin.js.map +1 -0
  17. package/src/toError.d.ts +5 -0
  18. package/src/toError.js +37 -0
  19. package/src/toError.js.map +1 -0
  20. package/templates/eslint.webpieces.config.mjs +1 -1
  21. package/templates/webpieces.exceptions.md +15 -15
  22. package/architecture/executors/diff-utils.d.ts +0 -24
  23. package/architecture/executors/diff-utils.js +0 -119
  24. package/architecture/executors/diff-utils.js.map +0 -1
  25. package/architecture/executors/diff-utils.ts +0 -127
  26. package/architecture/executors/generate/executor.d.ts +0 -16
  27. package/architecture/executors/generate/executor.js +0 -44
  28. package/architecture/executors/generate/executor.js.map +0 -1
  29. package/architecture/executors/generate/executor.ts +0 -59
  30. package/architecture/executors/generate/schema.json +0 -14
  31. package/architecture/executors/validate-architecture-unchanged/executor.d.ts +0 -17
  32. package/architecture/executors/validate-architecture-unchanged/executor.js +0 -229
  33. package/architecture/executors/validate-architecture-unchanged/executor.js.map +0 -1
  34. package/architecture/executors/validate-architecture-unchanged/executor.ts +0 -251
  35. package/architecture/executors/validate-architecture-unchanged/schema.json +0 -14
  36. package/architecture/executors/validate-code/executor.d.ts +0 -78
  37. package/architecture/executors/validate-code/executor.js +0 -243
  38. package/architecture/executors/validate-code/executor.js.map +0 -1
  39. package/architecture/executors/validate-code/executor.ts +0 -406
  40. package/architecture/executors/validate-code/schema.json +0 -227
  41. package/architecture/executors/validate-dtos/executor.d.ts +0 -42
  42. package/architecture/executors/validate-dtos/executor.js +0 -561
  43. package/architecture/executors/validate-dtos/executor.js.map +0 -1
  44. package/architecture/executors/validate-dtos/executor.ts +0 -689
  45. package/architecture/executors/validate-dtos/schema.json +0 -33
  46. package/architecture/executors/validate-modified-files/executor.d.ts +0 -25
  47. package/architecture/executors/validate-modified-files/executor.js +0 -501
  48. package/architecture/executors/validate-modified-files/executor.js.map +0 -1
  49. package/architecture/executors/validate-modified-files/executor.ts +0 -571
  50. package/architecture/executors/validate-modified-files/schema.json +0 -25
  51. package/architecture/executors/validate-modified-methods/executor.d.ts +0 -31
  52. package/architecture/executors/validate-modified-methods/executor.js +0 -694
  53. package/architecture/executors/validate-modified-methods/executor.js.map +0 -1
  54. package/architecture/executors/validate-modified-methods/executor.ts +0 -797
  55. package/architecture/executors/validate-modified-methods/schema.json +0 -25
  56. package/architecture/executors/validate-new-methods/executor.d.ts +0 -28
  57. package/architecture/executors/validate-new-methods/executor.js +0 -513
  58. package/architecture/executors/validate-new-methods/executor.js.map +0 -1
  59. package/architecture/executors/validate-new-methods/executor.ts +0 -584
  60. package/architecture/executors/validate-new-methods/schema.json +0 -25
  61. package/architecture/executors/validate-no-any-unknown/executor.d.ts +0 -42
  62. package/architecture/executors/validate-no-any-unknown/executor.js +0 -462
  63. package/architecture/executors/validate-no-any-unknown/executor.js.map +0 -1
  64. package/architecture/executors/validate-no-any-unknown/executor.ts +0 -540
  65. package/architecture/executors/validate-no-any-unknown/schema.json +0 -24
  66. package/architecture/executors/validate-no-architecture-cycles/executor.d.ts +0 -16
  67. package/architecture/executors/validate-no-architecture-cycles/executor.js +0 -48
  68. package/architecture/executors/validate-no-architecture-cycles/executor.js.map +0 -1
  69. package/architecture/executors/validate-no-architecture-cycles/executor.ts +0 -60
  70. package/architecture/executors/validate-no-architecture-cycles/schema.json +0 -8
  71. package/architecture/executors/validate-no-destructure/executor.d.ts +0 -52
  72. package/architecture/executors/validate-no-destructure/executor.js +0 -491
  73. package/architecture/executors/validate-no-destructure/executor.js.map +0 -1
  74. package/architecture/executors/validate-no-destructure/executor.ts +0 -578
  75. package/architecture/executors/validate-no-destructure/schema.json +0 -24
  76. package/architecture/executors/validate-no-direct-api-resolver/executor.d.ts +0 -47
  77. package/architecture/executors/validate-no-direct-api-resolver/executor.js +0 -566
  78. package/architecture/executors/validate-no-direct-api-resolver/executor.js.map +0 -1
  79. package/architecture/executors/validate-no-direct-api-resolver/executor.ts +0 -666
  80. package/architecture/executors/validate-no-direct-api-resolver/schema.json +0 -29
  81. package/architecture/executors/validate-no-inline-types/executor.d.ts +0 -91
  82. package/architecture/executors/validate-no-inline-types/executor.js +0 -669
  83. package/architecture/executors/validate-no-inline-types/executor.js.map +0 -1
  84. package/architecture/executors/validate-no-inline-types/executor.ts +0 -775
  85. package/architecture/executors/validate-no-inline-types/schema.json +0 -24
  86. package/architecture/executors/validate-no-skiplevel-deps/executor.d.ts +0 -19
  87. package/architecture/executors/validate-no-skiplevel-deps/executor.js +0 -227
  88. package/architecture/executors/validate-no-skiplevel-deps/executor.js.map +0 -1
  89. package/architecture/executors/validate-no-skiplevel-deps/executor.ts +0 -267
  90. package/architecture/executors/validate-no-skiplevel-deps/schema.json +0 -8
  91. package/architecture/executors/validate-packagejson/executor.d.ts +0 -16
  92. package/architecture/executors/validate-packagejson/executor.js +0 -57
  93. package/architecture/executors/validate-packagejson/executor.js.map +0 -1
  94. package/architecture/executors/validate-packagejson/executor.ts +0 -74
  95. package/architecture/executors/validate-packagejson/schema.json +0 -8
  96. package/architecture/executors/validate-prisma-converters/executor.d.ts +0 -60
  97. package/architecture/executors/validate-prisma-converters/executor.js +0 -634
  98. package/architecture/executors/validate-prisma-converters/executor.js.map +0 -1
  99. package/architecture/executors/validate-prisma-converters/executor.ts +0 -822
  100. package/architecture/executors/validate-prisma-converters/schema.json +0 -38
  101. package/architecture/executors/validate-return-types/executor.d.ts +0 -29
  102. package/architecture/executors/validate-return-types/executor.js +0 -439
  103. package/architecture/executors/validate-return-types/executor.js.map +0 -1
  104. package/architecture/executors/validate-return-types/executor.ts +0 -524
  105. package/architecture/executors/validate-return-types/schema.json +0 -24
  106. package/architecture/executors/visualize/executor.d.ts +0 -17
  107. package/architecture/executors/visualize/executor.js +0 -49
  108. package/architecture/executors/visualize/executor.js.map +0 -1
  109. package/architecture/executors/visualize/executor.ts +0 -63
  110. package/architecture/executors/visualize/schema.json +0 -14
  111. package/architecture/index.d.ts +0 -19
  112. package/architecture/index.js +0 -23
  113. package/architecture/index.js.map +0 -1
  114. package/architecture/index.ts +0 -20
  115. package/architecture/lib/graph-comparator.d.ts +0 -39
  116. package/architecture/lib/graph-comparator.js +0 -100
  117. package/architecture/lib/graph-comparator.js.map +0 -1
  118. package/architecture/lib/graph-comparator.ts +0 -141
  119. package/architecture/lib/graph-generator.d.ts +0 -19
  120. package/architecture/lib/graph-generator.js +0 -84
  121. package/architecture/lib/graph-generator.js.map +0 -1
  122. package/architecture/lib/graph-generator.ts +0 -97
  123. package/architecture/lib/graph-loader.d.ts +0 -31
  124. package/architecture/lib/graph-loader.js +0 -98
  125. package/architecture/lib/graph-loader.js.map +0 -1
  126. package/architecture/lib/graph-loader.ts +0 -116
  127. package/architecture/lib/graph-sorter.d.ts +0 -37
  128. package/architecture/lib/graph-sorter.js +0 -110
  129. package/architecture/lib/graph-sorter.js.map +0 -1
  130. package/architecture/lib/graph-sorter.ts +0 -137
  131. package/architecture/lib/graph-visualizer.d.ts +0 -29
  132. package/architecture/lib/graph-visualizer.js +0 -217
  133. package/architecture/lib/graph-visualizer.js.map +0 -1
  134. package/architecture/lib/graph-visualizer.ts +0 -231
  135. package/architecture/lib/package-validator.d.ts +0 -38
  136. package/architecture/lib/package-validator.js +0 -126
  137. package/architecture/lib/package-validator.js.map +0 -1
  138. package/architecture/lib/package-validator.ts +0 -170
  139. package/eslint-plugin/__tests__/catch-error-pattern.test.ts +0 -359
  140. package/eslint-plugin/__tests__/max-file-lines.test.ts +0 -207
  141. package/eslint-plugin/__tests__/max-method-lines.test.ts +0 -258
  142. package/eslint-plugin/__tests__/no-unmanaged-exceptions.test.ts +0 -359
  143. package/eslint-plugin/index.d.ts +0 -23
  144. package/eslint-plugin/index.js +0 -30
  145. package/eslint-plugin/index.js.map +0 -1
  146. package/eslint-plugin/index.ts +0 -29
  147. package/eslint-plugin/rules/catch-error-pattern.d.ts +0 -11
  148. package/eslint-plugin/rules/catch-error-pattern.js +0 -196
  149. package/eslint-plugin/rules/catch-error-pattern.js.map +0 -1
  150. package/eslint-plugin/rules/catch-error-pattern.ts +0 -281
  151. package/eslint-plugin/rules/enforce-architecture.d.ts +0 -15
  152. package/eslint-plugin/rules/enforce-architecture.js +0 -476
  153. package/eslint-plugin/rules/enforce-architecture.js.map +0 -1
  154. package/eslint-plugin/rules/enforce-architecture.ts +0 -543
  155. package/eslint-plugin/rules/max-file-lines.d.ts +0 -12
  156. package/eslint-plugin/rules/max-file-lines.js +0 -257
  157. package/eslint-plugin/rules/max-file-lines.js.map +0 -1
  158. package/eslint-plugin/rules/max-file-lines.ts +0 -272
  159. package/eslint-plugin/rules/max-method-lines.d.ts +0 -12
  160. package/eslint-plugin/rules/max-method-lines.js +0 -240
  161. package/eslint-plugin/rules/max-method-lines.js.map +0 -1
  162. package/eslint-plugin/rules/max-method-lines.ts +0 -287
  163. package/eslint-plugin/rules/no-unmanaged-exceptions.d.ts +0 -22
  164. package/eslint-plugin/rules/no-unmanaged-exceptions.js +0 -160
  165. package/eslint-plugin/rules/no-unmanaged-exceptions.js.map +0 -1
  166. package/eslint-plugin/rules/no-unmanaged-exceptions.ts +0 -179
  167. package/executors/help/executor.js.map +0 -1
  168. package/executors/help/executor.ts +0 -61
  169. package/executors/validate-eslint-sync/executor.js.map +0 -1
  170. package/executors/validate-eslint-sync/executor.ts +0 -83
  171. package/executors/validate-versions-locked/executor.js.map +0 -1
  172. package/executors/validate-versions-locked/executor.ts +0 -367
  173. package/plugin/README.md +0 -243
  174. package/plugin/index.d.ts +0 -4
  175. package/plugin/index.js +0 -8
  176. package/plugin/index.js.map +0 -1
  177. package/plugin/index.ts +0 -4
  178. /package/{executors → src/executors}/help/executor.js +0 -0
  179. /package/{executors → src/executors}/help/schema.json +0 -0
  180. /package/{executors → src/executors}/validate-eslint-sync/executor.js +0 -0
  181. /package/{executors → src/executors}/validate-eslint-sync/schema.json +0 -0
  182. /package/{executors → src/executors}/validate-versions-locked/executor.d.ts +0 -0
  183. /package/{executors → src/executors}/validate-versions-locked/schema.json +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"catch-error-pattern.js","sourceRoot":"","sources":["../../../../../../packages/tooling/dev-config/eslint-plugin/rules/catch-error-pattern.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAqDH,MAAM,IAAI,GAAoB;IAC1B,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,IAAI;YACjB,GAAG,EAAE,gGAAgG;SACxG;QACD,QAAQ,EAAE;YACN,cAAc,EACV,2GAA2G;YAC/G,iBAAiB,EAAE,+DAA+D;YAClF,qBAAqB,EAAE,gEAAgE;YACvF,kBAAkB,EACd,8FAA8F;YAClG,eAAe,EAAE,mEAAmE;SACvF;QACD,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,EAAE;KACb;IAED,MAAM,CAAC,OAAyB;QAC5B,gDAAgD;QAChD,MAAM,UAAU,GAAsB,EAAE,CAAC;QAEzC,OAAO;YACH,WAAW,CAAC,IAAS;gBACjB,MAAM,SAAS,GAAG,IAAuB,CAAC;gBAE1C,oDAAoD;gBACpD,MAAM,KAAK,GA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,CAAC;wBACX,IAAI,EAAE,WAAW,CAAC,IAAI;wBACtB,SAAS,EAAE,gBAAgB;wBAC3B,IAAI,EAAE;4BACF,KAAK,EAAE,iBAAiB;yBAC3B;qBACJ,CAAC,CAAC;oBACH,OAAO;gBACX,CAAC;gBAED,MAAM,QAAQ,GAAG,WAAW,CAAC,IAA0B,CAAC;gBACxD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;gBAC/B,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBAC5D,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI,EAAE,MAAM;wBACZ,SAAS,EAAE,gBAAgB;wBAC3B,IAAI,EAAE;4BACF,KAAK,EAAE,iBAAiB;yBAC3B;qBACJ,CAAC,CAAC;oBACH,OAAO;gBACX,CAAC;gBAED,sEAAsE;gBACtE,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC;gBAChC,IACI,IAAI,CAAC,MAAM,KAAK,CAAC;oBACjB,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY;oBAC5B,IAAI,CAAC,CAAC,CAAoB,CAAC,IAAI,KAAK,eAAe,EACtD,CAAC;oBACC,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAE,gBAAgB;wBAC3B,IAAI,EAAE;4BACF,KAAK,EAAE,eAAe;yBACzB;qBACJ,CAAC,CAAC;oBACH,OAAO;gBACX,CAAC;gBAED,uBAAuB;YAC3B,CAAC;YAED,kBAAkB;gBACd,UAAU,CAAC,GAAG,EAAE,CAAC;YACrB,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC;AAEF,iBAAS,IAAI,CAAC","sourcesContent":["/**\n * ESLint rule to enforce standardized catch block error handling patterns\n *\n * Enforces three approved patterns:\n * 1. Standard: catch (err: any) { const error = toError(err); }\n * 2. Ignored: catch (err: any) { //const error = toError(err); }\n * 3. Nested: catch (err2: any) { const error2 = toError(err2); }\n */\n\nimport type { Rule } from 'eslint';\n\n// Using any for ESTree nodes to avoid complex type gymnastics\n// ESLint rules work with dynamic AST nodes anyway\ninterface CatchClauseNode {\n type: 'CatchClause';\n param?: IdentifierNode | null;\n body: BlockStatementNode;\n [key: string]: any;\n}\n\ninterface IdentifierNode {\n type: 'Identifier';\n name: string;\n typeAnnotation?: TypeAnnotationNode;\n [key: string]: any;\n}\n\ninterface TypeAnnotationNode {\n typeAnnotation?: {\n type: string;\n };\n}\n\ninterface BlockStatementNode {\n type: 'BlockStatement';\n body: any[];\n range: [number, number];\n [key: string]: any;\n}\n\ninterface VariableDeclarationNode {\n type: 'VariableDeclaration';\n declarations: VariableDeclaratorNode[];\n [key: string]: any;\n}\n\ninterface VariableDeclaratorNode {\n type: 'VariableDeclarator';\n id: IdentifierNode;\n init?: CallExpressionNode | null;\n [key: string]: any;\n}\n\ninterface CallExpressionNode {\n type: 'CallExpression';\n callee: IdentifierNode;\n arguments: any[];\n [key: string]: any;\n}\n\nconst rule: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Enforce standardized catch block error handling patterns',\n category: 'Best Practices',\n recommended: true,\n url: 'https://github.com/deanhiller/webpieces-ts/blob/main/claude.patterns.md#error-handling-pattern',\n },\n messages: {\n missingToError:\n 'Catch block must call toError({{param}}) as first statement or comment it out to explicitly ignore errors',\n wrongVariableName: 'Error variable must be named \"{{expected}}\", got \"{{actual}}\"',\n missingTypeAnnotation: 'Catch parameter must be typed as \"any\": catch ({{param}}: any)',\n wrongParameterName:\n 'Catch parameter must be named \"err\" (or \"err2\", \"err3\" for nested catches), got \"{{actual}}\"',\n toErrorNotFirst: 'toError({{param}}) must be the first statement in the catch block',\n },\n fixable: undefined,\n schema: [],\n },\n\n create(context: Rule.RuleContext): Rule.RuleListener {\n // Track nesting depth for err, err2, err3, etc.\n const catchStack: CatchClauseNode[] = [];\n\n return {\n CatchClause(node: any): void {\n const catchNode = node as CatchClauseNode;\n\n // Calculate depth (1-based: first catch is depth 1)\n const depth = catchStack.length + 1;\n catchStack.push(catchNode);\n\n // Build expected names based on depth\n const suffix = depth === 1 ? '' : String(depth);\n const expectedParamName = 'err' + suffix;\n const expectedVarName = 'error' + suffix;\n\n // Get the catch parameter\n const param = catchNode.param;\n if (!param) {\n // No parameter - unusual but technically valid (though not our pattern)\n context.report({\n node: catchNode,\n messageId: 'missingTypeAnnotation',\n data: { param: expectedParamName },\n });\n return;\n }\n\n // Track the actual parameter name for validation (may differ from expected)\n const actualParamName =\n param.type === 'Identifier' ? param.name : expectedParamName;\n\n // RULE 1: Parameter must be named correctly (err, err2, err3, etc.)\n if (param.type === 'Identifier' && param.name !== expectedParamName) {\n context.report({\n node: param,\n messageId: 'wrongParameterName',\n data: {\n actual: param.name,\n },\n });\n }\n\n // RULE 2: Must have type annotation \": any\"\n if (\n !param.typeAnnotation ||\n !param.typeAnnotation.typeAnnotation ||\n param.typeAnnotation.typeAnnotation.type !== 'TSAnyKeyword'\n ) {\n context.report({\n node: param,\n messageId: 'missingTypeAnnotation',\n data: {\n param: param.name || expectedParamName,\n },\n });\n }\n\n // RULE 3: Check first statement in catch block\n const body = catchNode.body.body;\n const sourceCode = context.sourceCode || context.getSourceCode();\n\n // IMPORTANT: Check for commented ignore pattern FIRST (before checking if body is empty)\n // This allows Pattern 2 (empty catch with only comment) to be valid\n // Look for: //const error = toError(err);\n const catchBlockStart = catchNode.body.range![0];\n const catchBlockEnd = catchNode.body.range![1];\n const catchBlockText = sourceCode.text.substring(catchBlockStart, catchBlockEnd);\n\n const ignorePattern = new RegExp(\n `//\\\\s*const\\\\s+${expectedVarName}\\\\s*=\\\\s*toError\\\\(${actualParamName}\\\\)`,\n );\n\n if (ignorePattern.test(catchBlockText)) {\n // Pattern 2: Explicitly ignored - valid!\n return;\n }\n\n // Now check if body is empty (after checking for commented pattern)\n if (body.length === 0) {\n // Empty catch block without comment - not allowed\n context.report({\n node: catchNode.body,\n messageId: 'missingToError',\n data: {\n param: expectedParamName,\n },\n });\n return;\n }\n\n const firstStatement = body[0];\n\n // Check if first statement is: const error = toError(err)\n if (firstStatement.type !== 'VariableDeclaration') {\n context.report({\n node: firstStatement,\n messageId: 'missingToError',\n data: {\n param: expectedParamName,\n },\n });\n return;\n }\n\n const varDecl = firstStatement as VariableDeclarationNode;\n const declaration = varDecl.declarations[0];\n if (!declaration) {\n context.report({\n node: firstStatement,\n messageId: 'missingToError',\n data: {\n param: expectedParamName,\n },\n });\n return;\n }\n\n // Check variable name\n if (\n declaration.id.type !== 'Identifier' ||\n declaration.id.name !== expectedVarName\n ) {\n context.report({\n node: declaration.id,\n messageId: 'wrongVariableName',\n data: {\n expected: expectedVarName,\n actual: declaration.id.name || 'unknown',\n },\n });\n return;\n }\n\n // Check initialization: toError(err)\n if (!declaration.init) {\n context.report({\n node: declaration,\n messageId: 'missingToError',\n data: {\n param: expectedParamName,\n },\n });\n return;\n }\n\n if (declaration.init.type !== 'CallExpression') {\n context.report({\n node: declaration.init,\n messageId: 'missingToError',\n data: {\n param: expectedParamName,\n },\n });\n return;\n }\n\n const callExpr = declaration.init as CallExpressionNode;\n const callee = callExpr.callee;\n if (callee.type !== 'Identifier' || callee.name !== 'toError') {\n context.report({\n node: callee,\n messageId: 'missingToError',\n data: {\n param: expectedParamName,\n },\n });\n return;\n }\n\n // Check argument: must be the catch parameter (use actual param name)\n const args = callExpr.arguments;\n if (\n args.length !== 1 ||\n args[0].type !== 'Identifier' ||\n (args[0] as IdentifierNode).name !== actualParamName\n ) {\n context.report({\n node: callExpr,\n messageId: 'missingToError',\n data: {\n param: actualParamName,\n },\n });\n return;\n }\n\n // All checks passed! ✅\n },\n\n 'CatchClause:exit'(): void {\n catchStack.pop();\n },\n };\n },\n};\n\nexport = rule;\n"]}
@@ -1,281 +0,0 @@
1
- /**
2
- * ESLint rule to enforce standardized catch block error handling patterns
3
- *
4
- * Enforces three approved patterns:
5
- * 1. Standard: catch (err: any) { const error = toError(err); }
6
- * 2. Ignored: catch (err: any) { //const error = toError(err); }
7
- * 3. Nested: catch (err2: any) { const error2 = toError(err2); }
8
- */
9
-
10
- import type { Rule } from 'eslint';
11
-
12
- // Using any for ESTree nodes to avoid complex type gymnastics
13
- // ESLint rules work with dynamic AST nodes anyway
14
- interface CatchClauseNode {
15
- type: 'CatchClause';
16
- param?: IdentifierNode | null;
17
- body: BlockStatementNode;
18
- [key: string]: any;
19
- }
20
-
21
- interface IdentifierNode {
22
- type: 'Identifier';
23
- name: string;
24
- typeAnnotation?: TypeAnnotationNode;
25
- [key: string]: any;
26
- }
27
-
28
- interface TypeAnnotationNode {
29
- typeAnnotation?: {
30
- type: string;
31
- };
32
- }
33
-
34
- interface BlockStatementNode {
35
- type: 'BlockStatement';
36
- body: any[];
37
- range: [number, number];
38
- [key: string]: any;
39
- }
40
-
41
- interface VariableDeclarationNode {
42
- type: 'VariableDeclaration';
43
- declarations: VariableDeclaratorNode[];
44
- [key: string]: any;
45
- }
46
-
47
- interface VariableDeclaratorNode {
48
- type: 'VariableDeclarator';
49
- id: IdentifierNode;
50
- init?: CallExpressionNode | null;
51
- [key: string]: any;
52
- }
53
-
54
- interface CallExpressionNode {
55
- type: 'CallExpression';
56
- callee: IdentifierNode;
57
- arguments: any[];
58
- [key: string]: any;
59
- }
60
-
61
- const rule: Rule.RuleModule = {
62
- meta: {
63
- type: 'problem',
64
- docs: {
65
- description: 'Enforce standardized catch block error handling patterns',
66
- category: 'Best Practices',
67
- recommended: true,
68
- url: 'https://github.com/deanhiller/webpieces-ts/blob/main/claude.patterns.md#error-handling-pattern',
69
- },
70
- messages: {
71
- missingToError:
72
- 'Catch block must call toError({{param}}) as first statement or comment it out to explicitly ignore errors',
73
- wrongVariableName: 'Error variable must be named "{{expected}}", got "{{actual}}"',
74
- missingTypeAnnotation: 'Catch parameter must be typed as "any": catch ({{param}}: any)',
75
- wrongParameterName:
76
- 'Catch parameter must be named "err" (or "err2", "err3" for nested catches), got "{{actual}}"',
77
- toErrorNotFirst: 'toError({{param}}) must be the first statement in the catch block',
78
- },
79
- fixable: undefined,
80
- schema: [],
81
- },
82
-
83
- create(context: Rule.RuleContext): Rule.RuleListener {
84
- // Track nesting depth for err, err2, err3, etc.
85
- const catchStack: CatchClauseNode[] = [];
86
-
87
- return {
88
- CatchClause(node: any): void {
89
- const catchNode = node as CatchClauseNode;
90
-
91
- // Calculate depth (1-based: first catch is depth 1)
92
- const depth = catchStack.length + 1;
93
- catchStack.push(catchNode);
94
-
95
- // Build expected names based on depth
96
- const suffix = depth === 1 ? '' : String(depth);
97
- const expectedParamName = 'err' + suffix;
98
- const expectedVarName = 'error' + suffix;
99
-
100
- // Get the catch parameter
101
- const param = catchNode.param;
102
- if (!param) {
103
- // No parameter - unusual but technically valid (though not our pattern)
104
- context.report({
105
- node: catchNode,
106
- messageId: 'missingTypeAnnotation',
107
- data: { param: expectedParamName },
108
- });
109
- return;
110
- }
111
-
112
- // Track the actual parameter name for validation (may differ from expected)
113
- const actualParamName =
114
- param.type === 'Identifier' ? param.name : expectedParamName;
115
-
116
- // RULE 1: Parameter must be named correctly (err, err2, err3, etc.)
117
- if (param.type === 'Identifier' && param.name !== expectedParamName) {
118
- context.report({
119
- node: param,
120
- messageId: 'wrongParameterName',
121
- data: {
122
- actual: param.name,
123
- },
124
- });
125
- }
126
-
127
- // RULE 2: Must have type annotation ": any"
128
- if (
129
- !param.typeAnnotation ||
130
- !param.typeAnnotation.typeAnnotation ||
131
- param.typeAnnotation.typeAnnotation.type !== 'TSAnyKeyword'
132
- ) {
133
- context.report({
134
- node: param,
135
- messageId: 'missingTypeAnnotation',
136
- data: {
137
- param: param.name || expectedParamName,
138
- },
139
- });
140
- }
141
-
142
- // RULE 3: Check first statement in catch block
143
- const body = catchNode.body.body;
144
- const sourceCode = context.sourceCode || context.getSourceCode();
145
-
146
- // IMPORTANT: Check for commented ignore pattern FIRST (before checking if body is empty)
147
- // This allows Pattern 2 (empty catch with only comment) to be valid
148
- // Look for: //const error = toError(err);
149
- const catchBlockStart = catchNode.body.range![0];
150
- const catchBlockEnd = catchNode.body.range![1];
151
- const catchBlockText = sourceCode.text.substring(catchBlockStart, catchBlockEnd);
152
-
153
- const ignorePattern = new RegExp(
154
- `//\\s*const\\s+${expectedVarName}\\s*=\\s*toError\\(${actualParamName}\\)`,
155
- );
156
-
157
- if (ignorePattern.test(catchBlockText)) {
158
- // Pattern 2: Explicitly ignored - valid!
159
- return;
160
- }
161
-
162
- // Now check if body is empty (after checking for commented pattern)
163
- if (body.length === 0) {
164
- // Empty catch block without comment - not allowed
165
- context.report({
166
- node: catchNode.body,
167
- messageId: 'missingToError',
168
- data: {
169
- param: expectedParamName,
170
- },
171
- });
172
- return;
173
- }
174
-
175
- const firstStatement = body[0];
176
-
177
- // Check if first statement is: const error = toError(err)
178
- if (firstStatement.type !== 'VariableDeclaration') {
179
- context.report({
180
- node: firstStatement,
181
- messageId: 'missingToError',
182
- data: {
183
- param: expectedParamName,
184
- },
185
- });
186
- return;
187
- }
188
-
189
- const varDecl = firstStatement as VariableDeclarationNode;
190
- const declaration = varDecl.declarations[0];
191
- if (!declaration) {
192
- context.report({
193
- node: firstStatement,
194
- messageId: 'missingToError',
195
- data: {
196
- param: expectedParamName,
197
- },
198
- });
199
- return;
200
- }
201
-
202
- // Check variable name
203
- if (
204
- declaration.id.type !== 'Identifier' ||
205
- declaration.id.name !== expectedVarName
206
- ) {
207
- context.report({
208
- node: declaration.id,
209
- messageId: 'wrongVariableName',
210
- data: {
211
- expected: expectedVarName,
212
- actual: declaration.id.name || 'unknown',
213
- },
214
- });
215
- return;
216
- }
217
-
218
- // Check initialization: toError(err)
219
- if (!declaration.init) {
220
- context.report({
221
- node: declaration,
222
- messageId: 'missingToError',
223
- data: {
224
- param: expectedParamName,
225
- },
226
- });
227
- return;
228
- }
229
-
230
- if (declaration.init.type !== 'CallExpression') {
231
- context.report({
232
- node: declaration.init,
233
- messageId: 'missingToError',
234
- data: {
235
- param: expectedParamName,
236
- },
237
- });
238
- return;
239
- }
240
-
241
- const callExpr = declaration.init as CallExpressionNode;
242
- const callee = callExpr.callee;
243
- if (callee.type !== 'Identifier' || callee.name !== 'toError') {
244
- context.report({
245
- node: callee,
246
- messageId: 'missingToError',
247
- data: {
248
- param: expectedParamName,
249
- },
250
- });
251
- return;
252
- }
253
-
254
- // Check argument: must be the catch parameter (use actual param name)
255
- const args = callExpr.arguments;
256
- if (
257
- args.length !== 1 ||
258
- args[0].type !== 'Identifier' ||
259
- (args[0] as IdentifierNode).name !== actualParamName
260
- ) {
261
- context.report({
262
- node: callExpr,
263
- messageId: 'missingToError',
264
- data: {
265
- param: actualParamName,
266
- },
267
- });
268
- return;
269
- }
270
-
271
- // All checks passed! ✅
272
- },
273
-
274
- 'CatchClause:exit'(): void {
275
- catchStack.pop();
276
- },
277
- };
278
- },
279
- };
280
-
281
- export = rule;
@@ -1,15 +0,0 @@
1
- /**
2
- * ESLint rule to enforce architecture boundaries
3
- *
4
- * Validates that imports from @webpieces/* packages comply with the
5
- * blessed dependency graph in .graphs/dependencies.json
6
- *
7
- * Supports transitive dependencies: if A depends on B and B depends on C,
8
- * then A can import from C.
9
- *
10
- * Configuration:
11
- * '@webpieces/enforce-architecture': 'error'
12
- */
13
- import type { Rule } from 'eslint';
14
- declare const rule: Rule.RuleModule;
15
- export = rule;