@webpieces/dev-config 0.2.17 → 0.2.21
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/generate/executor.d.ts +17 -0
- package/architecture/executors/generate/executor.js +67 -0
- package/architecture/executors/generate/executor.js.map +1 -0
- package/architecture/executors/generate/executor.ts +83 -0
- package/architecture/executors/generate/schema.json +14 -0
- package/architecture/executors/validate-architecture-unchanged/executor.d.ts +17 -0
- package/architecture/executors/validate-architecture-unchanged/executor.js +65 -0
- package/architecture/executors/validate-architecture-unchanged/executor.js.map +1 -0
- package/architecture/executors/validate-architecture-unchanged/executor.ts +81 -0
- package/architecture/executors/validate-architecture-unchanged/schema.json +14 -0
- package/architecture/executors/validate-no-cycles/executor.d.ts +16 -0
- package/architecture/executors/validate-no-cycles/executor.js +48 -0
- package/architecture/executors/validate-no-cycles/executor.js.map +1 -0
- package/architecture/executors/validate-no-cycles/executor.ts +60 -0
- package/architecture/executors/validate-no-cycles/schema.json +8 -0
- package/architecture/executors/validate-no-skiplevel-deps/executor.d.ts +19 -0
- package/architecture/executors/validate-no-skiplevel-deps/executor.js +227 -0
- package/architecture/executors/validate-no-skiplevel-deps/executor.js.map +1 -0
- package/architecture/executors/validate-no-skiplevel-deps/executor.ts +267 -0
- package/architecture/executors/validate-no-skiplevel-deps/schema.json +8 -0
- package/architecture/executors/visualize/executor.d.ts +17 -0
- package/architecture/executors/visualize/executor.js +49 -0
- package/architecture/executors/visualize/executor.js.map +1 -0
- package/architecture/executors/visualize/executor.ts +63 -0
- package/architecture/executors/visualize/schema.json +14 -0
- package/architecture/index.d.ts +19 -0
- package/architecture/index.js +23 -0
- package/architecture/index.js.map +1 -0
- package/architecture/index.ts +20 -0
- package/architecture/lib/graph-comparator.d.ts +39 -0
- package/architecture/lib/graph-comparator.js +100 -0
- package/architecture/lib/graph-comparator.js.map +1 -0
- package/architecture/lib/graph-comparator.ts +141 -0
- package/architecture/lib/graph-generator.d.ts +19 -0
- package/architecture/lib/graph-generator.js +88 -0
- package/architecture/lib/graph-generator.js.map +1 -0
- package/architecture/lib/graph-generator.ts +102 -0
- package/architecture/lib/graph-loader.d.ts +31 -0
- package/architecture/lib/graph-loader.js +70 -0
- package/architecture/lib/graph-loader.js.map +1 -0
- package/architecture/lib/graph-loader.ts +82 -0
- package/architecture/lib/graph-sorter.d.ts +37 -0
- package/architecture/lib/graph-sorter.js +110 -0
- package/architecture/lib/graph-sorter.js.map +1 -0
- package/architecture/lib/graph-sorter.ts +137 -0
- package/architecture/lib/graph-visualizer.d.ts +29 -0
- package/architecture/lib/graph-visualizer.js +209 -0
- package/architecture/lib/graph-visualizer.js.map +1 -0
- package/architecture/lib/graph-visualizer.ts +222 -0
- package/architecture/lib/package-validator.d.ts +38 -0
- package/architecture/lib/package-validator.js +105 -0
- package/architecture/lib/package-validator.js.map +1 -0
- package/architecture/lib/package-validator.ts +144 -0
- package/config/eslint/base.mjs +6 -0
- package/eslint-plugin/__tests__/max-file-lines.test.ts +207 -0
- package/eslint-plugin/__tests__/max-method-lines.test.ts +258 -0
- package/eslint-plugin/__tests__/no-unmanaged-exceptions.test.ts +359 -0
- package/eslint-plugin/index.d.ts +11 -0
- package/eslint-plugin/index.js +15 -0
- package/eslint-plugin/index.js.map +1 -1
- package/eslint-plugin/index.ts +15 -0
- package/eslint-plugin/rules/enforce-architecture.d.ts +15 -0
- package/eslint-plugin/rules/enforce-architecture.js +406 -0
- package/eslint-plugin/rules/enforce-architecture.js.map +1 -0
- package/eslint-plugin/rules/enforce-architecture.ts +469 -0
- package/eslint-plugin/rules/max-file-lines.d.ts +12 -0
- package/eslint-plugin/rules/max-file-lines.js +257 -0
- package/eslint-plugin/rules/max-file-lines.js.map +1 -0
- package/eslint-plugin/rules/max-file-lines.ts +272 -0
- package/eslint-plugin/rules/max-method-lines.d.ts +12 -0
- package/eslint-plugin/rules/max-method-lines.js +240 -0
- package/eslint-plugin/rules/max-method-lines.js.map +1 -0
- package/eslint-plugin/rules/max-method-lines.ts +287 -0
- package/eslint-plugin/rules/no-unmanaged-exceptions.d.ts +22 -0
- package/eslint-plugin/rules/no-unmanaged-exceptions.js +605 -0
- package/eslint-plugin/rules/no-unmanaged-exceptions.js.map +1 -0
- package/eslint-plugin/rules/no-unmanaged-exceptions.ts +621 -0
- package/executors.json +29 -0
- package/package.json +13 -3
- package/plugins/circular-deps/index.d.ts +8 -0
- package/plugins/circular-deps/index.js +14 -0
- package/plugins/circular-deps/index.js.map +1 -0
- package/plugins/circular-deps/index.ts +9 -0
- package/plugins/circular-deps/plugin.d.ts +32 -0
- package/plugins/circular-deps/plugin.js +73 -0
- package/plugins/circular-deps/plugin.js.map +1 -0
- package/plugins/circular-deps/plugin.ts +83 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for no-unmanaged-exceptions ESLint rule
|
|
3
|
+
*
|
|
4
|
+
* Validates that try-catch blocks are:
|
|
5
|
+
* - Auto-allowed in test files (.test.ts, .spec.ts, __tests__/)
|
|
6
|
+
* - Allowed with eslint-disable comment
|
|
7
|
+
* - Disallowed in production code without approval
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { RuleTester } from 'eslint';
|
|
11
|
+
import rule from '../rules/no-unmanaged-exceptions';
|
|
12
|
+
|
|
13
|
+
const tsParser = require('@typescript-eslint/parser');
|
|
14
|
+
|
|
15
|
+
const ruleTester = new RuleTester({
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parser: tsParser,
|
|
18
|
+
parserOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
sourceType: 'module',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
ruleTester.run('no-unmanaged-exceptions', rule, {
|
|
26
|
+
valid: [
|
|
27
|
+
// ============================================
|
|
28
|
+
// Test files - auto-allowed
|
|
29
|
+
// ============================================
|
|
30
|
+
{
|
|
31
|
+
code: `
|
|
32
|
+
try {
|
|
33
|
+
await operation();
|
|
34
|
+
} catch (err: any) {
|
|
35
|
+
const error = toError(err);
|
|
36
|
+
expect(error).toBeDefined();
|
|
37
|
+
}
|
|
38
|
+
`,
|
|
39
|
+
filename: 'SaveController.test.ts',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
code: `
|
|
43
|
+
try {
|
|
44
|
+
await controller.save(request);
|
|
45
|
+
fail('Should have thrown');
|
|
46
|
+
} catch (err: any) {
|
|
47
|
+
const error = toError(err);
|
|
48
|
+
expect(error.message).toContain('Invalid');
|
|
49
|
+
}
|
|
50
|
+
`,
|
|
51
|
+
filename: 'packages/http/http-server/src/SaveController.test.ts',
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
// Spec files - auto-allowed
|
|
55
|
+
{
|
|
56
|
+
code: `
|
|
57
|
+
try {
|
|
58
|
+
await operation();
|
|
59
|
+
} catch (err: any) {
|
|
60
|
+
const error = toError(err);
|
|
61
|
+
}
|
|
62
|
+
`,
|
|
63
|
+
filename: 'userService.spec.ts',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
code: `
|
|
67
|
+
it('should throw error', async () => {
|
|
68
|
+
try {
|
|
69
|
+
await service.process();
|
|
70
|
+
fail();
|
|
71
|
+
} catch (err: any) {
|
|
72
|
+
const error = toError(err);
|
|
73
|
+
expect(error).toBeDefined();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
`,
|
|
77
|
+
filename: 'packages/services/user/userService.spec.ts',
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
// __tests__ directory - auto-allowed (need full path)
|
|
81
|
+
{
|
|
82
|
+
code: `
|
|
83
|
+
try {
|
|
84
|
+
await operation();
|
|
85
|
+
} catch (err: any) {
|
|
86
|
+
const error = toError(err);
|
|
87
|
+
}
|
|
88
|
+
`,
|
|
89
|
+
filename: '/project/__tests__/integration.ts',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
code: `
|
|
93
|
+
try {
|
|
94
|
+
await runIntegrationTest();
|
|
95
|
+
} catch (err: any) {
|
|
96
|
+
const error = toError(err);
|
|
97
|
+
console.error(error);
|
|
98
|
+
}
|
|
99
|
+
`,
|
|
100
|
+
filename: '/project/packages/http/__tests__/server-integration.ts',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
code: `
|
|
104
|
+
try {
|
|
105
|
+
const result = performAction();
|
|
106
|
+
} catch (err: any) {
|
|
107
|
+
const error = toError(err);
|
|
108
|
+
}
|
|
109
|
+
`,
|
|
110
|
+
filename: '/project/src/__tests__/helpers/testUtils.ts',
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
// ============================================
|
|
114
|
+
// Code without try-catch (preferred pattern)
|
|
115
|
+
// ============================================
|
|
116
|
+
{
|
|
117
|
+
code: `
|
|
118
|
+
async function processOrder(order: Order): Promise<void> {
|
|
119
|
+
await validateOrder(order);
|
|
120
|
+
await saveToDatabase(order);
|
|
121
|
+
}
|
|
122
|
+
`,
|
|
123
|
+
filename: 'OrderService.ts',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
code: `
|
|
127
|
+
export class SaveController {
|
|
128
|
+
async save(request: SaveRequest): Promise<SaveResponse> {
|
|
129
|
+
const result = await this.service.save(request);
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`,
|
|
134
|
+
filename: 'packages/http/http-server/src/SaveController.ts',
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
// ============================================
|
|
138
|
+
// Nested functions without try-catch
|
|
139
|
+
// ============================================
|
|
140
|
+
{
|
|
141
|
+
code: `
|
|
142
|
+
function outer() {
|
|
143
|
+
function inner() {
|
|
144
|
+
return doSomething();
|
|
145
|
+
}
|
|
146
|
+
return inner();
|
|
147
|
+
}
|
|
148
|
+
`,
|
|
149
|
+
filename: 'Utils.ts',
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
|
|
153
|
+
invalid: [
|
|
154
|
+
// ============================================
|
|
155
|
+
// Controllers without approval
|
|
156
|
+
// ============================================
|
|
157
|
+
{
|
|
158
|
+
code: `
|
|
159
|
+
try {
|
|
160
|
+
await operation();
|
|
161
|
+
} catch (err: any) {
|
|
162
|
+
const error = toError(err);
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
filename: 'SaveController.ts',
|
|
166
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
code: `
|
|
170
|
+
export class SaveController {
|
|
171
|
+
async save(request: SaveRequest): Promise<SaveResponse> {
|
|
172
|
+
try {
|
|
173
|
+
const result = await this.service.save(request);
|
|
174
|
+
return result;
|
|
175
|
+
} catch (err: any) {
|
|
176
|
+
const error = toError(err);
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
`,
|
|
182
|
+
filename: 'packages/http/http-server/src/SaveController.ts',
|
|
183
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
// ============================================
|
|
187
|
+
// Services without approval
|
|
188
|
+
// ============================================
|
|
189
|
+
{
|
|
190
|
+
code: `
|
|
191
|
+
try {
|
|
192
|
+
await this.database.query(sql);
|
|
193
|
+
} catch (err: any) {
|
|
194
|
+
const error = toError(err);
|
|
195
|
+
}
|
|
196
|
+
`,
|
|
197
|
+
filename: 'UserService.ts',
|
|
198
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
code: `
|
|
202
|
+
export class UserService {
|
|
203
|
+
async getUserById(id: string): Promise<User> {
|
|
204
|
+
try {
|
|
205
|
+
const user = await this.db.findOne({ id });
|
|
206
|
+
return user;
|
|
207
|
+
} catch (err: any) {
|
|
208
|
+
const error = toError(err);
|
|
209
|
+
console.error('Failed to fetch user:', error);
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
`,
|
|
215
|
+
filename: 'packages/services/user/UserService.ts',
|
|
216
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
// ============================================
|
|
220
|
+
// Filters without approval
|
|
221
|
+
// ============================================
|
|
222
|
+
{
|
|
223
|
+
code: `
|
|
224
|
+
try {
|
|
225
|
+
return JSON.parse(body);
|
|
226
|
+
} catch (err: any) {
|
|
227
|
+
const error = toError(err);
|
|
228
|
+
}
|
|
229
|
+
`,
|
|
230
|
+
filename: 'JsonFilter.ts',
|
|
231
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
code: `
|
|
235
|
+
export class LogFilter implements Filter {
|
|
236
|
+
async filter(meta: MethodMeta, next: NextFilter): Promise<Action> {
|
|
237
|
+
try {
|
|
238
|
+
return await next.execute();
|
|
239
|
+
} catch (err: any) {
|
|
240
|
+
const error = toError(err);
|
|
241
|
+
console.error('Filter error:', error);
|
|
242
|
+
throw error;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
`,
|
|
247
|
+
filename: 'packages/http/http-server/src/filters/LogFilter.ts',
|
|
248
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
// ============================================
|
|
252
|
+
// Utility functions without approval
|
|
253
|
+
// ============================================
|
|
254
|
+
{
|
|
255
|
+
code: `
|
|
256
|
+
async function fetchData(url: string): Promise<Data> {
|
|
257
|
+
try {
|
|
258
|
+
const response = await fetch(url);
|
|
259
|
+
return await response.json();
|
|
260
|
+
} catch (err: any) {
|
|
261
|
+
const error = toError(err);
|
|
262
|
+
throw new Error(\`Fetch failed: \${error.message}\`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
`,
|
|
266
|
+
filename: 'packages/core/core-util/src/httpUtils.ts',
|
|
267
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
// ============================================
|
|
271
|
+
// Multiple try-catch blocks in one file
|
|
272
|
+
// ============================================
|
|
273
|
+
{
|
|
274
|
+
code: `
|
|
275
|
+
async function operation1() {
|
|
276
|
+
try {
|
|
277
|
+
await doSomething();
|
|
278
|
+
} catch (err: any) {
|
|
279
|
+
const error = toError(err);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async function operation2() {
|
|
284
|
+
try {
|
|
285
|
+
await doSomethingElse();
|
|
286
|
+
} catch (err: any) {
|
|
287
|
+
const error = toError(err);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
`,
|
|
291
|
+
filename: 'MultipleOperations.ts',
|
|
292
|
+
errors: [
|
|
293
|
+
{ messageId: 'noUnmanagedExceptions' },
|
|
294
|
+
{ messageId: 'noUnmanagedExceptions' },
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
// ============================================
|
|
299
|
+
// Nested try-catch blocks
|
|
300
|
+
// ============================================
|
|
301
|
+
{
|
|
302
|
+
code: `
|
|
303
|
+
try {
|
|
304
|
+
try {
|
|
305
|
+
await operation();
|
|
306
|
+
} catch (err2: any) {
|
|
307
|
+
const error2 = toError(err2);
|
|
308
|
+
}
|
|
309
|
+
} catch (err: any) {
|
|
310
|
+
const error = toError(err);
|
|
311
|
+
}
|
|
312
|
+
`,
|
|
313
|
+
filename: 'NestedOperations.ts',
|
|
314
|
+
errors: [
|
|
315
|
+
{ messageId: 'noUnmanagedExceptions' },
|
|
316
|
+
{ messageId: 'noUnmanagedExceptions' },
|
|
317
|
+
],
|
|
318
|
+
},
|
|
319
|
+
|
|
320
|
+
// ============================================
|
|
321
|
+
// Try-catch in arrow functions
|
|
322
|
+
// ============================================
|
|
323
|
+
{
|
|
324
|
+
code: `
|
|
325
|
+
const handler = async () => {
|
|
326
|
+
try {
|
|
327
|
+
await doSomething();
|
|
328
|
+
} catch (err: any) {
|
|
329
|
+
const error = toError(err);
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
`,
|
|
333
|
+
filename: 'Handlers.ts',
|
|
334
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
335
|
+
},
|
|
336
|
+
|
|
337
|
+
// ============================================
|
|
338
|
+
// Try-catch in class methods
|
|
339
|
+
// ============================================
|
|
340
|
+
{
|
|
341
|
+
code: `
|
|
342
|
+
export class DataProcessor {
|
|
343
|
+
process(data: Data): Result {
|
|
344
|
+
try {
|
|
345
|
+
return this.performProcessing(data);
|
|
346
|
+
} catch (err: any) {
|
|
347
|
+
const error = toError(err);
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
`,
|
|
353
|
+
filename: 'packages/processors/DataProcessor.ts',
|
|
354
|
+
errors: [{ messageId: 'noUnmanagedExceptions' }],
|
|
355
|
+
},
|
|
356
|
+
],
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
console.log('All no-unmanaged-exceptions tests passed!');
|
package/eslint-plugin/index.d.ts
CHANGED
|
@@ -3,10 +3,21 @@
|
|
|
3
3
|
* Provides rules for enforcing WebPieces code patterns
|
|
4
4
|
*
|
|
5
5
|
* This plugin is automatically included in @webpieces/dev-config
|
|
6
|
+
*
|
|
7
|
+
* Available rules:
|
|
8
|
+
* - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)
|
|
9
|
+
* - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)
|
|
10
|
+
* - max-method-lines: Enforce maximum method length (default: 70 lines)
|
|
11
|
+
* - max-file-lines: Enforce maximum file length (default: 700 lines)
|
|
12
|
+
* - enforce-architecture: Enforce architecture dependency boundaries
|
|
6
13
|
*/
|
|
7
14
|
declare const _default: {
|
|
8
15
|
rules: {
|
|
9
16
|
'catch-error-pattern': import("eslint").Rule.RuleModule;
|
|
17
|
+
'no-unmanaged-exceptions': import("eslint").Rule.RuleModule;
|
|
18
|
+
'max-method-lines': import("eslint").Rule.RuleModule;
|
|
19
|
+
'max-file-lines': import("eslint").Rule.RuleModule;
|
|
20
|
+
'enforce-architecture': import("eslint").Rule.RuleModule;
|
|
10
21
|
};
|
|
11
22
|
};
|
|
12
23
|
export = _default;
|
package/eslint-plugin/index.js
CHANGED
|
@@ -4,12 +4,27 @@
|
|
|
4
4
|
* Provides rules for enforcing WebPieces code patterns
|
|
5
5
|
*
|
|
6
6
|
* This plugin is automatically included in @webpieces/dev-config
|
|
7
|
+
*
|
|
8
|
+
* Available rules:
|
|
9
|
+
* - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)
|
|
10
|
+
* - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)
|
|
11
|
+
* - max-method-lines: Enforce maximum method length (default: 70 lines)
|
|
12
|
+
* - max-file-lines: Enforce maximum file length (default: 700 lines)
|
|
13
|
+
* - enforce-architecture: Enforce architecture dependency boundaries
|
|
7
14
|
*/
|
|
8
15
|
const tslib_1 = require("tslib");
|
|
9
16
|
const catch_error_pattern_1 = tslib_1.__importDefault(require("./rules/catch-error-pattern"));
|
|
17
|
+
const no_unmanaged_exceptions_1 = tslib_1.__importDefault(require("./rules/no-unmanaged-exceptions"));
|
|
18
|
+
const max_method_lines_1 = tslib_1.__importDefault(require("./rules/max-method-lines"));
|
|
19
|
+
const max_file_lines_1 = tslib_1.__importDefault(require("./rules/max-file-lines"));
|
|
20
|
+
const enforce_architecture_1 = tslib_1.__importDefault(require("./rules/enforce-architecture"));
|
|
10
21
|
module.exports = {
|
|
11
22
|
rules: {
|
|
12
23
|
'catch-error-pattern': catch_error_pattern_1.default,
|
|
24
|
+
'no-unmanaged-exceptions': no_unmanaged_exceptions_1.default,
|
|
25
|
+
'max-method-lines': max_method_lines_1.default,
|
|
26
|
+
'max-file-lines': max_file_lines_1.default,
|
|
27
|
+
'enforce-architecture': enforce_architecture_1.default,
|
|
13
28
|
},
|
|
14
29
|
};
|
|
15
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/dev-config/eslint-plugin/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/dev-config/eslint-plugin/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAEH,8FAA4D;AAC5D,sGAAoE;AACpE,wFAAsD;AACtD,oFAAkD;AAClD,gGAA+D;AAE/D,iBAAS;IACL,KAAK,EAAE;QACH,qBAAqB,EAAE,6BAAiB;QACxC,yBAAyB,EAAE,iCAAqB;QAChD,kBAAkB,EAAE,0BAAc;QAClC,gBAAgB,EAAE,wBAAY;QAC9B,sBAAsB,EAAE,8BAAmB;KAC9C;CACJ,CAAC","sourcesContent":["/**\n * ESLint plugin for WebPieces\n * Provides rules for enforcing WebPieces code patterns\n *\n * This plugin is automatically included in @webpieces/dev-config\n *\n * Available rules:\n * - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)\n * - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)\n * - max-method-lines: Enforce maximum method length (default: 70 lines)\n * - max-file-lines: Enforce maximum file length (default: 700 lines)\n * - enforce-architecture: Enforce architecture dependency boundaries\n */\n\nimport catchErrorPattern from './rules/catch-error-pattern';\nimport noUnmanagedExceptions from './rules/no-unmanaged-exceptions';\nimport maxMethodLines from './rules/max-method-lines';\nimport maxFileLines from './rules/max-file-lines';\nimport enforceArchitecture from './rules/enforce-architecture';\n\nexport = {\n rules: {\n 'catch-error-pattern': catchErrorPattern,\n 'no-unmanaged-exceptions': noUnmanagedExceptions,\n 'max-method-lines': maxMethodLines,\n 'max-file-lines': maxFileLines,\n 'enforce-architecture': enforceArchitecture,\n },\n};\n"]}
|
package/eslint-plugin/index.ts
CHANGED
|
@@ -3,12 +3,27 @@
|
|
|
3
3
|
* Provides rules for enforcing WebPieces code patterns
|
|
4
4
|
*
|
|
5
5
|
* This plugin is automatically included in @webpieces/dev-config
|
|
6
|
+
*
|
|
7
|
+
* Available rules:
|
|
8
|
+
* - catch-error-pattern: Enforce toError() usage in catch blocks (HOW to handle)
|
|
9
|
+
* - no-unmanaged-exceptions: Discourage try-catch outside tests (WHERE to handle)
|
|
10
|
+
* - max-method-lines: Enforce maximum method length (default: 70 lines)
|
|
11
|
+
* - max-file-lines: Enforce maximum file length (default: 700 lines)
|
|
12
|
+
* - enforce-architecture: Enforce architecture dependency boundaries
|
|
6
13
|
*/
|
|
7
14
|
|
|
8
15
|
import catchErrorPattern from './rules/catch-error-pattern';
|
|
16
|
+
import noUnmanagedExceptions from './rules/no-unmanaged-exceptions';
|
|
17
|
+
import maxMethodLines from './rules/max-method-lines';
|
|
18
|
+
import maxFileLines from './rules/max-file-lines';
|
|
19
|
+
import enforceArchitecture from './rules/enforce-architecture';
|
|
9
20
|
|
|
10
21
|
export = {
|
|
11
22
|
rules: {
|
|
12
23
|
'catch-error-pattern': catchErrorPattern,
|
|
24
|
+
'no-unmanaged-exceptions': noUnmanagedExceptions,
|
|
25
|
+
'max-method-lines': maxMethodLines,
|
|
26
|
+
'max-file-lines': maxFileLines,
|
|
27
|
+
'enforce-architecture': enforceArchitecture,
|
|
13
28
|
},
|
|
14
29
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|