@ddd-ts-kit/eslint-plugin 0.15.0 → 0.16.1

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 (209) hide show
  1. package/README.fr.md +464 -0
  2. package/README.md +149 -9
  3. package/dist/project/config.d.ts +2 -0
  4. package/dist/project/config.d.ts.map +1 -1
  5. package/dist/project/parse-config.d.ts.map +1 -1
  6. package/dist/project/parse-config.js +2 -0
  7. package/dist/project/parse-config.js.map +1 -1
  8. package/dist/rules/domain-value-object-class.d.ts +4 -0
  9. package/dist/rules/domain-value-object-class.d.ts.map +1 -0
  10. package/dist/rules/domain-value-object-class.js +85 -0
  11. package/dist/rules/domain-value-object-class.js.map +1 -0
  12. package/dist/rules/rules.d.ts.map +1 -1
  13. package/dist/rules/rules.js +2 -0
  14. package/dist/rules/rules.js.map +1 -1
  15. package/dist/support/values/answered-objects.d.ts +8 -0
  16. package/dist/support/values/answered-objects.d.ts.map +1 -0
  17. package/dist/support/values/answered-objects.js +34 -0
  18. package/dist/support/values/answered-objects.js.map +1 -0
  19. package/dist/support/values/entry-role.d.ts +11 -0
  20. package/dist/support/values/entry-role.d.ts.map +1 -0
  21. package/dist/support/values/entry-role.js +45 -0
  22. package/dist/support/values/entry-role.js.map +1 -0
  23. package/dist/support/values/exported-bindings.d.ts +21 -0
  24. package/dist/support/values/exported-bindings.d.ts.map +1 -0
  25. package/dist/support/values/exported-bindings.js +76 -0
  26. package/dist/support/values/exported-bindings.js.map +1 -0
  27. package/dist/support/values/extends-value-object.d.ts +10 -0
  28. package/dist/support/values/extends-value-object.d.ts.map +1 -0
  29. package/dist/support/values/extends-value-object.js +36 -0
  30. package/dist/support/values/extends-value-object.js.map +1 -0
  31. package/dist/support/values/is-model-path.d.ts +8 -0
  32. package/dist/support/values/is-model-path.d.ts.map +1 -0
  33. package/dist/support/values/is-model-path.js +16 -0
  34. package/dist/support/values/is-model-path.js.map +1 -0
  35. package/dist/support/values/is-value-object-path.d.ts +7 -0
  36. package/dist/support/values/is-value-object-path.d.ts.map +1 -0
  37. package/dist/support/values/is-value-object-path.js +15 -0
  38. package/dist/support/values/is-value-object-path.js.map +1 -0
  39. package/dist/support/values/javascript-globals.d.ts +3 -0
  40. package/dist/support/values/javascript-globals.d.ts.map +1 -0
  41. package/dist/support/values/javascript-globals.js +22 -0
  42. package/dist/support/values/javascript-globals.js.map +1 -0
  43. package/dist/support/values/local-binding.d.ts +5 -0
  44. package/dist/support/values/local-binding.d.ts.map +1 -0
  45. package/dist/support/values/local-binding.js +23 -0
  46. package/dist/support/values/local-binding.js.map +1 -0
  47. package/dist/support/values/returns-package-type.d.ts +9 -0
  48. package/dist/support/values/returns-package-type.d.ts.map +1 -0
  49. package/dist/support/values/returns-package-type.js +28 -0
  50. package/dist/support/values/returns-package-type.js.map +1 -0
  51. package/dist/support/values/root-name.d.ts +4 -0
  52. package/dist/support/values/root-name.d.ts.map +1 -0
  53. package/dist/support/values/root-name.js +23 -0
  54. package/dist/support/values/root-name.js.map +1 -0
  55. package/dist/support/values/stands-for-a-value.d.ts +10 -0
  56. package/dist/support/values/stands-for-a-value.d.ts.map +1 -0
  57. package/dist/support/values/stands-for-a-value.js +31 -0
  58. package/dist/support/values/stands-for-a-value.js.map +1 -0
  59. package/dist/support/values/unwrapped.d.ts +4 -0
  60. package/dist/support/values/unwrapped.d.ts.map +1 -0
  61. package/dist/support/values/unwrapped.js +11 -0
  62. package/dist/support/values/unwrapped.js.map +1 -0
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/docs/rules/application-command-query-separation.fr.md +57 -0
  66. package/docs/rules/application-command-query-separation.md +2 -0
  67. package/docs/rules/application-handler-shape.fr.md +55 -0
  68. package/docs/rules/application-handler-shape.md +2 -0
  69. package/docs/rules/aspects-outside-in.fr.md +57 -0
  70. package/docs/rules/aspects-outside-in.md +2 -0
  71. package/docs/rules/authz-actor-explicit.fr.md +73 -0
  72. package/docs/rules/authz-actor-explicit.md +2 -0
  73. package/docs/rules/authz-declared.fr.md +90 -0
  74. package/docs/rules/authz-declared.md +2 -0
  75. package/docs/rules/authz-fields-by-schema.fr.md +54 -0
  76. package/docs/rules/authz-fields-by-schema.md +2 -0
  77. package/docs/rules/authz-in-application.fr.md +91 -0
  78. package/docs/rules/authz-in-application.md +2 -0
  79. package/docs/rules/clean-blank-lines.fr.md +90 -0
  80. package/docs/rules/clean-blank-lines.md +2 -0
  81. package/docs/rules/clean-braces.fr.md +64 -0
  82. package/docs/rules/clean-braces.md +2 -0
  83. package/docs/rules/clean-file-size.fr.md +46 -0
  84. package/docs/rules/clean-file-size.md +2 -0
  85. package/docs/rules/clean-formatted.fr.md +35 -0
  86. package/docs/rules/clean-formatted.md +2 -0
  87. package/docs/rules/clean-function-ceiling.fr.md +56 -0
  88. package/docs/rules/clean-function-ceiling.md +2 -0
  89. package/docs/rules/clean-function-size.fr.md +48 -0
  90. package/docs/rules/clean-function-size.md +2 -0
  91. package/docs/rules/clean-no-commented-out-code.fr.md +51 -0
  92. package/docs/rules/clean-no-commented-out-code.md +2 -0
  93. package/docs/rules/clean-no-escape-hatch.fr.md +83 -0
  94. package/docs/rules/clean-no-escape-hatch.md +2 -0
  95. package/docs/rules/clean-no-flag-argument.fr.md +53 -0
  96. package/docs/rules/clean-no-flag-argument.md +2 -0
  97. package/docs/rules/clean-no-hash-private.fr.md +66 -0
  98. package/docs/rules/clean-no-hash-private.md +2 -0
  99. package/docs/rules/clean-no-magic-number.fr.md +62 -0
  100. package/docs/rules/clean-no-magic-number.md +2 -0
  101. package/docs/rules/clean-no-noise-comment.fr.md +58 -0
  102. package/docs/rules/clean-no-noise-comment.md +2 -0
  103. package/docs/rules/clean-one-export-per-file.fr.md +91 -0
  104. package/docs/rules/clean-one-export-per-file.md +2 -0
  105. package/docs/rules/clean-stepdown.fr.md +63 -0
  106. package/docs/rules/clean-stepdown.md +2 -0
  107. package/docs/rules/context-declared-relationship.fr.md +52 -0
  108. package/docs/rules/context-declared-relationship.md +2 -0
  109. package/docs/rules/context-extractable.fr.md +112 -0
  110. package/docs/rules/context-extractable.md +2 -0
  111. package/docs/rules/context-published-language-is-a-contract.fr.md +50 -0
  112. package/docs/rules/context-published-language-is-a-contract.md +2 -0
  113. package/docs/rules/context-published-language-only.fr.md +50 -0
  114. package/docs/rules/context-published-language-only.md +2 -0
  115. package/docs/rules/declarations-constructor-injection.fr.md +92 -0
  116. package/docs/rules/declarations-constructor-injection.md +2 -0
  117. package/docs/rules/declarations-role-declared.fr.md +118 -0
  118. package/docs/rules/declarations-role-declared.md +2 -0
  119. package/docs/rules/domain-aggregate-encapsulation.fr.md +66 -0
  120. package/docs/rules/domain-aggregate-encapsulation.md +2 -0
  121. package/docs/rules/domain-events-dispatched-on-save.fr.md +86 -0
  122. package/docs/rules/domain-events-dispatched-on-save.md +2 -0
  123. package/docs/rules/domain-events-transactional-before-commit.fr.md +95 -0
  124. package/docs/rules/domain-events-transactional-before-commit.md +2 -0
  125. package/docs/rules/domain-no-generic-error.fr.md +43 -0
  126. package/docs/rules/domain-no-generic-error.md +2 -0
  127. package/docs/rules/domain-value-object-class.fr.md +177 -0
  128. package/docs/rules/domain-value-object-class.md +167 -0
  129. package/docs/rules/domain-value-object-immutability.fr.md +55 -0
  130. package/docs/rules/domain-value-object-immutability.md +2 -0
  131. package/docs/rules/errors-constructor-not-public.fr.md +56 -0
  132. package/docs/rules/errors-constructor-not-public.md +2 -0
  133. package/docs/rules/errors-factory-name.fr.md +53 -0
  134. package/docs/rules/errors-factory-name.md +2 -0
  135. package/docs/rules/errors-through-factory.fr.md +48 -0
  136. package/docs/rules/errors-through-factory.md +2 -0
  137. package/docs/rules/event-sourcing-past-tense.fr.md +43 -0
  138. package/docs/rules/event-sourcing-past-tense.md +2 -0
  139. package/docs/rules/event-sourcing-projection-never-appends.fr.md +52 -0
  140. package/docs/rules/event-sourcing-projection-never-appends.md +2 -0
  141. package/docs/rules/event-sourcing-state-in-apply.fr.md +54 -0
  142. package/docs/rules/event-sourcing-state-in-apply.md +2 -0
  143. package/docs/rules/event-sourcing-store-behind-repository.fr.md +42 -0
  144. package/docs/rules/event-sourcing-store-behind-repository.md +2 -0
  145. package/docs/rules/event-sourcing-upcaster-required.fr.md +58 -0
  146. package/docs/rules/event-sourcing-upcaster-required.md +2 -0
  147. package/docs/rules/events-consumer-idempotent.fr.md +71 -0
  148. package/docs/rules/events-consumer-idempotent.md +2 -0
  149. package/docs/rules/events-name-format.fr.md +57 -0
  150. package/docs/rules/events-name-format.md +2 -0
  151. package/docs/rules/events-outbox-required.fr.md +60 -0
  152. package/docs/rules/events-outbox-required.md +2 -0
  153. package/docs/rules/governance-recorded-deviation.fr.md +58 -0
  154. package/docs/rules/governance-recorded-deviation.md +2 -0
  155. package/docs/rules/imports-alias-only.fr.md +77 -0
  156. package/docs/rules/imports-alias-only.md +2 -0
  157. package/docs/rules/imports-extension.fr.md +86 -0
  158. package/docs/rules/imports-extension.md +2 -0
  159. package/docs/rules/language-declared-vocabulary.fr.md +67 -0
  160. package/docs/rules/language-declared-vocabulary.md +2 -0
  161. package/docs/rules/layer-application-inward.fr.md +65 -0
  162. package/docs/rules/layer-application-inward.md +4 -2
  163. package/docs/rules/layer-domain-purity.fr.md +63 -0
  164. package/docs/rules/layer-domain-purity.md +4 -2
  165. package/docs/rules/layer-infrastructure-no-presentation.fr.md +49 -0
  166. package/docs/rules/layer-infrastructure-no-presentation.md +2 -0
  167. package/docs/rules/layer-presentation-no-infrastructure.fr.md +49 -0
  168. package/docs/rules/layer-presentation-no-infrastructure.md +2 -0
  169. package/docs/rules/lifecycle-status-through-machine.fr.md +72 -0
  170. package/docs/rules/lifecycle-status-through-machine.md +2 -0
  171. package/docs/rules/ports-abstract-class.fr.md +73 -0
  172. package/docs/rules/ports-abstract-class.md +2 -0
  173. package/docs/rules/ports-implements-never-extends.fr.md +56 -0
  174. package/docs/rules/ports-implements-never-extends.md +2 -0
  175. package/docs/rules/ports-no-concrete-dependency.fr.md +56 -0
  176. package/docs/rules/ports-no-concrete-dependency.md +2 -0
  177. package/docs/rules/ports-no-token-constant.fr.md +60 -0
  178. package/docs/rules/ports-no-token-constant.md +2 -0
  179. package/docs/rules/ports-value-import.fr.md +58 -0
  180. package/docs/rules/ports-value-import.md +2 -0
  181. package/docs/rules/presentation-controller-delegates.fr.md +60 -0
  182. package/docs/rules/presentation-controller-delegates.md +2 -0
  183. package/docs/rules/presentation-controller-shape.fr.md +53 -0
  184. package/docs/rules/presentation-controller-shape.md +2 -0
  185. package/docs/rules/presentation-guard-at-the-edge.fr.md +58 -0
  186. package/docs/rules/presentation-guard-at-the-edge.md +2 -0
  187. package/docs/rules/presentation-shared-cache-varies.fr.md +57 -0
  188. package/docs/rules/presentation-shared-cache-varies.md +2 -0
  189. package/docs/rules/process-sends-commands-only.fr.md +67 -0
  190. package/docs/rules/process-sends-commands-only.md +2 -0
  191. package/docs/rules/purity-no-ambient-randomness.fr.md +46 -0
  192. package/docs/rules/purity-no-ambient-randomness.md +2 -0
  193. package/docs/rules/purity-no-environment.fr.md +48 -0
  194. package/docs/rules/purity-no-environment.md +2 -0
  195. package/docs/rules/purity-no-system-clock.fr.md +52 -0
  196. package/docs/rules/purity-no-system-clock.md +2 -0
  197. package/docs/rules/scheduling-job-name.fr.md +60 -0
  198. package/docs/rules/scheduling-job-name.md +2 -0
  199. package/docs/rules/scheduling-job-triggers-use-case.fr.md +74 -0
  200. package/docs/rules/scheduling-job-triggers-use-case.md +2 -0
  201. package/docs/rules/schema-presentation-only.fr.md +48 -0
  202. package/docs/rules/schema-presentation-only.md +2 -0
  203. package/docs/rules/standard-no-parallel-interface.fr.md +100 -0
  204. package/docs/rules/standard-no-parallel-interface.md +2 -0
  205. package/docs/rules/test-no-mocks.fr.md +50 -0
  206. package/docs/rules/test-no-mocks.md +2 -0
  207. package/docs/rules/tracing-platform-only.fr.md +68 -0
  208. package/docs/rules/tracing-platform-only.md +2 -0
  209. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ **English** · [Français](README.fr.md)
2
+
1
3
  # @ddd-ts-kit/eslint-plugin
2
4
 
3
5
  AST-accurate ESLint rules for the architecture of [docs/ARCHITECTURE.md](../../docs/ARCHITECTURE.md):
@@ -10,6 +12,8 @@ Every rule reads `ddd-ts-kit.config.json` ([docs/CONFIG.md](../../docs/CONFIG.md
10
12
  walking up from the linted file, and classifies the file into context and layer exactly like
11
13
  `ddd-ts-kit check` does. It also reads `stack.style` there: see [The two styles](#the-two-styles).
12
14
 
15
+ ![ESLint hands the plugin a file; the plugin walks up to ddd-ts-kit.config.json, classifies the file as ddd-ts-kit check does (context billing, layer application, not a test file), runs each rule on its syntax tree at the severity the config gives its id, and reports the line, the problem, what to write instead and the rule](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/eslint-plugin-how-a-file-is-judged.svg)
16
+
13
17
  ## Install
14
18
 
15
19
  ```
@@ -31,14 +35,15 @@ export default dddTsKit({ tsconfigRootDir: import.meta.dirname });
31
35
 
32
36
  | Layer of the config | Content |
33
37
  |---|---|
38
+ | `ddd-ts-kit/ignores` | what is never linted: see `ignores` below |
34
39
  | `@eslint/js` recommended | the baseline of ESLint |
35
- | typescript-eslint `strictTypeChecked` and `stylisticTypeChecked` | with `projectService`; `strict` and `stylistic` when `typeChecked` is `false` |
40
+ | typescript-eslint `strictTypeChecked` and `stylisticTypeChecked` | with `projectService` (`ddd-ts-kit/type-information`), and without type checking on JavaScript files (`ddd-ts-kit/javascript`); `strict` and `stylistic` when `typeChecked` is `false` |
36
41
  | `ddd-ts-kit/clean-code` | the standard rules backing section 6 of the architecture reference (below) |
37
42
  | `ddd-ts-kit/architecture` | every rule of this plugin, at the severity of `rules.<id>` in `ddd-ts-kit.config.json`, else at its default, the two layout rules of `@stylistic/eslint-plugin` at the severity of `rules."clean/blank-lines"` and `curly` at the severity of `rules."clean/braces"` (default `error`) |
38
43
  | `ddd-ts-kit/scripts` | `curly` on `.js`, `.mjs` and `.cjs` files, at the severity of `rules."clean/braces"`: a branch reads the same in a script |
39
44
  | `ddd-ts-kit/inner-layers` | `no-param-reassign` with `props` in `domain/` and `application/`: no output argument |
40
45
  | `ddd-ts-kit/aggregates` | `prefer-readonly` off in aggregates and entities, whose state is replaced by intention methods |
41
- | `ddd-ts-kit/tests` | a lighter set for specs, fakes and builders |
46
+ | `ddd-ts-kit/tests` | a lighter set on `*.spec.ts`, `*.test.ts`, the `test/` directory of each context and the root `test/`: `any` and `!` warn, the `no-unsafe-*` rules off, type assertions allowed |
42
47
 
43
48
  | Option | Default | Meaning |
44
49
  |---|---|---|
@@ -47,9 +52,22 @@ export default dddTsKit({ tsconfigRootDir: import.meta.dirname });
47
52
  | `allowDefaultProject` | `['*.config.ts', '*.config.mts']` | files outside the tsconfig still linted with types |
48
53
  | `ignores` | none | added to `dist`, `coverage`, `node_modules`, `reports`, `*.d.ts`, and `clients/*/src` when `ddd-ts-kit.config.json` has `"sdk"` (the clients the CLI generates) |
49
54
 
55
+ Blocks are applied in this order, and a later block wins for the files it matches. A block of
56
+ your own goes after the helper:
57
+
58
+ ```js
59
+ import { dddTsKit } from '@ddd-ts-kit/eslint-plugin';
60
+
61
+ export default [
62
+ ...dddTsKit({ tsconfigRootDir: import.meta.dirname, ignores: ['src/generated/**'] }),
63
+ // a rule the kit does not enable: purity/no-environment refuses console in domain/ and application/ only
64
+ { files: ['src/**/*.ts'], rules: { 'no-console': 'error' } },
65
+ ];
66
+ ```
67
+
50
68
  To compose a config by hand, the plugin is the default export, with two presets that hold only
51
- its own rules, the three typescript-eslint rules they delegate to and the four layout rules of
52
- `@stylistic/eslint-plugin`, without type information:
69
+ its own rules, the three typescript-eslint rules they delegate to, the two layout rules of
70
+ `@stylistic/eslint-plugin` and `curly`, without type information:
53
71
 
54
72
  ```js
55
73
  import dddTsKit from '@ddd-ts-kit/eslint-plugin';
@@ -70,6 +88,104 @@ import dddTsKit, { standardRules } from '@ddd-ts-kit/eslint-plugin';
70
88
  export default [{ files: ['**/*.ts'], plugins: { 'ddd-ts-kit': dddTsKit, '@stylistic': stylistic }, rules: standardRules.layout }];
71
89
  ```
72
90
 
91
+ ### Changing a severity
92
+
93
+ The severity of a rule of the kit is written once, in `ddd-ts-kit.config.json`, where both
94
+ tools read it:
95
+
96
+ ```json
97
+ {
98
+ "rules": {
99
+ "clean/function-size": "error",
100
+ "test/no-mocks": "off"
101
+ }
102
+ }
103
+ ```
104
+
105
+ ```js
106
+ // instead of: a severity in eslint.config.mjs, which `ddd-ts-kit check` never sees
107
+ export default [...dddTsKit(), { rules: { 'ddd-ts-kit/test-no-mocks': 'off' } }];
108
+ ```
109
+
110
+ `"off"` in the config silences the rule even where an ESLint config enables it. Raising a
111
+ severity is free; lowering one under its default (`off`, or `warn` for an `error` rule) is a
112
+ deviation, and `ddd-ts-kit check` asks for its decision record: see
113
+ [Deviations](../../docs/CONFIG.md#deviations).
114
+
115
+ ## A report, and what to write instead
116
+
117
+ Every message says what is wrong, what to write instead, and the rule. A handler that reads the
118
+ system clock, in `src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts`:
119
+
120
+ ```ts
121
+ // instead of
122
+ import type { IdGenerator } from '@ddd-ts-kit/kernel';
123
+ import { Invoice } from '@/contexts/billing/domain/aggregates/invoice.aggregate.js';
124
+ import type { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';
125
+ import type { IssueInvoice } from '@/contexts/billing/application/commands/issue-invoice/issue-invoice.command.js';
126
+
127
+ export class IssueInvoiceHandler {
128
+ constructor(
129
+ private readonly invoices: InvoiceRepository,
130
+ private readonly ids: IdGenerator,
131
+ ) {}
132
+
133
+ async execute(command: IssueInvoice): Promise<string> {
134
+ const id = this.ids.next();
135
+
136
+ await this.invoices.save(Invoice.issue(id, command.customerId, new Date()));
137
+
138
+ return id;
139
+ }
140
+ }
141
+ ```
142
+
143
+ is reported, by `npx eslint src`:
144
+
145
+ ```
146
+ src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
147
+ 16:68 error new Date() without argument is used in the application layer. Receive the instant as a parameter in the domain, and take it from the Clock port (`this.clock.now()`) in a handler, so that a test fixes time with FixedClock ddd-ts-kit/purity-no-system-clock
148
+ ```
149
+
150
+ The fix the message names: the `Clock` port, which a spec fixes with `FixedClock`.
151
+
152
+ <!-- checked sample -->
153
+ ```ts
154
+ import { AuthorizedCommand, Clock, IdGenerator, type Actor } from '@ddd-ts-kit/kernel';
155
+
156
+ // the command, the aggregate and its repository port, in their own files
157
+ declare class IssueInvoice extends AuthorizedCommand<string> {
158
+ readonly customerId: string;
159
+ constructor(actor: Actor, customerId: string);
160
+ }
161
+ declare class Invoice {
162
+ static issue(id: string, customerId: string, issuedAt: Date): Invoice;
163
+ }
164
+ declare abstract class InvoiceRepository {
165
+ abstract save(invoice: Invoice): Promise<void>;
166
+ }
167
+
168
+ // write: the instant comes from a port
169
+ export class IssueInvoiceHandler {
170
+ constructor(
171
+ private readonly invoices: InvoiceRepository,
172
+ private readonly clock: Clock,
173
+ private readonly ids: IdGenerator,
174
+ ) {}
175
+
176
+ async execute(command: IssueInvoice): Promise<string> {
177
+ const id = this.ids.next();
178
+
179
+ await this.invoices.save(Invoice.issue(id, command.customerId, this.clock.now()));
180
+
181
+ return id;
182
+ }
183
+ }
184
+ ```
185
+
186
+ When the code is right and the rule is not, the deviation is recorded, not hidden: see the
187
+ suppression comment in [Settings](#settings).
188
+
73
189
  ## Rules
74
190
 
75
191
  Ids are those of [docs/ARCHITECTURE.md](../../docs/ARCHITECTURE.md); the ESLint name replaces the
@@ -105,6 +221,7 @@ is an error whatever the configured limit). `strict` sets every rule to `error`.
105
221
  | [`clean/formatted`](docs/rules/clean-formatted.md) | none: Biome (`npm run format:check`) | every file is laid out by the formatter, at a line width of 120 | none | formatter |
106
222
  | [`domain/aggregate-encapsulation`](docs/rules/domain-aggregate-encapsulation.md) | `ddd-ts-kit/domain-aggregate-encapsulation` | aggregates and entities: no public constructor, no public mutable property, no setter | `error` | custom |
107
223
  | [`domain/value-object-immutability`](docs/rules/domain-value-object-immutability.md) | `ddd-ts-kit/domain-value-object-immutability` | value objects: every property `readonly`, no setter, no write to `this` | `error` | custom |
224
+ | [`domain/value-object-class`](docs/rules/domain-value-object-class.md) | `ddd-ts-kit/domain-value-object-class` | under `"stack.values": "classes"`: a value object file exports one class extending `ValueObject`, private or protected constructor, static factories, no function nor object literal; no exported function of `domain/` or of the shared kernel answers a record of data | `error` | custom |
108
225
  | [`domain/no-generic-error`](docs/rules/domain-no-generic-error.md) | `ddd-ts-kit/domain-no-generic-error` | no `throw new Error(...)` in `domain/` and `application/` | `error` | custom |
109
226
  | [`errors/through-factory`](docs/rules/errors-through-factory.md) | `ddd-ts-kit/errors-through-factory` | under `"stack.refusals": "factories"`, no `new` of a class imported from `domain/errors/`: a refusal is built by a static factory of its concept class | `error` | custom |
110
227
  | [`errors/constructor-not-public`](docs/rules/errors-constructor-not-public.md) | `ddd-ts-kit/errors-constructor-not-public` | under `"stack.refusals": "factories"`, an error class of `domain/errors/` has no public constructor, declared or inherited from `DomainError` | `error` | custom |
@@ -226,7 +343,7 @@ is not reported for following the conventions of the kit:
226
343
  | `no-unnecessary-type-arguments` | off | the id type of an aggregate is part of its declaration |
227
344
  | `consistent-type-definitions` | off | props are type aliases, states and options are interfaces |
228
345
  | `no-empty-object-type` | interfaces allowed | `interface SessionExtensions {}` is left open for declaration merging |
229
- | `no-extraneous-class` | empty classes allowed | a domain service or a fake starts empty |
346
+ | `no-extraneous-class` | empty classes and decorated classes allowed | a domain service or a fake starts empty; a class that carries a decorator is a declaration, whatever its body |
230
347
  | `no-unused-vars` | `args: 'none'` | an adapter implements the whole signature of its port |
231
348
  | `dot-notation` | index signatures allowed | `process.env['PORT']` |
232
349
  | `no-confusing-void-expression`, `restrict-template-expressions`, `restrict-plus-operands` | arrow shorthand, numbers and booleans allowed | not coercion bugs |
@@ -260,16 +377,39 @@ editor after changing `ddd-ts-kit.config.json`.
260
377
  Two things work as with the CLI checker: `rules.<id>: "off"` in the config silences the rule
261
378
  even when the ESLint config enables it, and `// ddd-ts-kit-disable-next-line <id> -- <reason>`
262
379
  silences one line for both tools. A suppression without a reason silences nothing, and
263
- `governance/recorded-deviation` asks that the reason point to a decision record (`ADR-<number>`).
380
+ `governance/recorded-deviation` asks that the reason point to a decision record (`ADR-<number>`):
381
+
382
+ ```ts
383
+ // instead of: a reason that points to no decision
384
+ // ddd-ts-kit-disable-next-line clean/no-flag-argument -- kept for now
385
+ cancel(force: boolean): void {
386
+ ```
387
+
388
+ ```
389
+ 12:3 error `ddd-ts-kit-disable-next-line clean/no-flag-argument` on line 12 silences a rule without pointing to a decision. Fix the diagnostic; if the deviation is deliberate, record it with `ddd-ts-kit generate adr` (reason, scope, condition for removing it) and end the comment with `-- ADR-<number>: <reason>` ddd-ts-kit/governance-recorded-deviation
390
+ ```
391
+
392
+ ```ts
393
+ // write: the decision record says why, for what scope and until when
394
+ // ddd-ts-kit-disable-next-line clean/no-flag-argument -- ADR-0007: the legacy import sends a flag until 2027
395
+ cancel(force: boolean): void {
396
+ ```
397
+
398
+ The id is the one of the architecture reference (`clean/no-flag-argument`), not the ESLint name,
399
+ and `npx ddd-ts-kit generate adr` writes the record. `eslint-disable` comments are held the same
400
+ way, by `clean/no-escape-hatch` and `governance/recorded-deviation`.
264
401
 
265
402
  ## With `ddd-ts-kit check`
266
403
 
267
- Two tools, one set of ids, no overlap of authority.
404
+ Two tools, one set of ids, no overlap of authority. A third, dependency-cruiser, does not read the
405
+ config: it runs on a file generated from it, with its own rule names.
406
+
407
+ ![The plugin and ddd-ts-kit check read ddd-ts-kit.config.json at run time and share its rule ids, severities and suppression comments: the plugin judges one source file at a time on its syntax tree and is right when it disagrees with the checker; the checker judges what spans files, the tree, names, glossaries, config and barrel; dependency-cruiser runs only on the .dependency-cruiser.cjs that depcruise-config --write generates from the config and judges the resolved import graph with its own rule names, always at severity error, ignoring suppression comments](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/eslint-plugin-two-tools.svg)
268
408
 
269
409
  | Concern | Authority | Why |
270
410
  |---|---|---|
271
- | imports and boundaries (`layer/*`, `context/published-language-only`, `context/declared-relationship`, `context/published-language-is-a-contract`), `purity/*`, `clean/*`, `test/no-mocks`, `events/name-format`, `domain/*`, `application/*`, the code side of `events/outbox-required`, `events/consumer-idempotent`, `context/extractable`, `authz/*`, `aspects/outside-in`, `tracing/platform-only`, `domain-events/dispatched-on-save`, `domain-events/transactional-before-commit` on a declared class, `event-sourcing/*` (but the lock of `event-sourcing/upcaster-required`), `standard/no-parallel-interface`, `declarations/role-declared`, `ports/*`, `scheduling/*` (but the uniqueness of job names) and `governance/recorded-deviation` | this plugin | it reads the syntax tree: no false positive from a string or a comment, shadowing and arrow functions are understood |
272
- | the tree (`tree/closed`, `tree/context-doc`), names and files (`naming/*`, `test/spec-required`, `test/builder-required`), the language (`language/*`), the config (`config/*`, `context/no-cycle`), `events/defined-in-published-language`, `composition/only-in-module`, `declarations/barrel-current`, unique consumer names and job names, one declared class per role file, of `domain-events/transactional-before-commit` the adapters of an `application/ports/` port and the phase of an explicit-style handler, the config side of the ids above (`stack.events`, lowered severities, that a decision record exists) | `ddd-ts-kit check` | they judge the project, the glossary and files that are not sources; ESLint judges one source at a time |
411
+ | imports and boundaries (`layer/*`, `context/published-language-only`, `context/declared-relationship`, `context/published-language-is-a-contract`), `purity/*`, `clean/*`, `test/no-mocks`, `events/name-format`, `domain/*`, `application/*`, the code side of `events/outbox-required`, `events/consumer-idempotent`, `context/extractable`, `authz/*`, `aspects/outside-in`, `tracing/platform-only`, `domain-events/dispatched-on-save`, `domain-events/transactional-before-commit` on a declared class, `event-sourcing/*` (but the lock of `event-sourcing/upcaster-required`), `standard/no-parallel-interface`, `declarations/role-declared`, `ports/*`, `scheduling/*` (but the uniqueness of job names), `language/declared-vocabulary`, `errors/through-factory`, `errors/constructor-not-public`, `errors/factory-name`, `presentation/*`, `lifecycle/*`, `process/*`, `schema/presentation-only`, `imports/alias-only`, `imports/extension` and `governance/recorded-deviation` | this plugin | it reads the syntax tree: no false positive from a string or a comment, shadowing and arrow functions are understood |
412
+ | the tree (`tree/closed`, `tree/context-doc`), names and files (`naming/*`, `test/spec-required`, `test/builder-required`), the language (`language/glossary-term`, `language/no-technical-name`), error codes (`errors/code-unique`, `errors/known-code`), `imports/alias-declared`, `schema/no-duplicate-shape`, the config (`config/*`, `context/no-cycle`), `events/defined-in-published-language`, `composition/only-in-module`, `declarations/barrel-current`, unique consumer names and job names, one declared class per role file, of `domain-events/transactional-before-commit` the adapters of an `application/ports/` port and the phase of an explicit-style handler, the config side of the ids above (`stack.events`, lowered severities, that a decision record exists) | `ddd-ts-kit check` | they judge the project, the glossary and files that are not sources; ESLint judges one source at a time |
273
413
  | the real dependency graph (barrels, cycles, orphans, dev dependencies in production code) | dependency-cruiser, configured by the `.dependency-cruiser.cjs` that `ddd-ts-kit depcruise-config --write` generates from the config | it resolves modules instead of classifying paths |
274
414
 
275
415
  The CLI keeps approximating the code-level rules with regular expressions, without dependency:
@@ -24,6 +24,8 @@ export interface Stack {
24
24
  readonly schemas: 'shared' | 'per-route';
25
25
  /** `named`: a value of a declared vocabulary and a number of the model are read through a name. A config that does not say is `free`, and both rules are silent. */
26
26
  readonly literals: 'named' | 'free';
27
+ /** `classes`: a value of the model is a value object class, never a function that builds a plain object. A config that does not say is `free`, and `domain/value-object-class` is silent. */
28
+ readonly values: 'classes' | 'free';
27
29
  /** Kept as written: with `prisma` the generated client under `generated/` has an import alias of its own. */
28
30
  readonly orm: string;
29
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/project/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAEhD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CA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/project/parse-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAQV,MAAM,EAEP,MAAM,aAAa,CAAC;AAOrB,+GAA+G;AAC/G,eAAO,MAAM,sBAAsB,MAAM,CAAC;AA0B1C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA0BhD"}
1
+ {"version":3,"file":"parse-config.d.ts","sourceRoot":"","sources":["../../src/project/parse-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAQV,MAAM,EAEP,MAAM,aAAa,CAAC;AAOrB,+GAA+G;AAC/G,eAAO,MAAM,sBAAsB,MAAM,CAAC;AA2B1C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA0BhD"}
@@ -10,6 +10,7 @@ const DEPENDENCY_STATEMENTS = ['signature', 'listed'];
10
10
  const REFUSAL_FORMS = ['factories', 'classes'];
11
11
  const SCHEMA_FORMS = ['shared', 'per-route'];
12
12
  const LITERAL_FORMS = ['named', 'free'];
13
+ const VALUE_FORMS = ['classes', 'free'];
13
14
  const KERNEL = ['@ddd-ts-kit/kernel'];
14
15
  /** The package name of a client when "sdk" does not give one, as the CLI writes it. */
15
16
  const DEFAULT_SDK_NAME = '{project}-{document}-client';
@@ -63,6 +64,7 @@ function parseStack(value) {
63
64
  refusals: oneOf(REFUSAL_FORMS, raw['refusals'], 'classes'),
64
65
  schemas: oneOf(SCHEMA_FORMS, raw['schemas'], 'per-route'),
65
66
  literals: oneOf(LITERAL_FORMS, raw['literals'], 'free'),
67
+ values: oneOf(VALUE_FORMS, raw['values'], 'free'),
66
68
  orm: text(raw['orm'], 'drizzle'),
67
69
  };
68
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parse-config.js","sourceRoot":"","sources":["../../src/project/parse-config.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,KAAK,EA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AAC,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9G,CAAC;AAED,SAAS,UAAU,CAAI,KAAc,EAAE,KAA4B;IACjE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrH,CAAC;AAED,SAAS,OAAO,CAAC,KAAc,EAAE,QAA2B;IAC1D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5F,CAAC;AAED,SAAS,KAAK,CAAmB,MAAoB,EAAE,SAAkB,EAAE,QAAW;IACpF,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,QAAQ,CAAC;AACjE,CAAC;AAED,SAAS,IAAI,CAAC,KAAc,EAAE,QAAgB;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC"}
@@ -0,0 +1,4 @@
1
+ type MessageId = 'noClass' | 'secondClass' | 'notValueObject' | 'publicConstructor' | 'noFactory' | 'exportedFunction' | 'exportedLiteral' | 'plainValue';
2
+ export declare const domainValueObjectClass: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageId, [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
3
+ export {};
4
+ //# sourceMappingURL=domain-value-object-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-value-object-class.d.ts","sourceRoot":"","sources":["../../src/rules/domain-value-object-class.ts"],"names":[],"mappings":"AAeA,KAAK,SAAS,GACV,SAAS,GACT,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,WAAW,GACX,kBAAkB,GAClB,iBAAiB,GACjB,YAAY,CAAC;AAIjB,eAAO,MAAM,sBAAsB,mKAqCjC,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { className } from '../support/classes/class-name.js';
3
+ import { constructorOf } from '../support/classes/constructor-of.js';
4
+ import { exportedClasses } from '../support/classes/exported-classes.js';
5
+ import { visibilityOf } from '../support/classes/visibility-of.js';
6
+ import { defineRule } from '../support/rule/define-rule.js';
7
+ import { answeredObjects } from '../support/values/answered-objects.js';
8
+ import { exportedBindings } from '../support/values/exported-bindings.js';
9
+ import { extendsValueObject } from '../support/values/extends-value-object.js';
10
+ import { isModelPath } from '../support/values/is-model-path.js';
11
+ import { isValueObjectPath } from '../support/values/is-value-object-path.js';
12
+ import { returnsPackageType } from '../support/values/returns-package-type.js';
13
+ import { standsForAValue } from '../support/values/stands-for-a-value.js';
14
+ const GENERATE = '`npx ddd-ts-kit generate value-object <context> <Name>`';
15
+ export const domainValueObjectClass = defineRule({
16
+ id: 'domain/value-object-class',
17
+ type: 'problem',
18
+ recommended: 'error',
19
+ description: 'Under "stack.values": "classes", a value object is a class: a file of domain/value-objects/ (or a *.vo.ts of the shared kernel) exports one class extending ValueObject, with a private or protected constructor and static factories, and no function or object literal; no exported function of domain/ or of the shared kernel answers a record of data (no spread, nothing a call of the model built).',
20
+ messages: {
21
+ noClass: `The value object file exports no class. Write the value as a class, \`export class <Name> extends ValueObject<<Name>Props>\`, with a private constructor and a static factory that checks its rules (${GENERATE} writes one): a function or an object literal gives no equality by value, no single place for the invariants and nothing \`instanceof\` can recognise.`,
22
+ secondClass: 'The value object file exports a second class, {{className}}. Move it to a *.vo.ts of its own: one value object per file, named after it.',
23
+ notValueObject: '{{className}} does not extend ValueObject. Extend ValueObject of @ddd-ts-kit/kernel, or another value object of the project: it gives equality by value (`equals`), frozen props and `toJSON`.',
24
+ publicConstructor: 'The constructor of {{className}} is public. Make it private (protected on a base other value objects extend) and build the value through a static factory, `{{className}}.create(..)`, that checks its rules: a {{className}} that exists is a valid one.',
25
+ noFactory: '{{className}} has no static factory. Add `static create(..): {{className}}`, which checks the rules and returns `new {{className}}(..)`; name the other ones after what they build (`{{className}}.closed()`, `{{className}}.between(..)`).',
26
+ exportedFunction: 'The value object file exports the function {{name}}. Make it a static factory or a method of the value object class: what builds or reads the value lives next to its data.',
27
+ exportedLiteral: 'The value object file exports the object literal {{name}}. Make it a static factory of the class, `static {{name}}()`, which builds a checked instance; a closed list of values is a vocabulary (domain/vocabularies/*.vocabulary.ts).',
28
+ plainValue: `{{name}} builds a plain object: a value of the model written as a function. Write it as a value object class (${GENERATE}): its rules checked once in a static factory, \`equals\` to compare two of them, its operations as methods next to its data. A domain service, a state machine, a specification, a function that answers value objects it builds or derives a record with a spread stays as it is.`,
29
+ },
30
+ create({ file, report }) {
31
+ const { path, location, config } = file;
32
+ if (config.stack.values !== 'classes') {
33
+ return {};
34
+ }
35
+ if (isValueObjectPath(path, location, config.sharedKernelDir)) {
36
+ return { Program: (program) => judgeValueObjectFile(file, program, report) };
37
+ }
38
+ return isModelPath(path, location, config.sharedKernelDir)
39
+ ? { Program: (program) => judgeModelFunctions(file, program, report) }
40
+ : {};
41
+ },
42
+ });
43
+ function judgeValueObjectFile(file, program, report) {
44
+ const [main, ...others] = exportedClasses(program);
45
+ if (main === undefined) {
46
+ report({ loc: { line: 1, column: 0 }, messageId: 'noClass' });
47
+ }
48
+ else {
49
+ judgeClass(main, extendsValueObject(file, program, main), report);
50
+ }
51
+ for (const other of others) {
52
+ report({ node: other.id ?? other, messageId: 'secondClass', data: { className: className(other) } });
53
+ }
54
+ for (const binding of exportedBindings(program)) {
55
+ const messageId = binding.kind === 'function' ? 'exportedFunction' : 'exportedLiteral';
56
+ report({ node: binding.at, messageId, data: { name: binding.name } });
57
+ }
58
+ }
59
+ function judgeClass(node, isValueObject, report) {
60
+ const data = { className: className(node) };
61
+ const constructor = constructorOf(node.body);
62
+ if (!isValueObject) {
63
+ report({ node: node.id ?? node, messageId: 'notValueObject', data });
64
+ }
65
+ if (constructor !== undefined && visibilityOf(constructor) === 'public') {
66
+ report({ node: constructor.key, messageId: 'publicConstructor', data });
67
+ }
68
+ if (!node.abstract && !node.body.body.some(isFactory)) {
69
+ report({ node: node.id ?? node, messageId: 'noFactory', data });
70
+ }
71
+ }
72
+ function isFactory(member) {
73
+ return member.type === AST_NODE_TYPES.MethodDefinition && member.static && visibilityOf(member) !== 'private';
74
+ }
75
+ function judgeModelFunctions(file, program, report) {
76
+ for (const binding of exportedBindings(program)) {
77
+ if (binding.kind !== 'function' || returnsPackageType(file, program, binding.node)) {
78
+ continue;
79
+ }
80
+ if (answeredObjects(binding.node).some((object) => standsForAValue(object, program))) {
81
+ report({ node: binding.at, messageId: 'plainValue', data: { name: binding.name } });
82
+ }
83
+ }
84
+ }
85
+ //# sourceMappingURL=domain-value-object-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-value-object-class.js","sourceRoot":"","sources":["../../src/rules/domain-value-object-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,eAAe,E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,CAAC;QAChD,IAAI,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACnF,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC;YACrF,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/rules/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AA4IlE,+HAA+H;AAC/H,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEnD,CAAC"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/rules/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AA8IlE,+HAA+H;AAC/H,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEnD,CAAC"}
@@ -32,6 +32,7 @@ import { eventSourcingUpcasterRequired } from './event-sourcing-upcaster-require
32
32
  import { errorsConstructorNotPublic } from './errors-constructor-not-public.js';
33
33
  import { errorsFactoryName } from './errors-factory-name.js';
34
34
  import { errorsThroughFactory } from './errors-through-factory.js';
35
+ import { domainValueObjectClass } from './domain-value-object-class.js';
35
36
  import { domainValueObjectImmutability } from './domain-value-object-immutability.js';
36
37
  import { eventsConsumerIdempotent } from './events-consumer-idempotent.js';
37
38
  import { eventsNameFormat } from './events-name-format.js';
@@ -87,6 +88,7 @@ const ALL = [
87
88
  cleanNoMagicNumber,
88
89
  domainAggregateEncapsulation,
89
90
  domainValueObjectImmutability,
91
+ domainValueObjectClass,
90
92
  domainNoGenericError,
91
93
  errorsThroughFactory,
92
94
  errorsConstructorNotPublic,
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/rules/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAA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IAAI,EAAE,IAAI,CAAC,CAAC,CAC7C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ import type { FunctionNode } from '../functions/function-node.js';
3
+ /**
4
+ * The object literals a function answers by itself: the expression of an arrow, or what a
5
+ * `return` of its own body gives back. A `return` of a function nested in it answers for that one.
6
+ */
7
+ export declare function answeredObjects(node: FunctionNode): TSESTree.ObjectExpression[];
8
+ //# sourceMappingURL=answered-objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answered-objects.d.ts","sourceRoot":"","sources":["../../../src/support/values/answered-objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AASlE;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAQ/E"}
@@ -0,0 +1,34 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { descendants } from '../descendants.js';
3
+ import { unwrapped } from './unwrapped.js';
4
+ const FUNCTIONS = new Set([
5
+ AST_NODE_TYPES.ArrowFunctionExpression,
6
+ AST_NODE_TYPES.FunctionDeclaration,
7
+ AST_NODE_TYPES.FunctionExpression,
8
+ ]);
9
+ /**
10
+ * The object literals a function answers by itself: the expression of an arrow, or what a
11
+ * `return` of its own body gives back. A `return` of a function nested in it answers for that one.
12
+ */
13
+ export function answeredObjects(node) {
14
+ const { body } = node;
15
+ if (body.type !== AST_NODE_TYPES.BlockStatement) {
16
+ return objectOf(body);
17
+ }
18
+ return ownReturns(body).flatMap((statement) => (statement.argument === null ? [] : objectOf(statement.argument)));
19
+ }
20
+ function ownReturns(body) {
21
+ return [...descendants(body)].filter((node) => node.type === AST_NODE_TYPES.ReturnStatement && enclosingFunction(node) === body.parent);
22
+ }
23
+ function enclosingFunction(node) {
24
+ let current = node.parent;
25
+ while (current !== undefined && !FUNCTIONS.has(current.type)) {
26
+ current = current.parent;
27
+ }
28
+ return current;
29
+ }
30
+ function objectOf(expression) {
31
+ const inner = unwrapped(expression);
32
+ return inner.type === AST_NODE_TYPES.ObjectExpression ? [inner] : [];
33
+ }
34
+ //# sourceMappingURL=answered-objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answered-objects.js","sourceRoot":"","sources":["../../../src/support/values/answered-objects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAS;IAChC,cAAc,CAAC,uBAAuB;IACtC,cAAc,CAAC,mBAAmB;IAClC,cAAc,CAAC,kBAAkB;CAClC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAkB;IAChD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEtB,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,EAAE,CAAC;QAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACpH,CAAC;AAED,SAAS,UAAU,CAAC,IAA6B;IAC/C,OAAO,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAClC,CAAC,IAAI,EAAoC,EAAE,CACzC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAC1F,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAmB;IAC5C,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC;IAE1B,OAAO,OAAO,KAAK,SAAS,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,QAAQ,CAAC,UAA+B;IAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /**
3
+ * What an entry of an object literal holds: `behaviour`, a function; `built`, what a call or
4
+ * `new` of the model built (`Money.of(1)`, `total.add(tax)`, `new Slot(..)`), a call of the
5
+ * language aside (`Math.round(..)`, `new Date(..)`); `data`, anything else: a literal, a
6
+ * parameter, an operation on them.
7
+ */
8
+ export type EntryRole = 'behaviour' | 'built' | 'data';
9
+ /** The role of an expression; a name is read from its declaration in the module, found by name. */
10
+ export declare function expressionRole(expression: TSESTree.Expression, program: TSESTree.Program, seen?: ReadonlySet<string>): EntryRole;
11
+ //# sourceMappingURL=entry-role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-role.d.ts","sourceRoot":"","sources":["../../../src/support/values/entry-role.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMzE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvD,mGAAmG;AACnG,wBAAgB,cAAc,CAC5B,UAAU,EAAE,QAAQ,CAAC,UAAU,EAC/B,OAAO,EAAE,QAAQ,CAAC,OAAO,EACzB,IAAI,GAAE,WAAW,CAAC,MAAM,CAAa,GACpC,SAAS,CAoBX"}
@@ -0,0 +1,45 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { descendants } from '../descendants.js';
3
+ import { JAVASCRIPT_GLOBALS } from './javascript-globals.js';
4
+ import { rootName } from './root-name.js';
5
+ import { unwrapped } from './unwrapped.js';
6
+ /** The role of an expression; a name is read from its declaration in the module, found by name. */
7
+ export function expressionRole(expression, program, seen = new Set()) {
8
+ const inner = unwrapped(expression);
9
+ switch (inner.type) {
10
+ case AST_NODE_TYPES.ArrowFunctionExpression:
11
+ case AST_NODE_TYPES.FunctionExpression: {
12
+ return 'behaviour';
13
+ }
14
+ case AST_NODE_TYPES.CallExpression:
15
+ case AST_NODE_TYPES.NewExpression:
16
+ case AST_NODE_TYPES.ChainExpression: {
17
+ return calledRole(rootName(inner));
18
+ }
19
+ case AST_NODE_TYPES.Identifier: {
20
+ return seen.has(inner.name) ? 'data' : boundRole(program, inner.name, new Set([...seen, inner.name]));
21
+ }
22
+ default: {
23
+ return 'data';
24
+ }
25
+ }
26
+ }
27
+ /** A call or `new` of the language builds data; any other one, a value of the model. */
28
+ function calledRole(root) {
29
+ return JAVASCRIPT_GLOBALS.has(root ?? '') ? 'data' : 'built';
30
+ }
31
+ /** The role of what the first declaration of `name` in the module binds: a parameter, declared nowhere, is data. */
32
+ function boundRole(program, name, seen) {
33
+ for (const node of descendants(program)) {
34
+ if (node.type === AST_NODE_TYPES.FunctionDeclaration && node.id?.name === name) {
35
+ return 'behaviour';
36
+ }
37
+ if (node.type === AST_NODE_TYPES.VariableDeclarator && node.id.type === AST_NODE_TYPES.Identifier) {
38
+ if (node.id.name === name && node.init !== null) {
39
+ return expressionRole(node.init, program, seen);
40
+ }
41
+ }
42
+ }
43
+ return 'data';
44
+ }
45
+ //# sourceMappingURL=entry-role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-role.js","sourceRoot":"","sources":["../../../src/support/values/entry-role.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAU3C,mGAAmG;AACnG,MAAM,UAAU,cAAc,CAC5B,UAA+B,EAC/B,OAAyB,EACzB,IAAI,GAAwB,IAAI,GAAG,EAAE;IAErC,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEpC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,cAAc,CAAC,uBAAuB,CAAC;QAC5C,KAAK,cAAc,CAAC,kBAAkB,EAAE,CAAC;YACvC,OAAO,WAAW,CAAC;QACrB,CAAC;QACD,KAAK,cAAc,CAAC,cAAc,CAAC;QACnC,KAAK,cAAc,CAAC,aAAa,CAAC;QAClC,KAAK,cAAc,CAAC,eAAe,EAAE,CAAC;YACpC,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxG,CAAC;QACD,SAAS,CAAC;YACR,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;AACH,CAAC;AAED,wFAAwF;AACxF,SAAS,UAAU,CAAC,IAAwB;IAC1C,OAAO,kBAAkB,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC;AAED,oHAAoH;AACpH,SAAS,SAAS,CAAC,OAAyB,EAAE,IAAY,EAAE,IAAyB;IACnF,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,mBAAmB,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC;YAC/E,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,kBAAkB,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;YAClG,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBAChD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ import type { FunctionNode } from '../functions/function-node.js';
3
+ /** A function or a constant a module exports, with the node it is reported on. */
4
+ export type ExportedBinding = {
5
+ readonly kind: 'function';
6
+ readonly name: string;
7
+ readonly at: TSESTree.Node;
8
+ readonly node: FunctionNode;
9
+ } | {
10
+ readonly kind: 'object';
11
+ readonly name: string;
12
+ readonly at: TSESTree.Node;
13
+ readonly node: TSESTree.ObjectExpression;
14
+ };
15
+ /**
16
+ * The functions (declared, or arrows and function expressions bound to a constant) and object
17
+ * literals a module exports: inline, by `export { name }` and by `export default`, a name
18
+ * exported after its declaration being read from that declaration.
19
+ */
20
+ export declare function exportedBindings(program: TSESTree.Program): ExportedBinding[];
21
+ //# sourceMappingURL=exported-bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exported-bindings.d.ts","sourceRoot":"","sources":["../../../src/support/values/exported-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,kFAAkF;AAClF,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC7G;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC;CAC1C,CAAC;AAEN;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,GAAG,eAAe,EAAE,CAU7E"}