@webpieces/eslint-rules 0.0.1 → 0.2.114

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 (47) hide show
  1. package/package.json +3 -2
  2. package/src/index.d.ts +29 -0
  3. package/src/index.js +39 -0
  4. package/src/index.js.map +1 -0
  5. package/src/rules/catch-error-pattern.d.ts +11 -0
  6. package/src/rules/{catch-error-pattern.ts → catch-error-pattern.js} +30 -142
  7. package/src/rules/catch-error-pattern.js.map +1 -0
  8. package/src/rules/enforce-architecture.d.ts +15 -0
  9. package/src/rules/{enforce-architecture.ts → enforce-architecture.js} +61 -128
  10. package/src/rules/enforce-architecture.js.map +1 -0
  11. package/src/rules/max-file-lines.d.ts +12 -0
  12. package/src/rules/{max-file-lines.ts → max-file-lines.js} +22 -37
  13. package/src/rules/max-file-lines.js.map +1 -0
  14. package/src/rules/max-method-lines.d.ts +12 -0
  15. package/src/rules/{max-method-lines.ts → max-method-lines.js} +31 -81
  16. package/src/rules/max-method-lines.js.map +1 -0
  17. package/src/rules/no-json-property-primitive-type.d.ts +17 -0
  18. package/src/rules/no-json-property-primitive-type.js +57 -0
  19. package/src/rules/no-json-property-primitive-type.js.map +1 -0
  20. package/src/rules/no-mat-cell-def.d.ts +15 -0
  21. package/src/rules/{no-mat-cell-def.ts → no-mat-cell-def.js} +8 -21
  22. package/src/rules/no-mat-cell-def.js.map +1 -0
  23. package/src/rules/no-unmanaged-exceptions.d.ts +22 -0
  24. package/src/rules/{no-unmanaged-exceptions.ts → no-unmanaged-exceptions.js} +27 -52
  25. package/src/rules/no-unmanaged-exceptions.js.map +1 -0
  26. package/src/rules/require-typed-template.d.ts +17 -0
  27. package/src/rules/{require-typed-template.ts → require-typed-template.js} +11 -31
  28. package/src/rules/require-typed-template.js.map +1 -0
  29. package/src/toError.d.ts +5 -0
  30. package/src/{toError.ts → toError.js} +7 -6
  31. package/src/toError.js.map +1 -0
  32. package/.webpieces/instruct-ai/webpieces.exceptions.md +0 -5
  33. package/.webpieces/instruct-ai/webpieces.filesize.md +0 -146
  34. package/.webpieces/instruct-ai/webpieces.methods.md +0 -97
  35. package/LICENSE +0 -373
  36. package/jest.config.ts +0 -16
  37. package/project.json +0 -22
  38. package/src/__tests__/catch-error-pattern.test.ts +0 -374
  39. package/src/__tests__/max-file-lines.test.ts +0 -207
  40. package/src/__tests__/max-method-lines.test.ts +0 -258
  41. package/src/__tests__/no-unmanaged-exceptions.test.ts +0 -359
  42. package/src/index.ts +0 -38
  43. package/src/rules/no-json-property-primitive-type.ts +0 -85
  44. package/tmp/webpieces/webpieces.exceptions.md +0 -5
  45. package/tsconfig.json +0 -22
  46. package/tsconfig.lib.json +0 -10
  47. package/tsconfig.spec.json +0 -14
@@ -1,85 +0,0 @@
1
- /**
2
- * ESLint rule: no-json-property-primitive-type
3
- *
4
- * Bans @JsonProperty({ type: String }), @JsonProperty({ type: Number }),
5
- * and @JsonProperty({ type: Boolean }).
6
- *
7
- * These pass the TypeScript build but break production deserialization.
8
- * The typescript-json-serializer `type` option expects class constructors,
9
- * not JavaScript primitive constructors.
10
- *
11
- * Correct usage:
12
- * @JsonProperty() - for primitive arrays (string[], number[], boolean[])
13
- * @JsonProperty({ type: MyDtoClass }) - for class types only
14
- */
15
-
16
- import type { Rule } from 'eslint';
17
-
18
- // webpieces-disable no-any-unknown -- ESTree AST node interfaces require any for dynamic properties
19
- interface CallExpressionNode {
20
- type: 'CallExpression';
21
- // webpieces-disable no-any-unknown -- ESTree AST dynamic callee
22
- callee: { name?: string; [key: string]: any };
23
- // webpieces-disable no-any-unknown -- ESTree AST dynamic arguments array
24
- arguments: any[];
25
- // webpieces-disable no-any-unknown -- ESTree AST index signature
26
- [key: string]: any;
27
- }
28
-
29
- interface ObjectExpressionNode {
30
- type: 'ObjectExpression';
31
- properties: PropertyNode[];
32
- }
33
-
34
- interface PropertyNode {
35
- key?: { name?: string };
36
- value?: { type?: string; name?: string };
37
- // webpieces-disable no-any-unknown -- ESTree AST index signature
38
- [key: string]: any;
39
- }
40
-
41
- const BANNED_PRIMITIVES = ['String', 'Number', 'Boolean'];
42
-
43
- const rule: Rule.RuleModule = {
44
- meta: {
45
- type: 'problem',
46
- docs: {
47
- description:
48
- 'Ban @JsonProperty({ type: String/Number/Boolean }) — breaks production deserialization',
49
- },
50
- messages: {
51
- noPrimitiveType:
52
- '@JsonProperty({ type: {{ primitive }} }) breaks production deserialization. ' +
53
- 'For primitive arrays (string[], number[], boolean[]), use @JsonProperty() with ' +
54
- 'no type parameter. The type option is only for class types: ' +
55
- '@JsonProperty({ type: MyDtoClass }).',
56
- },
57
- schema: [],
58
- },
59
- create(context: Rule.RuleContext): Rule.RuleListener {
60
- return {
61
- CallExpression(node: CallExpressionNode): void {
62
- if (node.callee.name !== 'JsonProperty') return;
63
- const arg = node.arguments[0];
64
- if (!arg || arg.type !== 'ObjectExpression') return;
65
- const objArg = arg as ObjectExpressionNode;
66
- for (const prop of objArg.properties) {
67
- if (
68
- prop.key?.name === 'type' &&
69
- prop.value?.type === 'Identifier' &&
70
- BANNED_PRIMITIVES.includes(prop.value.name!)
71
- ) {
72
- context.report({
73
- // webpieces-disable no-any-unknown -- ESTree AST cast for ESLint report
74
- node: prop as unknown as Rule.Node,
75
- messageId: 'noPrimitiveType',
76
- data: { primitive: prop.value.name! },
77
- });
78
- }
79
- }
80
- },
81
- };
82
- },
83
- };
84
-
85
- export = rule;
@@ -1,5 +0,0 @@
1
- # Exception Documentation Not Found
2
-
3
- Template file not found at: /Users/deanhiller/workspace/personal/webpieces-ts30/packages/tooling/eslint-plugin/templates/webpieces.exceptions.md
4
-
5
- Please ensure @webpieces/dev-config is properly installed.
package/tsconfig.json DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "forceConsistentCasingInFileNames": true,
6
- "strict": true,
7
- "noImplicitOverride": true,
8
- "noPropertyAccessFromIndexSignature": true,
9
- "noImplicitReturns": true,
10
- "noFallthroughCasesInSwitch": true
11
- },
12
- "files": [],
13
- "include": [],
14
- "references": [
15
- {
16
- "path": "./tsconfig.lib.json"
17
- },
18
- {
19
- "path": "./tsconfig.spec.json"
20
- }
21
- ]
22
- }
package/tsconfig.lib.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../../dist/out-tsc",
5
- "declaration": true,
6
- "types": ["node"]
7
- },
8
- "include": ["src/**/*.ts"],
9
- "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/__tests__/**/*.ts"]
10
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../../dist/out-tsc",
5
- "module": "commonjs",
6
- "types": ["jest", "node"]
7
- },
8
- "include": [
9
- "jest.config.ts",
10
- "src/**/*.test.ts",
11
- "src/**/*.spec.ts",
12
- "src/__tests__/**/*.ts"
13
- ]
14
- }