@webpieces/dev-config 0.2.95 → 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 (181) 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/src/executors/validate-eslint-sync/executor.js.map +1 -0
  7. package/{executors → src/executors}/validate-versions-locked/executor.js +2 -1
  8. package/src/executors/validate-versions-locked/executor.js.map +1 -0
  9. package/src/index.d.ts +1 -1
  10. package/src/index.js +1 -1
  11. package/src/index.js.map +1 -1
  12. package/src/plugin.d.ts +86 -0
  13. package/{plugin.js → src/plugin.js} +31 -15
  14. package/src/plugin.js.map +1 -0
  15. package/src/toError.d.ts +5 -0
  16. package/src/toError.js +37 -0
  17. package/src/toError.js.map +1 -0
  18. package/templates/eslint.webpieces.config.mjs +1 -1
  19. package/architecture/executors/diff-utils.d.ts +0 -24
  20. package/architecture/executors/diff-utils.js +0 -119
  21. package/architecture/executors/diff-utils.js.map +0 -1
  22. package/architecture/executors/diff-utils.ts +0 -127
  23. package/architecture/executors/generate/executor.d.ts +0 -16
  24. package/architecture/executors/generate/executor.js +0 -44
  25. package/architecture/executors/generate/executor.js.map +0 -1
  26. package/architecture/executors/generate/executor.ts +0 -59
  27. package/architecture/executors/generate/schema.json +0 -14
  28. package/architecture/executors/validate-architecture-unchanged/executor.d.ts +0 -17
  29. package/architecture/executors/validate-architecture-unchanged/executor.js +0 -229
  30. package/architecture/executors/validate-architecture-unchanged/executor.js.map +0 -1
  31. package/architecture/executors/validate-architecture-unchanged/executor.ts +0 -251
  32. package/architecture/executors/validate-architecture-unchanged/schema.json +0 -14
  33. package/architecture/executors/validate-code/executor.d.ts +0 -78
  34. package/architecture/executors/validate-code/executor.js +0 -243
  35. package/architecture/executors/validate-code/executor.js.map +0 -1
  36. package/architecture/executors/validate-code/executor.ts +0 -406
  37. package/architecture/executors/validate-code/schema.json +0 -227
  38. package/architecture/executors/validate-dtos/executor.d.ts +0 -42
  39. package/architecture/executors/validate-dtos/executor.js +0 -561
  40. package/architecture/executors/validate-dtos/executor.js.map +0 -1
  41. package/architecture/executors/validate-dtos/executor.ts +0 -689
  42. package/architecture/executors/validate-dtos/schema.json +0 -33
  43. package/architecture/executors/validate-modified-files/executor.d.ts +0 -25
  44. package/architecture/executors/validate-modified-files/executor.js +0 -501
  45. package/architecture/executors/validate-modified-files/executor.js.map +0 -1
  46. package/architecture/executors/validate-modified-files/executor.ts +0 -571
  47. package/architecture/executors/validate-modified-files/schema.json +0 -25
  48. package/architecture/executors/validate-modified-methods/executor.d.ts +0 -31
  49. package/architecture/executors/validate-modified-methods/executor.js +0 -694
  50. package/architecture/executors/validate-modified-methods/executor.js.map +0 -1
  51. package/architecture/executors/validate-modified-methods/executor.ts +0 -797
  52. package/architecture/executors/validate-modified-methods/schema.json +0 -25
  53. package/architecture/executors/validate-new-methods/executor.d.ts +0 -28
  54. package/architecture/executors/validate-new-methods/executor.js +0 -513
  55. package/architecture/executors/validate-new-methods/executor.js.map +0 -1
  56. package/architecture/executors/validate-new-methods/executor.ts +0 -584
  57. package/architecture/executors/validate-new-methods/schema.json +0 -25
  58. package/architecture/executors/validate-no-any-unknown/executor.d.ts +0 -42
  59. package/architecture/executors/validate-no-any-unknown/executor.js +0 -462
  60. package/architecture/executors/validate-no-any-unknown/executor.js.map +0 -1
  61. package/architecture/executors/validate-no-any-unknown/executor.ts +0 -540
  62. package/architecture/executors/validate-no-any-unknown/schema.json +0 -24
  63. package/architecture/executors/validate-no-architecture-cycles/executor.d.ts +0 -16
  64. package/architecture/executors/validate-no-architecture-cycles/executor.js +0 -48
  65. package/architecture/executors/validate-no-architecture-cycles/executor.js.map +0 -1
  66. package/architecture/executors/validate-no-architecture-cycles/executor.ts +0 -60
  67. package/architecture/executors/validate-no-architecture-cycles/schema.json +0 -8
  68. package/architecture/executors/validate-no-destructure/executor.d.ts +0 -52
  69. package/architecture/executors/validate-no-destructure/executor.js +0 -491
  70. package/architecture/executors/validate-no-destructure/executor.js.map +0 -1
  71. package/architecture/executors/validate-no-destructure/executor.ts +0 -578
  72. package/architecture/executors/validate-no-destructure/schema.json +0 -24
  73. package/architecture/executors/validate-no-direct-api-resolver/executor.d.ts +0 -47
  74. package/architecture/executors/validate-no-direct-api-resolver/executor.js +0 -566
  75. package/architecture/executors/validate-no-direct-api-resolver/executor.js.map +0 -1
  76. package/architecture/executors/validate-no-direct-api-resolver/executor.ts +0 -666
  77. package/architecture/executors/validate-no-direct-api-resolver/schema.json +0 -29
  78. package/architecture/executors/validate-no-inline-types/executor.d.ts +0 -91
  79. package/architecture/executors/validate-no-inline-types/executor.js +0 -669
  80. package/architecture/executors/validate-no-inline-types/executor.js.map +0 -1
  81. package/architecture/executors/validate-no-inline-types/executor.ts +0 -775
  82. package/architecture/executors/validate-no-inline-types/schema.json +0 -24
  83. package/architecture/executors/validate-no-skiplevel-deps/executor.d.ts +0 -19
  84. package/architecture/executors/validate-no-skiplevel-deps/executor.js +0 -227
  85. package/architecture/executors/validate-no-skiplevel-deps/executor.js.map +0 -1
  86. package/architecture/executors/validate-no-skiplevel-deps/executor.ts +0 -267
  87. package/architecture/executors/validate-no-skiplevel-deps/schema.json +0 -8
  88. package/architecture/executors/validate-packagejson/executor.d.ts +0 -16
  89. package/architecture/executors/validate-packagejson/executor.js +0 -57
  90. package/architecture/executors/validate-packagejson/executor.js.map +0 -1
  91. package/architecture/executors/validate-packagejson/executor.ts +0 -74
  92. package/architecture/executors/validate-packagejson/schema.json +0 -8
  93. package/architecture/executors/validate-prisma-converters/executor.d.ts +0 -60
  94. package/architecture/executors/validate-prisma-converters/executor.js +0 -634
  95. package/architecture/executors/validate-prisma-converters/executor.js.map +0 -1
  96. package/architecture/executors/validate-prisma-converters/executor.ts +0 -822
  97. package/architecture/executors/validate-prisma-converters/schema.json +0 -38
  98. package/architecture/executors/validate-return-types/executor.d.ts +0 -29
  99. package/architecture/executors/validate-return-types/executor.js +0 -439
  100. package/architecture/executors/validate-return-types/executor.js.map +0 -1
  101. package/architecture/executors/validate-return-types/executor.ts +0 -524
  102. package/architecture/executors/validate-return-types/schema.json +0 -24
  103. package/architecture/executors/visualize/executor.d.ts +0 -17
  104. package/architecture/executors/visualize/executor.js +0 -49
  105. package/architecture/executors/visualize/executor.js.map +0 -1
  106. package/architecture/executors/visualize/executor.ts +0 -63
  107. package/architecture/executors/visualize/schema.json +0 -14
  108. package/architecture/index.d.ts +0 -19
  109. package/architecture/index.js +0 -23
  110. package/architecture/index.js.map +0 -1
  111. package/architecture/index.ts +0 -20
  112. package/architecture/lib/graph-comparator.d.ts +0 -39
  113. package/architecture/lib/graph-comparator.js +0 -100
  114. package/architecture/lib/graph-comparator.js.map +0 -1
  115. package/architecture/lib/graph-comparator.ts +0 -141
  116. package/architecture/lib/graph-generator.d.ts +0 -19
  117. package/architecture/lib/graph-generator.js +0 -84
  118. package/architecture/lib/graph-generator.js.map +0 -1
  119. package/architecture/lib/graph-generator.ts +0 -97
  120. package/architecture/lib/graph-loader.d.ts +0 -31
  121. package/architecture/lib/graph-loader.js +0 -98
  122. package/architecture/lib/graph-loader.js.map +0 -1
  123. package/architecture/lib/graph-loader.ts +0 -116
  124. package/architecture/lib/graph-sorter.d.ts +0 -37
  125. package/architecture/lib/graph-sorter.js +0 -110
  126. package/architecture/lib/graph-sorter.js.map +0 -1
  127. package/architecture/lib/graph-sorter.ts +0 -137
  128. package/architecture/lib/graph-visualizer.d.ts +0 -29
  129. package/architecture/lib/graph-visualizer.js +0 -217
  130. package/architecture/lib/graph-visualizer.js.map +0 -1
  131. package/architecture/lib/graph-visualizer.ts +0 -231
  132. package/architecture/lib/package-validator.d.ts +0 -38
  133. package/architecture/lib/package-validator.js +0 -126
  134. package/architecture/lib/package-validator.js.map +0 -1
  135. package/architecture/lib/package-validator.ts +0 -170
  136. package/eslint-plugin/__tests__/catch-error-pattern.test.ts +0 -374
  137. package/eslint-plugin/__tests__/max-file-lines.test.ts +0 -207
  138. package/eslint-plugin/__tests__/max-method-lines.test.ts +0 -258
  139. package/eslint-plugin/__tests__/no-unmanaged-exceptions.test.ts +0 -359
  140. package/eslint-plugin/index.d.ts +0 -23
  141. package/eslint-plugin/index.js +0 -30
  142. package/eslint-plugin/index.js.map +0 -1
  143. package/eslint-plugin/index.ts +0 -29
  144. package/eslint-plugin/rules/catch-error-pattern.d.ts +0 -11
  145. package/eslint-plugin/rules/catch-error-pattern.js +0 -143
  146. package/eslint-plugin/rules/catch-error-pattern.js.map +0 -1
  147. package/eslint-plugin/rules/catch-error-pattern.ts +0 -246
  148. package/eslint-plugin/rules/enforce-architecture.d.ts +0 -15
  149. package/eslint-plugin/rules/enforce-architecture.js +0 -476
  150. package/eslint-plugin/rules/enforce-architecture.js.map +0 -1
  151. package/eslint-plugin/rules/enforce-architecture.ts +0 -543
  152. package/eslint-plugin/rules/max-file-lines.d.ts +0 -12
  153. package/eslint-plugin/rules/max-file-lines.js +0 -257
  154. package/eslint-plugin/rules/max-file-lines.js.map +0 -1
  155. package/eslint-plugin/rules/max-file-lines.ts +0 -272
  156. package/eslint-plugin/rules/max-method-lines.d.ts +0 -12
  157. package/eslint-plugin/rules/max-method-lines.js +0 -240
  158. package/eslint-plugin/rules/max-method-lines.js.map +0 -1
  159. package/eslint-plugin/rules/max-method-lines.ts +0 -287
  160. package/eslint-plugin/rules/no-unmanaged-exceptions.d.ts +0 -22
  161. package/eslint-plugin/rules/no-unmanaged-exceptions.js +0 -160
  162. package/eslint-plugin/rules/no-unmanaged-exceptions.js.map +0 -1
  163. package/eslint-plugin/rules/no-unmanaged-exceptions.ts +0 -179
  164. package/executors/help/executor.js.map +0 -1
  165. package/executors/help/executor.ts +0 -61
  166. package/executors/validate-eslint-sync/executor.js.map +0 -1
  167. package/executors/validate-eslint-sync/executor.ts +0 -87
  168. package/executors/validate-versions-locked/executor.js.map +0 -1
  169. package/executors/validate-versions-locked/executor.ts +0 -368
  170. package/plugin/README.md +0 -243
  171. package/plugin/index.d.ts +0 -4
  172. package/plugin/index.js +0 -8
  173. package/plugin/index.js.map +0 -1
  174. package/plugin/index.ts +0 -4
  175. /package/{executors → src/executors}/help/executor.js +0 -0
  176. /package/{executors → src/executors}/help/schema.json +0 -0
  177. /package/{executors → src/executors}/validate-eslint-sync/executor.d.ts +0 -0
  178. /package/{executors → src/executors}/validate-eslint-sync/executor.js +0 -0
  179. /package/{executors → src/executors}/validate-eslint-sync/schema.json +0 -0
  180. /package/{executors → src/executors}/validate-versions-locked/executor.d.ts +0 -0
  181. /package/{executors → src/executors}/validate-versions-locked/schema.json +0 -0
@@ -1,246 +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: unknown) { const error = toError(err); }
6
- * 2. Ignored: catch (err: unknown) { //const error = toError(err); }
7
- * 3. Nested: catch (err2: unknown) { 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
- function validateParamName(
62
- context: Rule.RuleContext,
63
- param: IdentifierNode,
64
- expectedParamName: string,
65
- ): void {
66
- if (param.type === 'Identifier' && param.name !== expectedParamName) {
67
- context.report({
68
- node: param,
69
- messageId: 'wrongParameterName',
70
- data: { actual: param.name },
71
- });
72
- }
73
- }
74
-
75
- function validateTypeAnnotation(
76
- context: Rule.RuleContext,
77
- param: IdentifierNode,
78
- expectedParamName: string,
79
- ): void {
80
- if (
81
- !param.typeAnnotation ||
82
- !param.typeAnnotation.typeAnnotation ||
83
- param.typeAnnotation.typeAnnotation.type !== 'TSUnknownKeyword'
84
- ) {
85
- context.report({
86
- node: param,
87
- messageId: 'missingTypeAnnotation',
88
- data: { param: param.name || expectedParamName },
89
- });
90
- }
91
- }
92
-
93
- function hasIgnoreComment(
94
- catchNode: CatchClauseNode,
95
- sourceCode: Rule.RuleContext['sourceCode'],
96
- expectedVarName: string,
97
- actualParamName: string,
98
- ): boolean {
99
- const catchBlockStart = catchNode.body.range![0];
100
- const catchBlockEnd = catchNode.body.range![1];
101
- const catchBlockText = sourceCode.text.substring(catchBlockStart, catchBlockEnd);
102
-
103
- const ignorePattern = new RegExp(
104
- `//\\s*const\\s+${expectedVarName}\\s*=\\s*toError\\(${actualParamName}\\)`,
105
- );
106
-
107
- return ignorePattern.test(catchBlockText);
108
- }
109
-
110
- function reportMissingToError(
111
- context: Rule.RuleContext,
112
- // webpieces-disable no-any-unknown -- ESLint AST node param requires any type
113
- node: any,
114
- paramName: string,
115
- ): void {
116
- context.report({
117
- node,
118
- messageId: 'missingToError',
119
- data: { param: paramName },
120
- });
121
- }
122
-
123
- function validateToErrorCall(
124
- context: Rule.RuleContext,
125
- // webpieces-disable no-any-unknown -- ESLint AST node param requires any type
126
- firstStatement: any,
127
- expectedParamName: string,
128
- expectedVarName: string,
129
- actualParamName: string,
130
- ): void {
131
- if (firstStatement.type !== 'VariableDeclaration') {
132
- reportMissingToError(context, firstStatement, expectedParamName);
133
- return;
134
- }
135
-
136
- const varDecl = firstStatement as VariableDeclarationNode;
137
- const declaration = varDecl.declarations[0];
138
- if (!declaration) {
139
- reportMissingToError(context, firstStatement, expectedParamName);
140
- return;
141
- }
142
-
143
- if (declaration.id.type !== 'Identifier' || declaration.id.name !== expectedVarName) {
144
- context.report({
145
- node: declaration.id,
146
- messageId: 'wrongVariableName',
147
- data: { expected: expectedVarName, actual: declaration.id.name || 'unknown' },
148
- });
149
- return;
150
- }
151
-
152
- if (!declaration.init || declaration.init.type !== 'CallExpression') {
153
- reportMissingToError(context, declaration.init || declaration, expectedParamName);
154
- return;
155
- }
156
-
157
- const callExpr = declaration.init as CallExpressionNode;
158
- const callee = callExpr.callee;
159
- if (callee.type !== 'Identifier' || callee.name !== 'toError') {
160
- reportMissingToError(context, callee, expectedParamName);
161
- return;
162
- }
163
-
164
- const args = callExpr.arguments;
165
- if (
166
- args.length !== 1 ||
167
- args[0].type !== 'Identifier' ||
168
- (args[0] as IdentifierNode).name !== actualParamName
169
- ) {
170
- reportMissingToError(context, callExpr, actualParamName);
171
- }
172
- }
173
-
174
- const rule: Rule.RuleModule = {
175
- meta: {
176
- type: 'problem',
177
- docs: {
178
- description: 'Enforce standardized catch block error handling patterns',
179
- category: 'Best Practices',
180
- recommended: true,
181
- url: 'https://github.com/deanhiller/webpieces-ts/blob/main/claude.patterns.md#error-handling-pattern',
182
- },
183
- messages: {
184
- missingToError:
185
- 'Catch block must call toError({{param}}) as first statement or comment it out to explicitly ignore errors',
186
- wrongVariableName: 'Error variable must be named "{{expected}}", got "{{actual}}"',
187
- missingTypeAnnotation: 'Catch parameter must be typed as "unknown": catch ({{param}}: unknown)',
188
- wrongParameterName:
189
- 'Catch parameter must be named "err" (or "err2", "err3" for nested catches), got "{{actual}}"',
190
- toErrorNotFirst: 'toError({{param}}) must be the first statement in the catch block',
191
- },
192
- fixable: undefined,
193
- schema: [],
194
- },
195
-
196
- create(context: Rule.RuleContext): Rule.RuleListener {
197
- const catchStack: CatchClauseNode[] = [];
198
-
199
- return {
200
- CatchClause(node: any): void {
201
- const catchNode = node as CatchClauseNode;
202
- const depth = catchStack.length + 1;
203
- catchStack.push(catchNode);
204
-
205
- const suffix = depth === 1 ? '' : String(depth);
206
- const expectedParamName = 'err' + suffix;
207
- const expectedVarName = 'error' + suffix;
208
-
209
- const param = catchNode.param;
210
- if (!param) {
211
- context.report({
212
- node: catchNode,
213
- messageId: 'missingTypeAnnotation',
214
- data: { param: expectedParamName },
215
- });
216
- return;
217
- }
218
-
219
- const actualParamName =
220
- param.type === 'Identifier' ? param.name : expectedParamName;
221
-
222
- validateParamName(context, param, expectedParamName);
223
- validateTypeAnnotation(context, param, expectedParamName);
224
-
225
- const sourceCode = context.sourceCode || context.getSourceCode();
226
- if (hasIgnoreComment(catchNode, sourceCode, expectedVarName, actualParamName)) {
227
- return;
228
- }
229
-
230
- const body = catchNode.body.body;
231
- if (body.length === 0) {
232
- reportMissingToError(context, catchNode.body, expectedParamName);
233
- return;
234
- }
235
-
236
- validateToErrorCall(context, body[0], expectedParamName, expectedVarName, actualParamName);
237
- },
238
-
239
- 'CatchClause:exit'(): void {
240
- catchStack.pop();
241
- },
242
- };
243
- },
244
- };
245
-
246
- 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;