@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.
- package/README.fr.md +7 -6
- package/README.md +5 -4
- package/dist/project/config.d.ts +8 -0
- package/dist/project/config.d.ts.map +1 -1
- package/dist/project/parse-config.d.ts.map +1 -1
- package/dist/project/parse-config.js +13 -0
- package/dist/project/parse-config.js.map +1 -1
- package/dist/rules/declarations-role-declared.d.ts +2 -2
- package/dist/rules/declarations-role-declared.d.ts.map +1 -1
- package/dist/rules/declarations-role-declared.js +4 -68
- package/dist/rules/declarations-role-declared.js.map +1 -1
- package/dist/rules/naming-business-name.d.ts +6 -0
- package/dist/rules/naming-business-name.d.ts.map +1 -0
- package/dist/rules/naming-business-name.js +175 -0
- package/dist/rules/naming-business-name.js.map +1 -0
- package/dist/rules/rules.d.ts.map +1 -1
- package/dist/rules/rules.js +2 -0
- package/dist/rules/rules.js.map +1 -1
- package/dist/support/business-names/binding-advice.d.ts +4 -0
- package/dist/support/business-names/binding-advice.d.ts.map +1 -0
- package/dist/support/business-names/binding-advice.js +12 -0
- package/dist/support/business-names/binding-advice.js.map +1 -0
- package/dist/support/business-names/binding-kind.d.ts +3 -0
- package/dist/support/business-names/binding-kind.d.ts.map +1 -0
- package/dist/support/business-names/binding-kind.js +2 -0
- package/dist/support/business-names/binding-kind.js.map +1 -0
- package/dist/support/business-names/built-class.d.ts +9 -0
- package/dist/support/business-names/built-class.d.ts.map +1 -0
- package/dist/support/business-names/built-class.js +37 -0
- package/dist/support/business-names/built-class.js.map +1 -0
- package/dist/support/business-names/called-member.d.ts +8 -0
- package/dist/support/business-names/called-member.d.ts.map +1 -0
- package/dist/support/business-names/called-member.js +10 -0
- package/dist/support/business-names/called-member.js.map +1 -0
- package/dist/support/business-names/camel.d.ts +3 -0
- package/dist/support/business-names/camel.d.ts.map +1 -0
- package/dist/support/business-names/camel.js +5 -0
- package/dist/support/business-names/camel.js.map +1 -0
- package/dist/support/business-names/collection-element.d.ts +4 -0
- package/dist/support/business-names/collection-element.d.ts.map +1 -0
- package/dist/support/business-names/collection-element.js +12 -0
- package/dist/support/business-names/collection-element.js.map +1 -0
- package/dist/support/business-names/conventional-model-name.d.ts +9 -0
- package/dist/support/business-names/conventional-model-name.d.ts.map +1 -0
- package/dist/support/business-names/conventional-model-name.js +22 -0
- package/dist/support/business-names/conventional-model-name.js.map +1 -0
- package/dist/support/business-names/generic-words.d.ts +6 -0
- package/dist/support/business-names/generic-words.d.ts.map +1 -0
- package/dist/support/business-names/generic-words.js +25 -0
- package/dist/support/business-names/generic-words.js.map +1 -0
- package/dist/support/business-names/is-name-free.d.ts +10 -0
- package/dist/support/business-names/is-name-free.d.ts.map +1 -0
- package/dist/support/business-names/is-name-free.js +26 -0
- package/dist/support/business-names/is-name-free.js.map +1 -0
- package/dist/support/business-names/judges-names.d.ts +7 -0
- package/dist/support/business-names/judges-names.d.ts.map +1 -0
- package/dist/support/business-names/judges-names.js +14 -0
- package/dist/support/business-names/judges-names.js.map +1 -0
- package/dist/support/business-names/pattern-identifiers.d.ts +4 -0
- package/dist/support/business-names/pattern-identifiers.d.ts.map +1 -0
- package/dist/support/business-names/pattern-identifiers.js +21 -0
- package/dist/support/business-names/pattern-identifiers.js.map +1 -0
- package/dist/support/business-names/plural.d.ts +3 -0
- package/dist/support/business-names/plural.d.ts.map +1 -0
- package/dist/support/business-names/plural.js +8 -0
- package/dist/support/business-names/plural.js.map +1 -0
- package/dist/support/business-names/proposed-name.d.ts +6 -0
- package/dist/support/business-names/proposed-name.d.ts.map +1 -0
- package/dist/support/business-names/proposed-name.js +2 -0
- package/dist/support/business-names/proposed-name.js.map +1 -0
- package/dist/support/business-names/rename-fix.d.ts +8 -0
- package/dist/support/business-names/rename-fix.d.ts.map +1 -0
- package/dist/support/business-names/rename-fix.js +26 -0
- package/dist/support/business-names/rename-fix.js.map +1 -0
- package/dist/support/business-names/repository-concept.d.ts +4 -0
- package/dist/support/business-names/repository-concept.d.ts.map +1 -0
- package/dist/support/business-names/repository-concept.js +10 -0
- package/dist/support/business-names/repository-concept.js.map +1 -0
- package/dist/support/business-names/singular.d.ts +3 -0
- package/dist/support/business-names/singular.d.ts.map +1 -0
- package/dist/support/business-names/singular.js +11 -0
- package/dist/support/business-names/singular.js.map +1 -0
- package/dist/support/business-names/typed-names.d.ts +13 -0
- package/dist/support/business-names/typed-names.d.ts.map +1 -0
- package/dist/support/business-names/typed-names.js +53 -0
- package/dist/support/business-names/typed-names.js.map +1 -0
- package/dist/support/business-names/words-of.d.ts +9 -0
- package/dist/support/business-names/words-of.d.ts.map +1 -0
- package/dist/support/business-names/words-of.js +8 -0
- package/dist/support/business-names/words-of.js.map +1 -0
- package/dist/support/declarations/written-names.d.ts +1 -1
- package/dist/support/declarations/written-names.d.ts.map +1 -1
- package/dist/support/declarations/written-names.js +1 -2
- package/dist/support/declarations/written-names.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/rules/authz-declared.fr.md +2 -2
- package/docs/rules/authz-declared.md +1 -1
- package/docs/rules/context-extractable.fr.md +9 -5
- package/docs/rules/context-extractable.md +8 -4
- package/docs/rules/declarations-role-declared.fr.md +3 -11
- package/docs/rules/declarations-role-declared.md +2 -10
- package/docs/rules/domain-events-dispatched-on-save.fr.md +3 -3
- package/docs/rules/domain-events-dispatched-on-save.md +2 -2
- package/docs/rules/domain-events-transactional-before-commit.fr.md +24 -10
- package/docs/rules/domain-events-transactional-before-commit.md +23 -9
- package/docs/rules/events-consumer-idempotent.fr.md +9 -5
- package/docs/rules/events-consumer-idempotent.md +8 -4
- package/docs/rules/events-name-format.fr.md +2 -2
- package/docs/rules/events-name-format.md +1 -1
- package/docs/rules/layer-application-inward.fr.md +9 -3
- package/docs/rules/layer-application-inward.md +8 -2
- package/docs/rules/naming-business-name.fr.md +82 -0
- package/docs/rules/naming-business-name.md +81 -0
- package/docs/rules/ports-implements-never-extends.fr.md +9 -5
- package/docs/rules/ports-implements-never-extends.md +8 -4
- package/docs/rules/ports-no-concrete-dependency.fr.md +15 -5
- package/docs/rules/ports-no-concrete-dependency.md +14 -4
- package/docs/rules/ports-value-import.fr.md +5 -5
- package/docs/rules/ports-value-import.md +4 -4
- package/docs/rules/scheduling-job-name.fr.md +7 -3
- package/docs/rules/scheduling-job-name.md +6 -2
- package/docs/rules/scheduling-job-triggers-use-case.fr.md +8 -3
- package/docs/rules/scheduling-job-triggers-use-case.md +7 -2
- package/package.json +13 -9
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:297709003d7940b5 -->
|
|
3
3
|
|
|
4
4
|
# @ddd-ts-kit/eslint-plugin
|
|
5
5
|
|
|
@@ -206,6 +206,7 @@ chaque règle à `error`.
|
|
|
206
206
|
| [`context/declared-relationship`](docs/rules/context-declared-relationship.fr.md) | `ddd-ts-kit/context-declared-relationship` | un tel import exige que l'amont soit déclaré dans la config | `error` | maison |
|
|
207
207
|
| [`context/published-language-is-a-contract`](docs/rules/context-published-language-is-a-contract.fr.md) | `ddd-ts-kit/context-published-language-is-a-contract` | `published-language/` n'importe que sa liste d'autorisation et d'autres langages publiés | `error` | maison |
|
|
208
208
|
| [`language/declared-vocabulary`](docs/rules/language-declared-vocabulary.fr.md) | `ddd-ts-kit/language-declared-vocabulary` | une valeur d'un vocabulaire fermé que déclare le projet (un objet `as const` avec le type union de son nom, un ensemble de permissions) est lue à travers lui, jamais réécrite sous forme de chaîne, sous `"stack.literals": "named"` ; tests et langages publiés exclus | `error` | maison |
|
|
209
|
+
| [`naming/business-name`](docs/rules/naming-business-name.fr.md) | `ddd-ts-kit/naming-business-name` | une variable, un paramètre, une propriété, un nom déstructuré ou une variable de boucle de `domain/`, `application/` et du noyau partagé porte le nom de son concept, jamais `target`, `data`, `item` ni un autre mot générique (`words`, `allow`, `businessNames` de la configuration) ; corrigible quand l'initialiseur nomme le concept | `error` | maison |
|
|
209
210
|
| [`purity/no-system-clock`](docs/rules/purity-no-system-clock.fr.md) | `ddd-ts-kit/purity-no-system-clock` | pas de `new Date()`, `Date.now()`, `Date()`, `performance.now()` dans `domain/` et `application/` | `error` | maison |
|
|
210
211
|
| [`purity/no-ambient-randomness`](docs/rules/purity-no-ambient-randomness.fr.md) | `ddd-ts-kit/purity-no-ambient-randomness` | pas de `Math.random`, `crypto.randomUUID` ni de bibliothèque d'identifiants dans `domain/` et `application/` | `error` | maison |
|
|
211
212
|
| [`purity/no-environment`](docs/rules/purity-no-environment.fr.md) | `ddd-ts-kit/purity-no-environment` | pas de `process.env`, `console`, `fetch`, ni de module de système de fichiers ou de réseau dans `domain/` et `application/` | `error` | maison |
|
|
@@ -256,7 +257,7 @@ chaque règle à `error`.
|
|
|
256
257
|
| [`tracing/platform-only`](docs/rules/tracing-platform-only.fr.md) | `ddd-ts-kit/tracing-platform-only` | `@ddd-ts-kit/tracing` et `@opentelemetry/*` ne sont importés que par le répertoire de la plateforme, `main.ts` et `apps/` | `error` | maison |
|
|
257
258
|
| [`standard/no-parallel-interface`](docs/rules/standard-no-parallel-interface.fr.md) | `ddd-ts-kit/standard-no-parallel-interface` | aucun `ILogger`, `UserContext`, `PaginatedResult`, `CronJob`, `ErrorTracker` ni semblable déclaré à côté des interfaces standard du kernel (`standardInterfaces` dans la config) | `warn` | maison |
|
|
258
259
|
| [`governance/recorded-deviation`](docs/rules/governance-recorded-deviation.fr.md) | `ddd-ts-kit/governance-recorded-deviation` | chaque désactivation nomme ses règles et renvoie à `ADR-<number>` après `--` | `error` | maison |
|
|
259
|
-
| [`declarations/role-declared`](docs/rules/declarations-role-declared.fr.md) | `ddd-ts-kit/declarations-role-declared` | style déclaré seulement : un fichier de rôle exporte une classe portant le décorateur de son rôle, le `consumer` et le `name` d'une déclaration sont des chaînes littérales,
|
|
260
|
+
| [`declarations/role-declared`](docs/rules/declarations-role-declared.fr.md) | `ddd-ts-kit/declarations-role-declared` | style déclaré seulement : un fichier de rôle exporte une classe portant le décorateur de son rôle, le `consumer` et le `name` d'une déclaration sont des chaînes littérales, `domain/` ne porte aucun décorateur de déclaration | `error` | maison |
|
|
260
261
|
| [`declarations/constructor-injection`](docs/rules/declarations-constructor-injection.fr.md) | `ddd-ts-kit/declarations-constructor-injection` | style déclaré seulement : une classe dont le décorateur ne liste aucune dépendance type chaque paramètre de son constructeur par une classe, sans `?`, valeur par défaut, paramètre rest ni déstructuration ; sous `stack.dependencies: signature`, un décorateur ne porte aucune liste (une liste qui répète le constructeur est retirée par la correction, une liste qui en diffère est signalée) | `error` | maison |
|
|
261
262
|
| [`ports/abstract-class`](docs/rules/ports-abstract-class.fr.md) | `ddd-ts-kit/ports-abstract-class` | un port (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`) est une classe abstraite aux seuls membres abstraits, jamais une interface | `error` | maison |
|
|
262
263
|
| [`ports/implements-never-extends`](docs/rules/ports-implements-never-extends.fr.md) | `ddd-ts-kit/ports-implements-never-extends` | un adaptateur (`@Repository`, `@Gateway`, `@Adapter`, `bind(Port).toClass(Class)`) implémente son port et ne l'étend jamais | `error` | maison |
|
|
@@ -302,9 +303,9 @@ signalé.
|
|
|
302
303
|
|
|
303
304
|
Un décorateur est lu dans l'arbre syntaxique et compte quand son nom est importé de
|
|
304
305
|
`@ddd-ts-kit/kernel/declarations` dans le fichier, y compris sous un alias
|
|
305
|
-
(`{ Repository as Repo }`) ou un espace de noms (`declarations.Repository`).
|
|
306
|
-
regardent une classe d'un autre fichier (le message qu'enregistre un module,
|
|
307
|
-
|
|
306
|
+
(`{ Repository as Repo }`) ou un espace de noms (`declarations.Repository`). Deux vérifications
|
|
307
|
+
regardent une classe d'un autre fichier (le message qu'enregistre un module, la classe donnée à
|
|
308
|
+
`toClass`) : l'import est résolu comme tout autre, le
|
|
308
309
|
fichier est lu sur le disque et analysé sans types, et rien n'est conclu quand cela échoue.
|
|
309
310
|
`stack.assembly` (`barrel` ou `discovery`) est lu avec le style ; aucune règle de ce plugin n'en
|
|
310
311
|
dépend, puisque le barrel est un fait du projet que tient `ddd-ts-kit check`
|
|
@@ -419,7 +420,7 @@ propres noms de règle.
|
|
|
419
420
|
| Préoccupation | Autorité | Pourquoi |
|
|
420
421
|
|---|---|---|
|
|
421
422
|
| imports et frontières (`layer/*`, `context/published-language-only`, `context/declared-relationship`, `context/published-language-is-a-contract`), `purity/*`, `clean/*`, `test/no-mocks`, `events/name-format`, `domain/*`, `application/*`, le côté code de `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` sur une classe déclarée, `event-sourcing/*` (sauf le verrou de `event-sourcing/upcaster-required`), `standard/no-parallel-interface`, `declarations/role-declared`, `ports/*`, `scheduling/*` (sauf l'unicité des noms de *jobs*), `language/declared-vocabulary`, `errors/through-factory`, `errors/constructor-not-public`, `errors/factory-name`, `presentation/*`, `lifecycle/*`, `process/*`, `schema/presentation-only`, `imports/alias-only`, `imports/extension` et `governance/recorded-deviation` | ce plugin | il lit l'arbre syntaxique : aucun faux positif dû à une chaîne ou à un commentaire, le masquage de variables et les fonctions fléchées sont compris |
|
|
422
|
-
| l'arborescence (`tree/closed`, `tree/context-doc`), les noms et les fichiers (`naming
|
|
423
|
+
| l'arborescence (`tree/closed`, `tree/context-doc`), les noms et les fichiers (`naming/*` hormis le côté code de `naming/business-name`, que ce plugin lit sur l'arbre syntaxique et corrige, `test/spec-required`, `test/builder-required`), le langage (`language/glossary-term`, `language/no-technical-name`), les codes d'erreur (`errors/code-unique`, `errors/known-code`), `imports/alias-declared`, `schema/no-duplicate-shape`, la config (`config/*`, `context/no-cycle`), `events/defined-in-published-language`, `composition/only-in-module`, `declarations/barrel-current`, l'unicité des noms de consommateurs et de *jobs*, une seule classe déclarée par fichier de rôle, de `domain-events/transactional-before-commit` les adaptateurs d'un port de `application/ports/` et la phase d'un gestionnaire du style explicite, le côté config des identifiants ci-dessus (`stack.events`, sévérités abaissées, existence d'un enregistrement de décision) | `ddd-ts-kit check` | ils jugent le projet, le glossaire et des fichiers qui ne sont pas des sources ; ESLint juge une source à la fois |
|
|
423
424
|
| le vrai graphe des dépendances (barrels, cycles, orphelins, dépendances de développement dans le code de production) | dependency-cruiser, configuré par le `.dependency-cruiser.cjs` que `ddd-ts-kit depcruise-config --write` génère à partir de la config | il résout les modules au lieu de classer des chemins |
|
|
424
425
|
|
|
425
426
|
La CLI continue d'approcher les règles de niveau code par des expressions régulières, sans
|
package/README.md
CHANGED
|
@@ -202,6 +202,7 @@ is an error whatever the configured limit). `strict` sets every rule to `error`.
|
|
|
202
202
|
| [`context/declared-relationship`](docs/rules/context-declared-relationship.md) | `ddd-ts-kit/context-declared-relationship` | such an import needs the upstream declared in the config | `error` | custom |
|
|
203
203
|
| [`context/published-language-is-a-contract`](docs/rules/context-published-language-is-a-contract.md) | `ddd-ts-kit/context-published-language-is-a-contract` | `published-language/` imports only its allow-list and other published languages | `error` | custom |
|
|
204
204
|
| [`language/declared-vocabulary`](docs/rules/language-declared-vocabulary.md) | `ddd-ts-kit/language-declared-vocabulary` | a value of a closed vocabulary the project declares (an object `as const` with the union type of its name, a permission set) is read through it, never written again as a string, under `"stack.literals": "named"`; tests and published languages excluded | `error` | custom |
|
|
205
|
+
| [`naming/business-name`](docs/rules/naming-business-name.md) | `ddd-ts-kit/naming-business-name` | a variable, parameter, property, destructured or loop binding of `domain/`, `application/` and the shared kernel is named after its concept, never `target`, `data`, `item` or another generic word (`words`, `allow`, `businessNames` of the config); fixable where the initializer names the concept | `error` | custom |
|
|
205
206
|
| [`purity/no-system-clock`](docs/rules/purity-no-system-clock.md) | `ddd-ts-kit/purity-no-system-clock` | no `new Date()`, `Date.now()`, `Date()`, `performance.now()` in `domain/` and `application/` | `error` | custom |
|
|
206
207
|
| [`purity/no-ambient-randomness`](docs/rules/purity-no-ambient-randomness.md) | `ddd-ts-kit/purity-no-ambient-randomness` | no `Math.random`, `crypto.randomUUID`, id library in `domain/` and `application/` | `error` | custom |
|
|
207
208
|
| [`purity/no-environment`](docs/rules/purity-no-environment.md) | `ddd-ts-kit/purity-no-environment` | no `process.env`, `console`, `fetch`, file system or network module in `domain/` and `application/` | `error` | custom |
|
|
@@ -252,7 +253,7 @@ is an error whatever the configured limit). `strict` sets every rule to `error`.
|
|
|
252
253
|
| [`tracing/platform-only`](docs/rules/tracing-platform-only.md) | `ddd-ts-kit/tracing-platform-only` | `@ddd-ts-kit/tracing` and `@opentelemetry/*` are imported only by the platform directory, `main.ts` and `apps/` | `error` | custom |
|
|
253
254
|
| [`standard/no-parallel-interface`](docs/rules/standard-no-parallel-interface.md) | `ddd-ts-kit/standard-no-parallel-interface` | no declared `ILogger`, `UserContext`, `PaginatedResult`, `CronJob`, `ErrorTracker` and the like next to the standard interfaces of the kernel (`standardInterfaces` in the config) | `warn` | custom |
|
|
254
255
|
| [`governance/recorded-deviation`](docs/rules/governance-recorded-deviation.md) | `ddd-ts-kit/governance-recorded-deviation` | every suppression names its rules and points to `ADR-<number>` after `--` | `error` | custom |
|
|
255
|
-
| [`declarations/role-declared`](docs/rules/declarations-role-declared.md) | `ddd-ts-kit/declarations-role-declared` | declared style only: a role file exports a class carrying the decorator of its role, the `consumer` and `name` of a declaration are string literals,
|
|
256
|
+
| [`declarations/role-declared`](docs/rules/declarations-role-declared.md) | `ddd-ts-kit/declarations-role-declared` | declared style only: a role file exports a class carrying the decorator of its role, the `consumer` and `name` of a declaration are string literals, `domain/` carries no declaration decorator | `error` | custom |
|
|
256
257
|
| [`declarations/constructor-injection`](docs/rules/declarations-constructor-injection.md) | `ddd-ts-kit/declarations-constructor-injection` | declared style only: a class whose decorator lists no dependency types each constructor parameter by one class, with no `?`, default value, rest or destructuring; under `stack.dependencies: signature` a decorator carries no list (a list that repeats the constructor is removed by the fix, one that differs is reported) | `error` | custom |
|
|
257
258
|
| [`ports/abstract-class`](docs/rules/ports-abstract-class.md) | `ddd-ts-kit/ports-abstract-class` | a port (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`) is an abstract class with abstract members only, never an interface | `error` | custom |
|
|
258
259
|
| [`ports/implements-never-extends`](docs/rules/ports-implements-never-extends.md) | `ddd-ts-kit/ports-implements-never-extends` | an adapter (`@Repository`, `@Gateway`, `@Adapter`, `bind(Port).toClass(Class)`) implements its port and never extends it | `error` | custom |
|
|
@@ -296,8 +297,8 @@ so a module that registers it without `.requires(...)` or `.public()` is not rep
|
|
|
296
297
|
|
|
297
298
|
A decorator is read from the syntax tree and counts when its name is imported from
|
|
298
299
|
`@ddd-ts-kit/kernel/declarations` in the file, under an alias (`{ Repository as Repo }`) or a
|
|
299
|
-
namespace (`declarations.Repository`) too.
|
|
300
|
-
message a module registers, the
|
|
300
|
+
namespace (`declarations.Repository`) too. Two checks look at a class of another file (the
|
|
301
|
+
message a module registers, the class given to `toClass`): the import is resolved
|
|
301
302
|
like any other, the file is read from disk and parsed without types, and nothing is concluded
|
|
302
303
|
when it cannot be. `stack.assembly` (`barrel` or `discovery`) is read with the style; no rule of
|
|
303
304
|
this plugin depends on it, since the barrel is a fact of the project that `ddd-ts-kit check`
|
|
@@ -409,7 +410,7 @@ config: it runs on a file generated from it, with its own rule names.
|
|
|
409
410
|
| Concern | Authority | Why |
|
|
410
411
|
|---|---|---|
|
|
411
412
|
| 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
|
|
413
|
+
| the tree (`tree/closed`, `tree/context-doc`), names and files (`naming/*` but the code side of `naming/business-name`, which this plugin reads on the syntax tree and fixes, `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 |
|
|
413
414
|
| 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 |
|
|
414
415
|
|
|
415
416
|
The CLI keeps approximating the code-level rules with regular expressions, without dependency:
|
package/dist/project/config.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ export interface AllowedFile {
|
|
|
42
42
|
export interface OnePerFile {
|
|
43
43
|
readonly allow: readonly AllowedFile[];
|
|
44
44
|
}
|
|
45
|
+
/** The generic words `naming/business-name` reports: `words` replaces its list, `allow` removes some of them. */
|
|
46
|
+
export interface BusinessNames {
|
|
47
|
+
/** Undefined: the default list of the rule. */
|
|
48
|
+
readonly words: readonly string[] | undefined;
|
|
49
|
+
readonly allow: readonly string[];
|
|
50
|
+
}
|
|
45
51
|
export interface Config {
|
|
46
52
|
readonly sourceRoot: string;
|
|
47
53
|
readonly contextsDir: string;
|
|
@@ -61,6 +67,8 @@ export interface Config {
|
|
|
61
67
|
readonly stack: Stack;
|
|
62
68
|
/** Names reported by `standard/no-parallel-interface`, over its defaults: the kernel interface to use instead, or `false` to drop a default. */
|
|
63
69
|
readonly standardInterfaces: Readonly<Record<string, string | false>>;
|
|
70
|
+
/** The words of `naming/business-name`, over its defaults, as the checker reads them. */
|
|
71
|
+
readonly businessNames: BusinessNames;
|
|
64
72
|
/** The clients generated from the contract (`ddd-ts-kit sdk`), whose sources under `clients/` are not linted; none without the key. */
|
|
65
73
|
readonly sdk: SdkConfig | undefined;
|
|
66
74
|
}
|
|
@@ -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,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,EAAE,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5C,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,WAAW,KAAK;IACpB,qIAAqI;IACrI,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,iHAAiH;IACjH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,yJAAyJ;IACzJ,QAAQ,CAAC,YAAY,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC9C,+IAA+I;IAC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E,MAAM,CAAC;IAC7B,8GAA8G;IAC9G,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,QAAQ,CAAC,0BAA0B,EAAE,SAAS,MAAM,EAAE,CAAC;IACvD,QAAQ,CAAC,gCAAgC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kGAAkG;IAClG,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,gJAAgJ;IAChJ,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;IACtE,yFAAyF;IACzF,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,uIAAuI;IACvI,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,CAAC;CACrC;AAED,uGAAuG;AACvG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-config.d.ts","sourceRoot":"","sources":["../../src/project/parse-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"parse-config.d.ts","sourceRoot":"","sources":["../../src/project/parse-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EASV,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,CA2BhD"}
|
|
@@ -48,9 +48,22 @@ export function parseConfig(raw) {
|
|
|
48
48
|
onePerFile: parseOnePerFile(source['onePerFile']),
|
|
49
49
|
stack: parseStack(source['stack']),
|
|
50
50
|
standardInterfaces: parseStandardInterfaces(source['standardInterfaces']),
|
|
51
|
+
businessNames: parseBusinessNames(source['businessNames']),
|
|
51
52
|
sdk: parseSdk(source['sdk']),
|
|
52
53
|
};
|
|
53
54
|
}
|
|
55
|
+
/** As in the CLI: an entry that is not a word is left out, and a `words` that is not a list keeps the defaults. */
|
|
56
|
+
function parseBusinessNames(value) {
|
|
57
|
+
const raw = isRecord(value) ? value : {};
|
|
58
|
+
const words = raw['words'];
|
|
59
|
+
return {
|
|
60
|
+
words: Array.isArray(words) ? wordsOf(words) : undefined,
|
|
61
|
+
allow: Array.isArray(raw['allow']) ? wordsOf(raw['allow']) : [],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function wordsOf(entries) {
|
|
65
|
+
return entries.filter((entry) => typeof entry === 'string' && entry.trim() !== '');
|
|
66
|
+
}
|
|
54
67
|
/** A key that is not an object asks for no client, as in the CLI. */
|
|
55
68
|
function parseSdk(value) {
|
|
56
69
|
return isRecord(value) ? { name: text(value['name'], DEFAULT_SDK_NAME) } : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-config.js","sourceRoot":"","sources":["../../src/project/parse-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-config.js","sourceRoot":"","sources":["../../src/project/parse-config.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,cAAc,GA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 'undeclared' | 'wrongRole' | 'name' | '
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type MessageId = 'undeclared' | 'wrongRole' | 'name' | 'inDomain';
|
|
3
3
|
export declare const declarationsRoleDeclared: TSESLint.RuleModule<MessageId, [], import("../index.js").RuleDocs, TSESLint.RuleListener>;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=declarations-role-declared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-role-declared.d.ts","sourceRoot":"","sources":["../../src/rules/declarations-role-declared.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"declarations-role-declared.d.ts","sourceRoot":"","sources":["../../src/rules/declarations-role-declared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,0BAA0B,CAAC;AAmBnE,KAAK,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAGlE,eAAO,MAAM,wBAAwB,2FA6CnC,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
1
|
import { className } from '../support/classes/class-name.js';
|
|
3
2
|
import { exportedClasses } from '../support/classes/exported-classes.js';
|
|
4
|
-
import { keyName } from '../support/classes/key-name.js';
|
|
5
3
|
import { topLevelClasses } from '../support/classes/top-level-classes.js';
|
|
6
4
|
import { ACCESS_DECORATORS } from '../support/declarations/access-decorators.js';
|
|
7
5
|
import { DECLARATIONS_ENTRY, declarationReader, } from '../support/declarations/declaration-reader.js';
|
|
@@ -9,11 +7,8 @@ import { WRITTEN_NAMES } from '../support/declarations/written-names.js';
|
|
|
9
7
|
import { declaredRoleOf } from '../support/declarations/declared-role-of.js';
|
|
10
8
|
import { isDeclaredStyle } from '../support/declarations/is-declared-style.js';
|
|
11
9
|
import { writtenName } from '../support/declarations/written-name.js';
|
|
12
|
-
import { propertyOf } from '../support/calls/property-of.js';
|
|
13
10
|
import { defineRule } from '../support/rule/define-rule.js';
|
|
14
11
|
import { inContext } from '../support/imports/in-context.js';
|
|
15
|
-
import { staticString } from '../support/imports/static-string.js';
|
|
16
|
-
import { classFinder } from '../support/classes/class-finder.js';
|
|
17
12
|
export const declarationsRoleDeclared = defineRule({
|
|
18
13
|
id: 'declarations/role-declared',
|
|
19
14
|
type: 'problem',
|
|
@@ -22,11 +17,10 @@ export const declarationsRoleDeclared = defineRule({
|
|
|
22
17
|
messages: {
|
|
23
18
|
undeclared: `This file is a role file of the declared style (\`*.{{suffix}}.ts\` under {{folder}}/) but exports no class carrying \`@{{expected}}\`. Put \`@{{expected}}(...)\` from "${DECLARATIONS_ENTRY}" on the exported class: a class that does not say what it is is in no assembly and is never registered.`,
|
|
24
19
|
wrongRole: '{{className}} carries `@{{actual}}` in a `*.{{suffix}}.ts` file under {{folder}}/, where a class is declared with `@{{expected}}`. Move the class to the file of its role, or declare it with `@{{expected}}(...)`: the file name, the folder and the decorator say the same thing.',
|
|
25
|
-
name: "`@{{decorator}}` of {{className}} has a `{{key}}` that is {{problem}}. Write `{ {{key}}: '{{context}}.<name>' }` as a string literal
|
|
26
|
-
eventName: '`@DomainEventHandler` of {{className}} names "{{declared}}", but {{event}} is named "{{actual}}". Write `{ name: \'{{actual}}\' }`: a handler names the domain event it reacts to by the name the event carries.',
|
|
20
|
+
name: "`@{{decorator}}` of {{className}} has a `{{key}}` that is {{problem}}. Write `{ {{key}}: '{{context}}.<name>' }` as a string literal: the name is written once and survives the renaming of the class.",
|
|
27
21
|
inDomain: '{{className}} carries `@{{decorator}}` under domain/: the domain declares nothing. Aggregates, entities, value objects, events, services and repository ports carry no decorator and no dependency list. Remove the decorator and declare the class of application/ or infrastructure/ that plays the role.',
|
|
28
22
|
},
|
|
29
|
-
create({ file, sourceCode,
|
|
23
|
+
create({ file, sourceCode, report }) {
|
|
30
24
|
const here = inContext(file);
|
|
31
25
|
if (here === undefined || file.isTest || !isDeclaredStyle(file)) {
|
|
32
26
|
return {};
|
|
@@ -35,11 +29,10 @@ export const declarationsRoleDeclared = defineRule({
|
|
|
35
29
|
if (here.layer === 'domain') {
|
|
36
30
|
return domain(declarationsOf, report);
|
|
37
31
|
}
|
|
38
|
-
const findClass = classFinder(file, sourceCode.ast, context.languageOptions.parser);
|
|
39
32
|
const role = declaredRoleOf(file);
|
|
40
33
|
const judgeClass = (node) => {
|
|
41
34
|
for (const declaration of declarationsOf(node)) {
|
|
42
|
-
const finding = unwrittenName(node, declaration, here.context)
|
|
35
|
+
const finding = unwrittenName(node, declaration, here.context);
|
|
43
36
|
if (finding !== undefined) {
|
|
44
37
|
report(finding);
|
|
45
38
|
}
|
|
@@ -95,7 +88,7 @@ function misdeclaredRole(program, role, declarationsOf) {
|
|
|
95
88
|
function unwrittenName(node, declaration, context) {
|
|
96
89
|
const key = WRITTEN_NAMES[declaration.name];
|
|
97
90
|
const written = key === undefined ? undefined : writtenName(declaration.arguments[1], key);
|
|
98
|
-
if (key === undefined || written === undefined || 'value' in written
|
|
91
|
+
if (key === undefined || written === undefined || 'value' in written) {
|
|
99
92
|
return undefined;
|
|
100
93
|
}
|
|
101
94
|
return {
|
|
@@ -104,61 +97,4 @@ function unwrittenName(node, declaration, context) {
|
|
|
104
97
|
data: { decorator: declaration.name, className: className(node), key, problem: written.problem, context },
|
|
105
98
|
};
|
|
106
99
|
}
|
|
107
|
-
/** Compared only when the event class is in view: declared in this file, or imported by name from a file read from disk. */
|
|
108
|
-
function renamedEvent(node, declaration, findClass) {
|
|
109
|
-
const [event, options] = declaration.arguments;
|
|
110
|
-
if (declaration.name !== 'DomainEventHandler' || event?.type !== AST_NODE_TYPES.Identifier) {
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
113
|
-
const declared = writtenName(options, 'name');
|
|
114
|
-
const site = findClass(event.name);
|
|
115
|
-
const actual = site === undefined ? undefined : eventName(site.node);
|
|
116
|
-
if (!('value' in declared) || actual === undefined || actual === declared.value) {
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
node: declaration.node,
|
|
121
|
-
messageId: 'eventName',
|
|
122
|
-
data: { className: className(node), declared: declared.value, event: event.name, actual },
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
/** `@DomainEventHandler(InvoiceIssued, { name: InvoiceIssued.eventName })`: the name the event class declares, read where it is written. */
|
|
126
|
-
function readsEventName(declaration) {
|
|
127
|
-
const [event, options] = declaration.arguments;
|
|
128
|
-
const property = options?.type === AST_NODE_TYPES.ObjectExpression ? propertyOf(options, 'name') : undefined;
|
|
129
|
-
return (declaration.name === 'DomainEventHandler' &&
|
|
130
|
-
event?.type === AST_NODE_TYPES.Identifier &&
|
|
131
|
-
property !== undefined &&
|
|
132
|
-
memberName(property.value) === `${event.name}.eventName`);
|
|
133
|
-
}
|
|
134
|
-
/** `InvoiceIssued.eventName` for a member read on a name; undefined for anything else. */
|
|
135
|
-
function memberName(node) {
|
|
136
|
-
if (node.type !== AST_NODE_TYPES.MemberExpression || node.computed) {
|
|
137
|
-
return undefined;
|
|
138
|
-
}
|
|
139
|
-
const { object, property } = node;
|
|
140
|
-
return object.type === AST_NODE_TYPES.Identifier && property.type === AST_NODE_TYPES.Identifier
|
|
141
|
-
? `${object.name}.${property.name}`
|
|
142
|
-
: undefined;
|
|
143
|
-
}
|
|
144
|
-
/** `static readonly eventName = 'billing.invoice.issued';`, or `readonly name = '..'` as 0.5 wrote it, with or without `as const`. */
|
|
145
|
-
function eventName(event) {
|
|
146
|
-
for (const member of event.body.body) {
|
|
147
|
-
const written = member.type === AST_NODE_TYPES.PropertyDefinition &&
|
|
148
|
-
!member.computed &&
|
|
149
|
-
['name', 'eventName'].includes(keyName(member.key) ?? '')
|
|
150
|
-
? member.value
|
|
151
|
-
: null;
|
|
152
|
-
const value = written === null ? undefined : staticString(unwrapped(written));
|
|
153
|
-
if (value !== undefined) {
|
|
154
|
-
return value;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return undefined;
|
|
158
|
-
}
|
|
159
|
-
function unwrapped(value) {
|
|
160
|
-
return value.type === AST_NODE_TYPES.TSAsExpression || value.type === AST_NODE_TYPES.TSSatisfiesExpression
|
|
161
|
-
? unwrapped(value.expression)
|
|
162
|
-
: value;
|
|
163
|
-
}
|
|
164
100
|
//# sourceMappingURL=declarations-role-declared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-role-declared.js","sourceRoot":"","sources":["../../src/rules/declarations-role-declared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations-role-declared.js","sourceRoot":"","sources":["../../src/rules/declarations-role-declared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAkB,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAGlB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAK7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAY;IAC5D,EAAE,EAAE,4BAA4B;IAChC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,OAAO;IACpB,WAAW,EACT,qKAAqK;IACvK,QAAQ,EAAE;QACR,UAAU,EAA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O,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAE3F,IAAI,GAAG,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE;KAC1G,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import { type BusinessNameOptions } from '../support/business-names/words-of.js';
|
|
3
|
+
type Options = [BusinessNameOptions];
|
|
4
|
+
export declare const namingBusinessName: TSESLint.RuleModule<"generic", Options, import("../index.js").RuleDocs, TSESLint.RuleListener>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=naming-business-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming-business-name.d.ts","sourceRoot":"","sources":["../../src/rules/naming-business-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAkBxF,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAI1F,KAAK,OAAO,GAAG,CAAC,mBAAmB,CAAC,CAAC;AA0BrC,eAAO,MAAM,kBAAkB,gGA+B7B,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { bindingAdvice } from '../support/business-names/binding-advice.js';
|
|
3
|
+
import { builtClass } from '../support/business-names/built-class.js';
|
|
4
|
+
import { camel } from '../support/business-names/camel.js';
|
|
5
|
+
import { collectionElement } from '../support/business-names/collection-element.js';
|
|
6
|
+
import { calledMember } from '../support/business-names/called-member.js';
|
|
7
|
+
import { conventionalModelName } from '../support/business-names/conventional-model-name.js';
|
|
8
|
+
import { isNameFree } from '../support/business-names/is-name-free.js';
|
|
9
|
+
import { judgesNames } from '../support/business-names/judges-names.js';
|
|
10
|
+
import { patternIdentifiers } from '../support/business-names/pattern-identifiers.js';
|
|
11
|
+
import { plural } from '../support/business-names/plural.js';
|
|
12
|
+
import { renameFix } from '../support/business-names/rename-fix.js';
|
|
13
|
+
import { repositoryConcept } from '../support/business-names/repository-concept.js';
|
|
14
|
+
import { singular } from '../support/business-names/singular.js';
|
|
15
|
+
import { typedNames } from '../support/business-names/typed-names.js';
|
|
16
|
+
import { wordsOf } from '../support/business-names/words-of.js';
|
|
17
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
18
|
+
/** Everything that declares parameters: functions, methods, abstract and overload signatures, function types. */
|
|
19
|
+
const WITH_PARAMETERS = [
|
|
20
|
+
'FunctionDeclaration',
|
|
21
|
+
'FunctionExpression',
|
|
22
|
+
'ArrowFunctionExpression',
|
|
23
|
+
'TSDeclareFunction',
|
|
24
|
+
'TSEmptyBodyFunctionExpression',
|
|
25
|
+
'TSMethodSignature',
|
|
26
|
+
'TSFunctionType',
|
|
27
|
+
'TSCallSignatureDeclaration',
|
|
28
|
+
'TSConstructSignatureDeclaration',
|
|
29
|
+
'TSConstructorType',
|
|
30
|
+
].join(', ');
|
|
31
|
+
export const namingBusinessName = defineRule({
|
|
32
|
+
id: 'naming/business-name',
|
|
33
|
+
type: 'suggestion',
|
|
34
|
+
fixable: 'code',
|
|
35
|
+
recommended: 'error',
|
|
36
|
+
description: 'A variable, parameter, property, destructured or loop binding of domain/ and application/ (and of the shared kernel) is named after the concept it holds, never a generic word such as target, data or item.',
|
|
37
|
+
messages: {
|
|
38
|
+
generic: 'The {{kind}} `{{name}}` is named with a generic word: the code of the model speaks the ubiquitous language of its context, and `{{name}}` hides which concept it holds. {{advice}}',
|
|
39
|
+
},
|
|
40
|
+
schema: [
|
|
41
|
+
{
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
words: { type: 'array', items: { type: 'string' } },
|
|
45
|
+
allow: { type: 'array', items: { type: 'string' } },
|
|
46
|
+
},
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
defaultOptions: [{}],
|
|
51
|
+
create({ context, file, options, report }) {
|
|
52
|
+
const words = wordsOf(file.config, options[0]);
|
|
53
|
+
if (words.size === 0 || !judgesNames(file)) {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
return listeners({ context, file, words, report, typed: typedNames(context, file) });
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
/** Every place a name is bound: declarators, parameter lists, class properties and the properties of a declared shape. */
|
|
60
|
+
function listeners(judged) {
|
|
61
|
+
return {
|
|
62
|
+
VariableDeclarator(node) {
|
|
63
|
+
if (node.id.type === AST_NODE_TYPES.Identifier) {
|
|
64
|
+
judgeVariable(judged, node, node.id);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
for (const identifier of patternIdentifiers(node.id)) {
|
|
68
|
+
judgeName(judged, identifier, 'destructured binding');
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
[WITH_PARAMETERS](node) {
|
|
72
|
+
for (const parameter of node.params) {
|
|
73
|
+
for (const identifier of patternIdentifiers(parameter)) {
|
|
74
|
+
judgeName(judged, identifier, parameterKind(parameter));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
'PropertyDefinition, TSAbstractPropertyDefinition'(node) {
|
|
79
|
+
if (!node.computed && node.key.type === AST_NODE_TYPES.Identifier) {
|
|
80
|
+
judgeName(judged, node.key, 'property');
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
TSPropertySignature(node) {
|
|
84
|
+
if (!node.computed && node.key.type === AST_NODE_TYPES.Identifier && declaresAShape(node.parent)) {
|
|
85
|
+
judgeName(judged, node.key, 'property');
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function parameterKind(parameter) {
|
|
91
|
+
if (parameter.type === AST_NODE_TYPES.TSParameterProperty) {
|
|
92
|
+
return 'property';
|
|
93
|
+
}
|
|
94
|
+
const bound = parameter.type === AST_NODE_TYPES.AssignmentPattern ? parameter.left : parameter;
|
|
95
|
+
const named = bound.type === AST_NODE_TYPES.RestElement ? bound.argument : bound;
|
|
96
|
+
return named.type === AST_NODE_TYPES.Identifier ? 'parameter' : 'destructured binding';
|
|
97
|
+
}
|
|
98
|
+
/** An interface, or a type alias of an object: a type literal nested in an annotation is not a declaration of the model. */
|
|
99
|
+
function declaresAShape(body) {
|
|
100
|
+
return (body.type === AST_NODE_TYPES.TSInterfaceBody ||
|
|
101
|
+
(body.type === AST_NODE_TYPES.TSTypeLiteral && body.parent.type === AST_NODE_TYPES.TSTypeAliasDeclaration));
|
|
102
|
+
}
|
|
103
|
+
function judgeName(judged, identifier, kind) {
|
|
104
|
+
if (judged.words.has(identifier.name)) {
|
|
105
|
+
reportName(judged, { identifier, kind, suggestion: undefined, fix: undefined });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function reportName(judged, { identifier, kind, suggestion, fix }) {
|
|
109
|
+
judged.report({
|
|
110
|
+
node: identifier,
|
|
111
|
+
messageId: 'generic',
|
|
112
|
+
data: { kind, name: identifier.name, advice: bindingAdvice(kind, suggestion) },
|
|
113
|
+
...(fix === undefined ? {} : { fix }),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** A variable: renamed when its initializer says which concept it holds and the name is free, reported otherwise. */
|
|
117
|
+
function judgeVariable(judged, declarator, identifier) {
|
|
118
|
+
if (!judged.words.has(identifier.name)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const loop = walkedCollection(declarator);
|
|
122
|
+
if (loop !== undefined) {
|
|
123
|
+
const element = judged.typed?.modelOf(loop)?.element ?? collectionElement(loop);
|
|
124
|
+
reportName(judged, { identifier, kind: 'loop variable', suggestion: element, fix: undefined });
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
reportName(judged, { identifier, kind: 'variable', ...renaming(judged, declarator, identifier) });
|
|
128
|
+
}
|
|
129
|
+
/** The name the initializer of a variable gives to what it holds, and the fix when the variable holds as many as the name says. */
|
|
130
|
+
function renaming(judged, declarator, identifier) {
|
|
131
|
+
const several = singular(identifier.name) !== undefined;
|
|
132
|
+
const proposal = declarator.init === null ? undefined : proposedName(judged, declarator.init, several);
|
|
133
|
+
if (proposal === undefined) {
|
|
134
|
+
return { suggestion: undefined, fix: undefined };
|
|
135
|
+
}
|
|
136
|
+
const name = proposal.many ? plural(proposal.element) : proposal.element;
|
|
137
|
+
return { suggestion: name, fix: proposal.many === several ? safeRename(judged, declarator, name) : undefined };
|
|
138
|
+
}
|
|
139
|
+
/** The renaming of the variable a declarator declares, unless the name is taken where it is used. */
|
|
140
|
+
function safeRename(judged, declarator, name) {
|
|
141
|
+
const variable = judged.context.sourceCode.getDeclaredVariables(declarator)[0];
|
|
142
|
+
return variable !== undefined && isNameFree(variable, name) ? renameFix(variable, name) : undefined;
|
|
143
|
+
}
|
|
144
|
+
/** `due` in `for (const target of due)`. */
|
|
145
|
+
function walkedCollection(declarator) {
|
|
146
|
+
const loop = declarator.parent.parent;
|
|
147
|
+
const walks = (loop.type === AST_NODE_TYPES.ForOfStatement || loop.type === AST_NODE_TYPES.ForInStatement) &&
|
|
148
|
+
loop.left === declarator.parent;
|
|
149
|
+
return walks ? loop.right : undefined;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The concept an initializer holds: the class of the project it builds, or what a repository it
|
|
153
|
+
* reads answers, by its type when the parser has one, by the names of the kit otherwise; for
|
|
154
|
+
* `found ?? X.create(..)`, either side.
|
|
155
|
+
*/
|
|
156
|
+
function proposedName(judged, init, several) {
|
|
157
|
+
if (init.type === AST_NODE_TYPES.LogicalExpression && init.operator === '??') {
|
|
158
|
+
return proposedName(judged, init.right, several) ?? proposedName(judged, init.left, several);
|
|
159
|
+
}
|
|
160
|
+
const built = builtClass(judged.context.sourceCode, judged.file, init);
|
|
161
|
+
if (built !== undefined) {
|
|
162
|
+
return { element: camel(built), many: false };
|
|
163
|
+
}
|
|
164
|
+
const call = calledMember(init);
|
|
165
|
+
if (call === undefined) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
const { typed } = judged;
|
|
169
|
+
if (typed === undefined) {
|
|
170
|
+
return conventionalModelName(call, several);
|
|
171
|
+
}
|
|
172
|
+
const reads = typed.isRepository(call.object) || repositoryConcept(call.object) !== undefined;
|
|
173
|
+
return reads ? typed.modelOf(init) : undefined;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=naming-business-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"naming-business-name.js","sourceRoot":"","sources":["../../src/rules/naming-business-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,WAA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CAAC;IACnB,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAEzB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;IAE9F,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,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;
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/rules/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAgJlE,+HAA+H;AAC/H,eAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEnD,CAAC"}
|
package/dist/rules/rules.js
CHANGED
|
@@ -54,6 +54,7 @@ import { presentationGuardAtTheEdge } from './presentation-guard-at-the-edge.js'
|
|
|
54
54
|
import { presentationSharedCacheVaries } from './presentation-shared-cache-varies.js';
|
|
55
55
|
import { purityNoAmbientRandomness, purityNoEnvironment, purityNoSystemClock } from './purity.js';
|
|
56
56
|
import { lifecycleStatusThroughMachine } from './lifecycle-status-through-machine.js';
|
|
57
|
+
import { namingBusinessName } from './naming-business-name.js';
|
|
57
58
|
import { processSendsCommandsOnly } from './process-sends-commands-only.js';
|
|
58
59
|
import { schedulingJobName } from './scheduling-job-name.js';
|
|
59
60
|
import { schedulingJobTriggersUseCase } from './scheduling-job-triggers-use-case.js';
|
|
@@ -72,6 +73,7 @@ const ALL = [
|
|
|
72
73
|
contextDeclaredRelationship,
|
|
73
74
|
contextPublishedLanguageIsAContract,
|
|
74
75
|
languageDeclaredVocabulary,
|
|
76
|
+
namingBusinessName,
|
|
75
77
|
purityNoSystemClock,
|
|
76
78
|
purityNoAmbientRandomness,
|
|
77
79
|
purityNoEnvironment,
|