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

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 (125) hide show
  1. package/README.fr.md +7 -6
  2. package/README.md +5 -4
  3. package/dist/project/config.d.ts +8 -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 +13 -0
  7. package/dist/project/parse-config.js.map +1 -1
  8. package/dist/rules/declarations-role-declared.d.ts +2 -2
  9. package/dist/rules/declarations-role-declared.d.ts.map +1 -1
  10. package/dist/rules/declarations-role-declared.js +4 -68
  11. package/dist/rules/declarations-role-declared.js.map +1 -1
  12. package/dist/rules/naming-business-name.d.ts +6 -0
  13. package/dist/rules/naming-business-name.d.ts.map +1 -0
  14. package/dist/rules/naming-business-name.js +175 -0
  15. package/dist/rules/naming-business-name.js.map +1 -0
  16. package/dist/rules/rules.d.ts.map +1 -1
  17. package/dist/rules/rules.js +2 -0
  18. package/dist/rules/rules.js.map +1 -1
  19. package/dist/support/business-names/binding-advice.d.ts +4 -0
  20. package/dist/support/business-names/binding-advice.d.ts.map +1 -0
  21. package/dist/support/business-names/binding-advice.js +12 -0
  22. package/dist/support/business-names/binding-advice.js.map +1 -0
  23. package/dist/support/business-names/binding-kind.d.ts +3 -0
  24. package/dist/support/business-names/binding-kind.d.ts.map +1 -0
  25. package/dist/support/business-names/binding-kind.js +2 -0
  26. package/dist/support/business-names/binding-kind.js.map +1 -0
  27. package/dist/support/business-names/built-class.d.ts +9 -0
  28. package/dist/support/business-names/built-class.d.ts.map +1 -0
  29. package/dist/support/business-names/built-class.js +37 -0
  30. package/dist/support/business-names/built-class.js.map +1 -0
  31. package/dist/support/business-names/called-member.d.ts +8 -0
  32. package/dist/support/business-names/called-member.d.ts.map +1 -0
  33. package/dist/support/business-names/called-member.js +10 -0
  34. package/dist/support/business-names/called-member.js.map +1 -0
  35. package/dist/support/business-names/camel.d.ts +3 -0
  36. package/dist/support/business-names/camel.d.ts.map +1 -0
  37. package/dist/support/business-names/camel.js +5 -0
  38. package/dist/support/business-names/camel.js.map +1 -0
  39. package/dist/support/business-names/collection-element.d.ts +4 -0
  40. package/dist/support/business-names/collection-element.d.ts.map +1 -0
  41. package/dist/support/business-names/collection-element.js +12 -0
  42. package/dist/support/business-names/collection-element.js.map +1 -0
  43. package/dist/support/business-names/conventional-model-name.d.ts +9 -0
  44. package/dist/support/business-names/conventional-model-name.d.ts.map +1 -0
  45. package/dist/support/business-names/conventional-model-name.js +22 -0
  46. package/dist/support/business-names/conventional-model-name.js.map +1 -0
  47. package/dist/support/business-names/generic-words.d.ts +6 -0
  48. package/dist/support/business-names/generic-words.d.ts.map +1 -0
  49. package/dist/support/business-names/generic-words.js +25 -0
  50. package/dist/support/business-names/generic-words.js.map +1 -0
  51. package/dist/support/business-names/is-name-free.d.ts +10 -0
  52. package/dist/support/business-names/is-name-free.d.ts.map +1 -0
  53. package/dist/support/business-names/is-name-free.js +26 -0
  54. package/dist/support/business-names/is-name-free.js.map +1 -0
  55. package/dist/support/business-names/judges-names.d.ts +7 -0
  56. package/dist/support/business-names/judges-names.d.ts.map +1 -0
  57. package/dist/support/business-names/judges-names.js +14 -0
  58. package/dist/support/business-names/judges-names.js.map +1 -0
  59. package/dist/support/business-names/pattern-identifiers.d.ts +4 -0
  60. package/dist/support/business-names/pattern-identifiers.d.ts.map +1 -0
  61. package/dist/support/business-names/pattern-identifiers.js +21 -0
  62. package/dist/support/business-names/pattern-identifiers.js.map +1 -0
  63. package/dist/support/business-names/plural.d.ts +3 -0
  64. package/dist/support/business-names/plural.d.ts.map +1 -0
  65. package/dist/support/business-names/plural.js +8 -0
  66. package/dist/support/business-names/plural.js.map +1 -0
  67. package/dist/support/business-names/proposed-name.d.ts +6 -0
  68. package/dist/support/business-names/proposed-name.d.ts.map +1 -0
  69. package/dist/support/business-names/proposed-name.js +2 -0
  70. package/dist/support/business-names/proposed-name.js.map +1 -0
  71. package/dist/support/business-names/rename-fix.d.ts +8 -0
  72. package/dist/support/business-names/rename-fix.d.ts.map +1 -0
  73. package/dist/support/business-names/rename-fix.js +26 -0
  74. package/dist/support/business-names/rename-fix.js.map +1 -0
  75. package/dist/support/business-names/repository-concept.d.ts +4 -0
  76. package/dist/support/business-names/repository-concept.d.ts.map +1 -0
  77. package/dist/support/business-names/repository-concept.js +10 -0
  78. package/dist/support/business-names/repository-concept.js.map +1 -0
  79. package/dist/support/business-names/singular.d.ts +3 -0
  80. package/dist/support/business-names/singular.d.ts.map +1 -0
  81. package/dist/support/business-names/singular.js +11 -0
  82. package/dist/support/business-names/singular.js.map +1 -0
  83. package/dist/support/business-names/typed-names.d.ts +13 -0
  84. package/dist/support/business-names/typed-names.d.ts.map +1 -0
  85. package/dist/support/business-names/typed-names.js +53 -0
  86. package/dist/support/business-names/typed-names.js.map +1 -0
  87. package/dist/support/business-names/words-of.d.ts +9 -0
  88. package/dist/support/business-names/words-of.d.ts.map +1 -0
  89. package/dist/support/business-names/words-of.js +8 -0
  90. package/dist/support/business-names/words-of.js.map +1 -0
  91. package/dist/support/declarations/written-names.d.ts +1 -1
  92. package/dist/support/declarations/written-names.d.ts.map +1 -1
  93. package/dist/support/declarations/written-names.js +1 -2
  94. package/dist/support/declarations/written-names.js.map +1 -1
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/docs/rules/authz-declared.fr.md +2 -2
  98. package/docs/rules/authz-declared.md +1 -1
  99. package/docs/rules/context-extractable.fr.md +9 -5
  100. package/docs/rules/context-extractable.md +8 -4
  101. package/docs/rules/declarations-role-declared.fr.md +3 -11
  102. package/docs/rules/declarations-role-declared.md +2 -10
  103. package/docs/rules/domain-events-dispatched-on-save.fr.md +3 -3
  104. package/docs/rules/domain-events-dispatched-on-save.md +2 -2
  105. package/docs/rules/domain-events-transactional-before-commit.fr.md +24 -10
  106. package/docs/rules/domain-events-transactional-before-commit.md +23 -9
  107. package/docs/rules/events-consumer-idempotent.fr.md +9 -5
  108. package/docs/rules/events-consumer-idempotent.md +8 -4
  109. package/docs/rules/events-name-format.fr.md +2 -2
  110. package/docs/rules/events-name-format.md +1 -1
  111. package/docs/rules/layer-application-inward.fr.md +9 -3
  112. package/docs/rules/layer-application-inward.md +8 -2
  113. package/docs/rules/naming-business-name.fr.md +82 -0
  114. package/docs/rules/naming-business-name.md +81 -0
  115. package/docs/rules/ports-implements-never-extends.fr.md +9 -5
  116. package/docs/rules/ports-implements-never-extends.md +8 -4
  117. package/docs/rules/ports-no-concrete-dependency.fr.md +15 -5
  118. package/docs/rules/ports-no-concrete-dependency.md +14 -4
  119. package/docs/rules/ports-value-import.fr.md +5 -5
  120. package/docs/rules/ports-value-import.md +4 -4
  121. package/docs/rules/scheduling-job-name.fr.md +7 -3
  122. package/docs/rules/scheduling-job-name.md +6 -2
  123. package/docs/rules/scheduling-job-triggers-use-case.fr.md +8 -3
  124. package/docs/rules/scheduling-job-triggers-use-case.md +7 -2
  125. package/package.json +13 -9
@@ -0,0 +1,82 @@
1
+ [English](naming-business-name.md) · **Français**
2
+ <!-- translation-of: naming-business-name.md sha256:89217992f8690282 -->
3
+
4
+ # ddd-ts-kit/naming-business-name
5
+
6
+ Identifiant d'architecture : `naming/business-name`. Sévérité par défaut : `error`. Corrigible (`eslint --fix`) là où le nom est connu.
7
+
8
+ S'applique à : `domain/` et `application/` de chaque contexte, et au noyau partagé hors de son `presentation/` ; tests exclus. Active par défaut, dans un nouveau projet comme dans un projet existant : une configuration sans `businessNames` lit la liste par défaut.
9
+
10
+ ## Pourquoi
11
+
12
+ Le code du modèle, c'est le langage omniprésent (ubiquitous language) écrit. Un gestionnaire qui charge un rendez-vous et le nomme `target`, une boucle qui parcourt les rappels échus sous le nom `item`, un paramètre appelé `data` : chacun oblige le lecteur à retraduire la ligne dans les mots du métier, et cache le concept qu'elle manipule. Un nom générique se propage aussi, parce que la ligne suivante s'écrit en copiant la précédente : les gabarits de gestionnaire de commande du kit écrivaient `const target = X.create(..)` jusqu'à la 0.17, et quarante gestionnaires de l'application d'exemple en ont hérité. Nommée d'après son concept, `appointment`, `reminder`, `delegation`, une ligne se lit comme l'expert du domaine la dirait.
13
+
14
+ ## Signalé
15
+
16
+ Un nom qui est l'un des mots génériques, `target`, `targets`, `data`, `item`, `items`, `obj`, `object`, `thing`, `things`, `stuff`, `info`, `element`, `el`, `tmp`, `temp`, `foo`, `bar` ou `baz`, donné à :
17
+
18
+ - une variable, `const target = ..` ;
19
+ - une variable de boucle, `for (const target of due)` ;
20
+ - un nom déstructuré, `const { lines: data } = command`, à toute profondeur ;
21
+ - un paramètre d'une fonction, d'une méthode, d'une fonction fléchée, d'une signature abstraite ou de surcharge, d'une signature de méthode d'interface, ou d'un type fonction ;
22
+ - une propriété d'une classe (propriétés de paramètre comprises), d'une interface, ou d'un alias de type objet.
23
+
24
+ Incorrect :
25
+
26
+ ```ts
27
+ const target = await this.appointmentRepository.findById(command.appointmentId);
28
+
29
+ for (const target of due) {
30
+ target.expire(command.at);
31
+ }
32
+ ```
33
+
34
+ Correct :
35
+
36
+ ```ts
37
+ const appointment = await this.appointmentRepository.findById(command.appointmentId);
38
+
39
+ for (const appointment of due) {
40
+ appointment.expire(command.at);
41
+ }
42
+ ```
43
+
44
+ ## Le correctif
45
+
46
+ Une variable dont l'initialiseur dit quel concept elle désigne est renommée, avec chacun de ses usages, du nom de ce concept en camelCase :
47
+
48
+ - `X.create(..)` et `new X(..)`, `X` étant une classe du fichier ou importée du projet (`new Map()` ne dit rien du métier) : `const appointment = Appointment.create(..)` ;
49
+ - un appel sur un *repository* : avec l'information de types (les presets du plugin la donnent), le type qu'il répond, une fois attendu et sans `undefined`, quand c'est un agrégat, une entité ou un objet-valeur du projet (`domain/aggregates/`, `domain/entities/`, `domain/value-objects/`, le noyau partagé) ; `appointments` pour une liste. Le *repository* est une instance d'un port de `domain/repositories/`, ou une liaison nommée `<concept>Repository`. Sans information de types, les noms décident : `this.appointmentRepository.findById(..)` (`find`, `get`, `load`, `require`, seuls ou suivis de `One` ou `ById`) désigne un `appointment`, `findDue(..)` reçu par un mot au pluriel (`targets`, `items`, `things`) désigne des `appointments`.
50
+
51
+ Une propriété abrégée garde sa clé : `{ target }` devient `{ target: appointment }`. La règle signale sans corriger quand le nom est déjà pris (déclaré dans la portée, masqué entre un usage et la déclaration, ou employé dans la portée pour autre chose), quand la variable est exportée, et quand la liaison désigne un élément alors que le nom en dit plusieurs, ou l'inverse. Une variable de boucle n'est jamais corrigée : le message donne le singulier de sa collection (`reminder` pour `dueReminders`, ou le type de l'élément avec l'information de types).
52
+
53
+ Mettre un projet à jour tient en une commande, puis les signalements qui restent :
54
+
55
+ ```bash
56
+ npx eslint . --fix
57
+ npx eslint .
58
+ ```
59
+
60
+ ## Détails
61
+
62
+ Une clé d'un objet littéral suit le type pour lequel elle est écrite et n'est pas jugée : `{ items, total }` est la forme d'une `Page` du noyau. Un type littéral imbriqué dans une annotation, `props: { data: string }`, n'est pas non plus une déclaration du modèle. Une clause `catch` n'est pas jugée.
63
+
64
+ ## Options
65
+
66
+ `words` : les mots génériques, à la place de la liste par défaut. `allow` : des mots retirés de la liste.
67
+
68
+ ```js
69
+ 'ddd-ts-kit/naming-business-name': ['error', { allow: ['info'] }]
70
+ ```
71
+
72
+ Les deux options passent par-dessus `businessNames` de `ddd-ts-kit.config.json`, `{ "words": [..], "allow": [..] }`, que lit aussi `ddd-ts-kit check` : gardez la liste là, pour que les deux analyseurs jugent les mêmes noms. `rules."naming/business-name"` à `off` fait taire la règle, et `// ddd-ts-kit-disable-next-line naming/business-name -- <raison>` fait taire une ligne, exactement comme pour `ddd-ts-kit check`.
73
+
74
+ ## Limites
75
+
76
+ - L'infrastructure, la présentation, la plateforme et les tests ne sont pas jugés : un adaptateur parle les mots de sa bibliothèque, et une spec ceux de son scénario. Un *serializer* de `presentation/` gagne tout de même à être nommé d'après ce qu'il sérialise.
77
+ - Un mot générique à l'intérieur d'un nom plus long (`targetDate`, `itemCount`) n'est pas signalé : il est qualifié. `language/no-technical-name` juge les noms des classes et des cas d'usage.
78
+ - Sans information de types, un *repository* dont la méthode ne nomme ni un élément ni plusieurs (`save`, `search`, `count`) ne reçoit aucune proposition.
79
+
80
+ ## Avec le checker de la CLI
81
+
82
+ `ddd-ts-kit check` signale le même identifiant à partir du texte des fichiers, avec la même liste et aux mêmes endroits, et propose le nom de la classe qu'un initialiseur construit ou du *repository* qu'il lit. Cette règle fait autorité, et c'est elle qui renomme.
@@ -0,0 +1,81 @@
1
+ **English** · [Français](naming-business-name.fr.md)
2
+
3
+ # ddd-ts-kit/naming-business-name
4
+
5
+ Architecture id: `naming/business-name`. Default severity: `error`. Fixable (`eslint --fix`) where the name is known.
6
+
7
+ Applies to: `domain/` and `application/` of every context, and the shared kernel outside its `presentation/`; tests excluded. On by default, in a new project and in an existing one: a config without `businessNames` reads the default list.
8
+
9
+ ## Why
10
+
11
+ The code of the model is the ubiquitous language written down. A handler that loads an appointment and names it `target`, a loop that walks the due reminders as `item`, a parameter called `data`: each makes the reader translate the line back into the business, and hides which concept it handles. A generic name also spreads, because the next line is written by copying the last one: the command handler templates of the kit wrote `const target = X.create(..)` until 0.17, and forty handlers of the example application inherited it. Named after its concept, `appointment`, `reminder`, `delegation`, a line reads as the domain expert would say it.
12
+
13
+ ## Reported
14
+
15
+ A name that is one of the generic words, `target`, `targets`, `data`, `item`, `items`, `obj`, `object`, `thing`, `things`, `stuff`, `info`, `element`, `el`, `tmp`, `temp`, `foo`, `bar` or `baz`, given to:
16
+
17
+ - a variable, `const target = ..`;
18
+ - a loop variable, `for (const target of due)`;
19
+ - a destructured binding, `const { lines: data } = command`, at any depth;
20
+ - a parameter of a function, a method, an arrow, an abstract or overload signature, a method signature of an interface, or a function type;
21
+ - a property of a class (parameter properties included), of an interface, or of a type alias of an object.
22
+
23
+ Incorrect:
24
+
25
+ ```ts
26
+ const target = await this.appointmentRepository.findById(command.appointmentId);
27
+
28
+ for (const target of due) {
29
+ target.expire(command.at);
30
+ }
31
+ ```
32
+
33
+ Correct:
34
+
35
+ ```ts
36
+ const appointment = await this.appointmentRepository.findById(command.appointmentId);
37
+
38
+ for (const appointment of due) {
39
+ appointment.expire(command.at);
40
+ }
41
+ ```
42
+
43
+ ## The fix
44
+
45
+ A variable whose initializer says which concept it holds is renamed, with every use of it, to the name of that concept in camel case:
46
+
47
+ - `X.create(..)` and `new X(..)`, `X` a class of the file or one imported from the project (`new Map()` says nothing of the business): `const appointment = Appointment.create(..)`;
48
+ - a call on a repository: with type information (the presets of the plugin give it), the type it answers, once awaited and without `undefined`, when it is an aggregate, an entity or a value object of the project (`domain/aggregates/`, `domain/entities/`, `domain/value-objects/`, the shared kernel); `appointments` for a list. The repository is an instance of a port of `domain/repositories/`, or a binding named `<concept>Repository`. Without type information, the names decide: `this.appointmentRepository.findById(..)` (`find`, `get`, `load`, `require`, alone or with `One` or `ById`) holds an `appointment`, `findDue(..)` held by a plural word (`targets`, `items`, `things`) holds `appointments`.
49
+
50
+ A shorthand property keeps its key: `{ target }` becomes `{ target: appointment }`. The rule reports without fixing when the name is already taken (declared in the scope, shadowing between a use and the declaration, or used inside the scope for something else), when the variable is exported, and when the binding holds one element but the name says several, or the other way round. A loop variable is never fixed: the message gives the singular of its collection (`reminder` for `dueReminders`, or the element type with type information).
51
+
52
+ Upgrading a project is one command, then the reports that remain:
53
+
54
+ ```bash
55
+ npx eslint . --fix
56
+ npx eslint .
57
+ ```
58
+
59
+ ## Details
60
+
61
+ A key of an object literal follows the type it is written for and is not judged: `{ items, total }` is the shape of a `Page` of the kernel. A type literal nested in an annotation, `props: { data: string }`, is not a declaration of the model either. A catch clause is not judged.
62
+
63
+ ## Options
64
+
65
+ `words`: the generic words, in place of the default list. `allow`: words removed from the list.
66
+
67
+ ```js
68
+ 'ddd-ts-kit/naming-business-name': ['error', { allow: ['info'] }]
69
+ ```
70
+
71
+ Both options come over `businessNames` of `ddd-ts-kit.config.json`, `{ "words": [..], "allow": [..] }`, which `ddd-ts-kit check` reads too: keep the list there so that both analyzers judge the same names. `rules."naming/business-name"` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line naming/business-name -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
72
+
73
+ ## Limits
74
+
75
+ - Infrastructure, presentation, the platform and the tests are not judged: an adapter speaks the words of its library, and a spec the words of its scenario. A serializer of `presentation/` is still better named after what it serializes.
76
+ - A generic word inside a longer name (`targetDate`, `itemCount`) is not reported: it is qualified. `language/no-technical-name` judges the names of classes and use cases.
77
+ - Without type information, a repository whose method names neither one element nor several (`save`, `search`, `count`) gets no proposal.
78
+
79
+ ## With the CLI checker
80
+
81
+ `ddd-ts-kit check` reports the same id from the text of the files, with the same list and the same places, and proposes the name of the class an initializer builds or of the repository it reads. This rule is the authority, and the one that renames.
@@ -1,5 +1,5 @@
1
1
  [English](ports-implements-never-extends.md) · **Français**
2
- <!-- translation-of: ports-implements-never-extends.md sha256:2a318e3c9e3a8f11 -->
2
+ <!-- translation-of: ports-implements-never-extends.md sha256:00a3d609e321314e -->
3
3
 
4
4
  # ddd-ts-kit/ports-implements-never-extends
5
5
 
@@ -20,8 +20,10 @@ Un adaptateur honore un contrat ; il n'en hérite pas. `implements` laisse le co
20
20
  Incorrect :
21
21
 
22
22
  ```ts
23
- @Repository(InvoiceRepository, [Database])
24
- export class KnexInvoiceRepository extends InvoiceRepository {}
23
+ @Repository(InvoiceRepository)
24
+ export class KnexInvoiceRepository extends InvoiceRepository {
25
+ constructor(private readonly database: Database) {}
26
+ }
25
27
 
26
28
  builder.bind(PaymentGateway).toClass(StripePaymentGateway, [PaymentSettings]);
27
29
  // où : export class StripePaymentGateway {}
@@ -30,8 +32,10 @@ builder.bind(PaymentGateway).toClass(StripePaymentGateway, [PaymentSettings]);
30
32
  Correct :
31
33
 
32
34
  ```ts
33
- @Repository(InvoiceRepository, [Database])
34
- export class KnexInvoiceRepository implements InvoiceRepository {}
35
+ @Repository(InvoiceRepository)
36
+ export class KnexInvoiceRepository implements InvoiceRepository {
37
+ constructor(private readonly database: Database) {}
38
+ }
35
39
 
36
40
  export class StripePaymentGateway implements PaymentGateway {}
37
41
  ```
@@ -19,8 +19,10 @@ An adapter honours a contract; it does not inherit from it. `implements` lets th
19
19
  Incorrect:
20
20
 
21
21
  ```ts
22
- @Repository(InvoiceRepository, [Database])
23
- export class KnexInvoiceRepository extends InvoiceRepository {}
22
+ @Repository(InvoiceRepository)
23
+ export class KnexInvoiceRepository extends InvoiceRepository {
24
+ constructor(private readonly database: Database) {}
25
+ }
24
26
 
25
27
  builder.bind(PaymentGateway).toClass(StripePaymentGateway, [PaymentSettings]);
26
28
  // where: export class StripePaymentGateway {}
@@ -29,8 +31,10 @@ builder.bind(PaymentGateway).toClass(StripePaymentGateway, [PaymentSettings]);
29
31
  Correct:
30
32
 
31
33
  ```ts
32
- @Repository(InvoiceRepository, [Database])
33
- export class KnexInvoiceRepository implements InvoiceRepository {}
34
+ @Repository(InvoiceRepository)
35
+ export class KnexInvoiceRepository implements InvoiceRepository {
36
+ constructor(private readonly database: Database) {}
37
+ }
34
38
 
35
39
  export class StripePaymentGateway implements PaymentGateway {}
36
40
  ```
@@ -1,5 +1,5 @@
1
1
  [English](ports-no-concrete-dependency.md) · **Français**
2
- <!-- translation-of: ports-no-concrete-dependency.md sha256:16e87b49946851fe -->
2
+ <!-- translation-of: ports-no-concrete-dependency.md sha256:4743d3de0c74fb07 -->
3
3
 
4
4
  # ddd-ts-kit/ports-no-concrete-dependency
5
5
 
@@ -22,8 +22,13 @@ Incorrect :
22
22
  ```ts
23
23
  import { KnexInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/knex-invoice.repository';
24
24
 
25
- @CommandHandler(IssueInvoiceCommand, [KnexInvoiceRepository, Clock])
26
- export class IssueInvoiceHandler {}
25
+ @CommandHandler(IssueInvoiceCommand)
26
+ export class IssueInvoiceHandler {
27
+ constructor(
28
+ private readonly knexInvoiceRepository: KnexInvoiceRepository,
29
+ private readonly clock: Clock,
30
+ ) {}
31
+ }
27
32
  ```
28
33
 
29
34
  Correct :
@@ -31,8 +36,13 @@ Correct :
31
36
  ```ts
32
37
  import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
33
38
 
34
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])
35
- export class IssueInvoiceHandler {}
39
+ @CommandHandler(IssueInvoiceCommand)
40
+ export class IssueInvoiceHandler {
41
+ constructor(
42
+ private readonly invoiceRepository: InvoiceRepository,
43
+ private readonly clock: Clock,
44
+ ) {}
45
+ }
36
46
  ```
37
47
 
38
48
  ## Détails
@@ -21,8 +21,13 @@ Incorrect:
21
21
  ```ts
22
22
  import { KnexInvoiceRepository } from '@/contexts/billing/infrastructure/persistence/knex-invoice.repository';
23
23
 
24
- @CommandHandler(IssueInvoiceCommand, [KnexInvoiceRepository, Clock])
25
- export class IssueInvoiceHandler {}
24
+ @CommandHandler(IssueInvoiceCommand)
25
+ export class IssueInvoiceHandler {
26
+ constructor(
27
+ private readonly knexInvoiceRepository: KnexInvoiceRepository,
28
+ private readonly clock: Clock,
29
+ ) {}
30
+ }
26
31
  ```
27
32
 
28
33
  Correct:
@@ -30,8 +35,13 @@ Correct:
30
35
  ```ts
31
36
  import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
32
37
 
33
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])
34
- export class IssueInvoiceHandler {}
38
+ @CommandHandler(IssueInvoiceCommand)
39
+ export class IssueInvoiceHandler {
40
+ constructor(
41
+ private readonly invoiceRepository: InvoiceRepository,
42
+ private readonly clock: Clock,
43
+ ) {}
44
+ }
35
45
  ```
36
46
 
37
47
  ## Details
@@ -1,5 +1,5 @@
1
1
  [English](ports-value-import.md) · **Français**
2
- <!-- translation-of: ports-value-import.md sha256:84a37501770a4462 -->
2
+ <!-- translation-of: ports-value-import.md sha256:56fe341111170bd1 -->
3
3
 
4
4
  # ddd-ts-kit/ports-value-import
5
5
 
@@ -21,8 +21,8 @@ Incorrect :
21
21
  ```ts
22
22
  import type { Clock } from '@ddd-ts-kit/kernel';
23
23
 
24
- @CommandHandler(IssueInvoiceCommand, [Clock])
25
- export class IssueInvoiceHandler {}
24
+ // billing.module.ts, style explicite
25
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [Clock]);
26
26
  ```
27
27
 
28
28
  Correct :
@@ -30,8 +30,8 @@ Correct :
30
30
  ```ts
31
31
  import { Clock } from '@ddd-ts-kit/kernel';
32
32
 
33
- @CommandHandler(IssueInvoiceCommand, [Clock])
34
- export class IssueInvoiceHandler {}
33
+ // billing.module.ts, style explicite
34
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [Clock]);
35
35
  ```
36
36
 
37
37
  ## Détails
@@ -20,8 +20,8 @@ Incorrect:
20
20
  ```ts
21
21
  import type { Clock } from '@ddd-ts-kit/kernel';
22
22
 
23
- @CommandHandler(IssueInvoiceCommand, [Clock])
24
- export class IssueInvoiceHandler {}
23
+ // billing.module.ts, explicit style
24
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [Clock]);
25
25
  ```
26
26
 
27
27
  Correct:
@@ -29,8 +29,8 @@ Correct:
29
29
  ```ts
30
30
  import { Clock } from '@ddd-ts-kit/kernel';
31
31
 
32
- @CommandHandler(IssueInvoiceCommand, [Clock])
33
- export class IssueInvoiceHandler {}
32
+ // billing.module.ts, explicit style
33
+ builder.command(IssueInvoiceCommand).handledBy(IssueInvoiceHandler, [Clock]);
34
34
  ```
35
35
 
36
36
  ## Details
@@ -1,5 +1,5 @@
1
1
  [English](scheduling-job-name.md) · **Français**
2
- <!-- translation-of: scheduling-job-name.md sha256:de37d4172a90474e -->
2
+ <!-- translation-of: scheduling-job-name.md sha256:fcce14a1f2803f23 -->
3
3
 
4
4
  # ddd-ts-kit/scheduling-job-name
5
5
 
@@ -21,8 +21,10 @@ Le nom d'un *job* est son identité : le verrou qui limite une occurrence à une
21
21
  Incorrect :
22
22
 
23
23
  ```ts
24
- @Scheduled('SendReminders', { every: '15m' }, [CommandBus])
24
+ @Scheduled('SendReminders', { every: '15m' })
25
25
  export class SendRemindersJob implements ScheduledJob {
26
+ constructor(private readonly commands: CommandBus) {}
27
+
26
28
  async run(execution: JobExecution): Promise<void> {
27
29
  await this.commands.execute(new SendRemindersCommand(systemActor('reminders'), execution.scheduledAt));
28
30
  }
@@ -32,8 +34,10 @@ export class SendRemindersJob implements ScheduledJob {
32
34
  Correct :
33
35
 
34
36
  ```ts
35
- @Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])
37
+ @Scheduled('billing.send-reminders', { every: '15m' })
36
38
  export class SendRemindersJob implements ScheduledJob {
39
+ constructor(private readonly commands: CommandBus) {}
40
+
37
41
  async run(execution: JobExecution): Promise<void> {
38
42
  await this.commands.execute(new SendRemindersCommand(systemActor('billing.send-reminders'), execution.scheduledAt));
39
43
  }
@@ -20,8 +20,10 @@ The name of a job is its identity: the lock that keeps an occurrence to one run,
20
20
  Incorrect:
21
21
 
22
22
  ```ts
23
- @Scheduled('SendReminders', { every: '15m' }, [CommandBus])
23
+ @Scheduled('SendReminders', { every: '15m' })
24
24
  export class SendRemindersJob implements ScheduledJob {
25
+ constructor(private readonly commands: CommandBus) {}
26
+
25
27
  async run(execution: JobExecution): Promise<void> {
26
28
  await this.commands.execute(new SendRemindersCommand(systemActor('reminders'), execution.scheduledAt));
27
29
  }
@@ -31,8 +33,10 @@ export class SendRemindersJob implements ScheduledJob {
31
33
  Correct:
32
34
 
33
35
  ```ts
34
- @Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])
36
+ @Scheduled('billing.send-reminders', { every: '15m' })
35
37
  export class SendRemindersJob implements ScheduledJob {
38
+ constructor(private readonly commands: CommandBus) {}
39
+
36
40
  async run(execution: JobExecution): Promise<void> {
37
41
  await this.commands.execute(new SendRemindersCommand(systemActor('billing.send-reminders'), execution.scheduledAt));
38
42
  }
@@ -1,5 +1,5 @@
1
1
  [English](scheduling-job-triggers-use-case.md) · **Français**
2
- <!-- translation-of: scheduling-job-triggers-use-case.md sha256:2d4c41372454b22f -->
2
+ <!-- translation-of: scheduling-job-triggers-use-case.md sha256:cfb7f54359a91a6d -->
3
3
 
4
4
  # ddd-ts-kit/scheduling-job-triggers-use-case
5
5
 
@@ -29,8 +29,13 @@ Incorrect :
29
29
 
30
30
  ```ts
31
31
  // application/scheduling/send-reminders.job.ts
32
- @Scheduled('billing.send-reminders', { every: '15m' }, [InvoiceRepository, Mailer])
32
+ @Scheduled('billing.send-reminders', { every: '15m' })
33
33
  export class SendRemindersJob implements ScheduledJob {
34
+ constructor(
35
+ private readonly invoices: InvoiceRepository,
36
+ private readonly mailer: Mailer,
37
+ ) {}
38
+
34
39
  async run(): Promise<void> {
35
40
  for (const invoice of await this.invoices.overdue()) {
36
41
  await this.mailer.remind(invoice);
@@ -43,7 +48,7 @@ Correct :
43
48
 
44
49
  ```ts
45
50
  // application/scheduling/send-reminders.job.ts
46
- @Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])
51
+ @Scheduled('billing.send-reminders', { every: '15m' })
47
52
  export class SendRemindersJob implements ScheduledJob {
48
53
  constructor(private readonly commands: CommandBus) {}
49
54
 
@@ -28,8 +28,13 @@ Incorrect:
28
28
 
29
29
  ```ts
30
30
  // application/scheduling/send-reminders.job.ts
31
- @Scheduled('billing.send-reminders', { every: '15m' }, [InvoiceRepository, Mailer])
31
+ @Scheduled('billing.send-reminders', { every: '15m' })
32
32
  export class SendRemindersJob implements ScheduledJob {
33
+ constructor(
34
+ private readonly invoices: InvoiceRepository,
35
+ private readonly mailer: Mailer,
36
+ ) {}
37
+
33
38
  async run(): Promise<void> {
34
39
  for (const invoice of await this.invoices.overdue()) {
35
40
  await this.mailer.remind(invoice);
@@ -42,7 +47,7 @@ Correct:
42
47
 
43
48
  ```ts
44
49
  // application/scheduling/send-reminders.job.ts
45
- @Scheduled('billing.send-reminders', { every: '15m' }, [CommandBus])
50
+ @Scheduled('billing.send-reminders', { every: '15m' })
46
51
  export class SendRemindersJob implements ScheduledJob {
47
52
  constructor(private readonly commands: CommandBus) {}
48
53
 
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/eslint-plugin",
3
- "version": "0.16.1",
3
+ "version": "0.18.0",
4
4
  "description": "AST-accurate ESLint rules for DDD and Clean Architecture in TypeScript: layer and context isolation, domain purity, clean code ordering.",
5
+ "keywords": [
6
+ "ddd",
7
+ "domain-driven-design",
8
+ "clean-architecture",
9
+ "hexagonal-architecture",
10
+ "typescript",
11
+ "eslint",
12
+ "eslintplugin",
13
+ "eslint-plugin",
14
+ "architecture-testing",
15
+ "clean-code"
16
+ ],
5
17
  "license": "MIT",
6
18
  "repository": {
7
19
  "type": "git",
@@ -16,14 +28,6 @@
16
28
  },
17
29
  "type": "module",
18
30
  "sideEffects": false,
19
- "keywords": [
20
- "eslint",
21
- "eslintplugin",
22
- "eslint-plugin",
23
- "ddd",
24
- "clean-architecture",
25
- "typescript"
26
- ],
27
31
  "engines": {
28
32
  "node": ">=22.12.0"
29
33
  },