@ddd-ts-kit/eslint-plugin 0.0.0-stage → 0.1.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.
- package/README.md +292 -2
- package/dist/ddd-ts-kit.d.ts +5 -0
- package/dist/ddd-ts-kit.d.ts.map +1 -0
- package/dist/ddd-ts-kit.js +7 -0
- package/dist/ddd-ts-kit.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +30 -0
- package/dist/plugin.js.map +1 -0
- package/dist/presets/braces-rules.d.ts +11 -0
- package/dist/presets/braces-rules.d.ts.map +1 -0
- package/dist/presets/braces-rules.js +10 -0
- package/dist/presets/braces-rules.js.map +1 -0
- package/dist/presets/create-ddd-ts-kit.d.ts +21 -0
- package/dist/presets/create-ddd-ts-kit.d.ts.map +1 -0
- package/dist/presets/create-ddd-ts-kit.js +123 -0
- package/dist/presets/create-ddd-ts-kit.js.map +1 -0
- package/dist/presets/flat-rules.d.ts +3 -0
- package/dist/presets/flat-rules.d.ts.map +1 -0
- package/dist/presets/flat-rules.js +2 -0
- package/dist/presets/flat-rules.js.map +1 -0
- package/dist/presets/layout-rules.d.ts +11 -0
- package/dist/presets/layout-rules.d.ts.map +1 -0
- package/dist/presets/layout-rules.js +33 -0
- package/dist/presets/layout-rules.js.map +1 -0
- package/dist/presets/plugin-rule-levels.d.ts +4 -0
- package/dist/presets/plugin-rule-levels.d.ts.map +1 -0
- package/dist/presets/plugin-rule-levels.js +13 -0
- package/dist/presets/plugin-rule-levels.js.map +1 -0
- package/dist/presets/standard-rule-sets.d.ts +12 -0
- package/dist/presets/standard-rule-sets.d.ts.map +1 -0
- package/dist/presets/standard-rule-sets.js +15 -0
- package/dist/presets/standard-rule-sets.js.map +1 -0
- package/dist/presets/standard-rules.d.ts +24 -0
- package/dist/presets/standard-rules.d.ts.map +1 -0
- package/dist/presets/standard-rules.js +88 -0
- package/dist/presets/standard-rules.js.map +1 -0
- package/dist/project/alias-root.d.ts +8 -0
- package/dist/project/alias-root.d.ts.map +1 -0
- package/dist/project/alias-root.js +2 -0
- package/dist/project/alias-root.js.map +1 -0
- package/dist/project/alias-roots.d.ts +9 -0
- package/dist/project/alias-roots.d.ts.map +1 -0
- package/dist/project/alias-roots.js +17 -0
- package/dist/project/alias-roots.js.map +1 -0
- package/dist/project/config-file.d.ts +2 -0
- package/dist/project/config-file.d.ts.map +1 -0
- package/dist/project/config-file.js +2 -0
- package/dist/project/config-file.js.map +1 -0
- package/dist/project/config.d.ts +53 -0
- package/dist/project/config.d.ts.map +1 -0
- package/dist/project/config.js +2 -0
- package/dist/project/config.js.map +1 -0
- package/dist/project/configured-severity.d.ts +3 -0
- package/dist/project/configured-severity.d.ts.map +1 -0
- package/dist/project/configured-severity.js +5 -0
- package/dist/project/configured-severity.js.map +1 -0
- package/dist/project/describe-linted-file.d.ts +4 -0
- package/dist/project/describe-linted-file.d.ts.map +1 -0
- package/dist/project/describe-linted-file.js +38 -0
- package/dist/project/describe-linted-file.js.map +1 -0
- package/dist/project/find-project.d.ts +4 -0
- package/dist/project/find-project.d.ts.map +1 -0
- package/dist/project/find-project.js +37 -0
- package/dist/project/find-project.js.map +1 -0
- package/dist/project/is-record.d.ts +2 -0
- package/dist/project/is-record.d.ts.map +1 -0
- package/dist/project/is-record.js +4 -0
- package/dist/project/is-record.js.map +1 -0
- package/dist/project/is-test-file.d.ts +3 -0
- package/dist/project/is-test-file.d.ts.map +1 -0
- package/dist/project/is-test-file.js +4 -0
- package/dist/project/is-test-file.js.map +1 -0
- package/dist/project/layer.d.ts +2 -0
- package/dist/project/layer.d.ts.map +1 -0
- package/dist/project/layer.js +2 -0
- package/dist/project/layer.js.map +1 -0
- package/dist/project/lint-host.d.ts +6 -0
- package/dist/project/lint-host.d.ts.map +1 -0
- package/dist/project/lint-host.js +2 -0
- package/dist/project/lint-host.js.map +1 -0
- package/dist/project/linted-file.d.ts +13 -0
- package/dist/project/linted-file.d.ts.map +1 -0
- package/dist/project/linted-file.js +2 -0
- package/dist/project/linted-file.js.map +1 -0
- package/dist/project/locate.d.ts +5 -0
- package/dist/project/locate.d.ts.map +1 -0
- package/dist/project/locate.js +47 -0
- package/dist/project/locate.js.map +1 -0
- package/dist/project/location.d.ts +11 -0
- package/dist/project/location.d.ts.map +1 -0
- package/dist/project/location.js +2 -0
- package/dist/project/location.js.map +1 -0
- package/dist/project/parse-allowed-file.d.ts +4 -0
- package/dist/project/parse-allowed-file.d.ts.map +1 -0
- package/dist/project/parse-allowed-file.js +11 -0
- package/dist/project/parse-allowed-file.js.map +1 -0
- package/dist/project/parse-config.d.ts +10 -0
- package/dist/project/parse-config.d.ts.map +1 -0
- package/dist/project/parse-config.js +113 -0
- package/dist/project/parse-config.js.map +1 -0
- package/dist/project/plugin-settings.d.ts +8 -0
- package/dist/project/plugin-settings.d.ts.map +1 -0
- package/dist/project/plugin-settings.js +2 -0
- package/dist/project/plugin-settings.js.map +1 -0
- package/dist/project/posix.d.ts +2 -0
- package/dist/project/posix.d.ts.map +1 -0
- package/dist/project/posix.js +4 -0
- package/dist/project/posix.js.map +1 -0
- package/dist/project/resolve-import.d.ts +15 -0
- package/dist/project/resolve-import.d.ts.map +1 -0
- package/dist/project/resolve-import.js +32 -0
- package/dist/project/resolve-import.js.map +1 -0
- package/dist/project/to-alias.d.ts +7 -0
- package/dist/project/to-alias.d.ts.map +1 -0
- package/dist/project/to-alias.js +13 -0
- package/dist/project/to-alias.js.map +1 -0
- package/dist/project/to-posix.d.ts +2 -0
- package/dist/project/to-posix.d.ts.map +1 -0
- package/dist/project/to-posix.js +5 -0
- package/dist/project/to-posix.js.map +1 -0
- package/dist/rules/application-command-query-separation.d.ts +6 -0
- package/dist/rules/application-command-query-separation.d.ts.map +1 -0
- package/dist/rules/application-command-query-separation.js +49 -0
- package/dist/rules/application-command-query-separation.js.map +1 -0
- package/dist/rules/application-handler-shape.d.ts +4 -0
- package/dist/rules/application-handler-shape.d.ts.map +1 -0
- package/dist/rules/application-handler-shape.js +51 -0
- package/dist/rules/application-handler-shape.js.map +1 -0
- package/dist/rules/aspects-outside-in.d.ts +2 -0
- package/dist/rules/aspects-outside-in.d.ts.map +1 -0
- package/dist/rules/aspects-outside-in.js +45 -0
- package/dist/rules/aspects-outside-in.js.map +1 -0
- package/dist/rules/authz-actor-explicit.d.ts +5 -0
- package/dist/rules/authz-actor-explicit.d.ts.map +1 -0
- package/dist/rules/authz-actor-explicit.js +106 -0
- package/dist/rules/authz-actor-explicit.js.map +1 -0
- package/dist/rules/authz-declared.d.ts +5 -0
- package/dist/rules/authz-declared.d.ts.map +1 -0
- package/dist/rules/authz-declared.js +167 -0
- package/dist/rules/authz-declared.js.map +1 -0
- package/dist/rules/authz-in-application.d.ts +5 -0
- package/dist/rules/authz-in-application.d.ts.map +1 -0
- package/dist/rules/authz-in-application.js +202 -0
- package/dist/rules/authz-in-application.js.map +1 -0
- package/dist/rules/clean-file-size.d.ts +2 -0
- package/dist/rules/clean-file-size.d.ts.map +1 -0
- package/dist/rules/clean-file-size.js +25 -0
- package/dist/rules/clean-file-size.js.map +1 -0
- package/dist/rules/clean-function-ceiling.d.ts +6 -0
- package/dist/rules/clean-function-ceiling.d.ts.map +1 -0
- package/dist/rules/clean-function-ceiling.js +32 -0
- package/dist/rules/clean-function-ceiling.js.map +1 -0
- package/dist/rules/clean-function-size.d.ts +7 -0
- package/dist/rules/clean-function-size.d.ts.map +1 -0
- package/dist/rules/clean-function-size.js +70 -0
- package/dist/rules/clean-function-size.js.map +1 -0
- package/dist/rules/clean-no-commented-out-code.d.ts +3 -0
- package/dist/rules/clean-no-commented-out-code.d.ts.map +1 -0
- package/dist/rules/clean-no-commented-out-code.js +60 -0
- package/dist/rules/clean-no-commented-out-code.js.map +1 -0
- package/dist/rules/clean-no-escape-hatch.d.ts +15 -0
- package/dist/rules/clean-no-escape-hatch.d.ts.map +1 -0
- package/dist/rules/clean-no-escape-hatch.js +116 -0
- package/dist/rules/clean-no-escape-hatch.js.map +1 -0
- package/dist/rules/clean-no-flag-argument.d.ts +2 -0
- package/dist/rules/clean-no-flag-argument.d.ts.map +1 -0
- package/dist/rules/clean-no-flag-argument.js +80 -0
- package/dist/rules/clean-no-flag-argument.js.map +1 -0
- package/dist/rules/clean-no-hash-private.d.ts +2 -0
- package/dist/rules/clean-no-hash-private.d.ts.map +1 -0
- package/dist/rules/clean-no-hash-private.js +36 -0
- package/dist/rules/clean-no-hash-private.js.map +1 -0
- package/dist/rules/clean-no-noise-comment.d.ts +5 -0
- package/dist/rules/clean-no-noise-comment.d.ts.map +1 -0
- package/dist/rules/clean-no-noise-comment.js +187 -0
- package/dist/rules/clean-no-noise-comment.js.map +1 -0
- package/dist/rules/clean-one-export-per-file.d.ts +10 -0
- package/dist/rules/clean-one-export-per-file.d.ts.map +1 -0
- package/dist/rules/clean-one-export-per-file.js +124 -0
- package/dist/rules/clean-one-export-per-file.js.map +1 -0
- package/dist/rules/clean-stepdown.d.ts +3 -0
- package/dist/rules/clean-stepdown.d.ts.map +1 -0
- package/dist/rules/clean-stepdown.js +33 -0
- package/dist/rules/clean-stepdown.js.map +1 -0
- package/dist/rules/context-boundaries.d.ts +4 -0
- package/dist/rules/context-boundaries.d.ts.map +1 -0
- package/dist/rules/context-boundaries.js +87 -0
- package/dist/rules/context-boundaries.js.map +1 -0
- package/dist/rules/context-extractable.d.ts +5 -0
- package/dist/rules/context-extractable.d.ts.map +1 -0
- package/dist/rules/context-extractable.js +242 -0
- package/dist/rules/context-extractable.js.map +1 -0
- package/dist/rules/declarations-role-declared.d.ts +5 -0
- package/dist/rules/declarations-role-declared.d.ts.map +1 -0
- package/dist/rules/declarations-role-declared.js +142 -0
- package/dist/rules/declarations-role-declared.js.map +1 -0
- package/dist/rules/domain-aggregate-encapsulation.d.ts +4 -0
- package/dist/rules/domain-aggregate-encapsulation.d.ts.map +1 -0
- package/dist/rules/domain-aggregate-encapsulation.js +93 -0
- package/dist/rules/domain-aggregate-encapsulation.js.map +1 -0
- package/dist/rules/domain-events-dispatched-on-save.d.ts +3 -0
- package/dist/rules/domain-events-dispatched-on-save.d.ts.map +1 -0
- package/dist/rules/domain-events-dispatched-on-save.js +87 -0
- package/dist/rules/domain-events-dispatched-on-save.js.map +1 -0
- package/dist/rules/domain-events-transactional-before-commit.d.ts +4 -0
- package/dist/rules/domain-events-transactional-before-commit.d.ts.map +1 -0
- package/dist/rules/domain-events-transactional-before-commit.js +121 -0
- package/dist/rules/domain-events-transactional-before-commit.js.map +1 -0
- package/dist/rules/domain-no-generic-error.d.ts +2 -0
- package/dist/rules/domain-no-generic-error.d.ts.map +1 -0
- package/dist/rules/domain-no-generic-error.js +32 -0
- package/dist/rules/domain-no-generic-error.js.map +1 -0
- package/dist/rules/domain-value-object-immutability.d.ts +4 -0
- package/dist/rules/domain-value-object-immutability.d.ts.map +1 -0
- package/dist/rules/domain-value-object-immutability.js +77 -0
- package/dist/rules/domain-value-object-immutability.js.map +1 -0
- package/dist/rules/events-consumer-idempotent.d.ts +5 -0
- package/dist/rules/events-consumer-idempotent.d.ts.map +1 -0
- package/dist/rules/events-consumer-idempotent.js +115 -0
- package/dist/rules/events-consumer-idempotent.js.map +1 -0
- package/dist/rules/events-name-format.d.ts +2 -0
- package/dist/rules/events-name-format.d.ts.map +1 -0
- package/dist/rules/events-name-format.js +53 -0
- package/dist/rules/events-name-format.js.map +1 -0
- package/dist/rules/events-outbox-required.d.ts +7 -0
- package/dist/rules/events-outbox-required.d.ts.map +1 -0
- package/dist/rules/events-outbox-required.js +82 -0
- package/dist/rules/events-outbox-required.js.map +1 -0
- package/dist/rules/governance-recorded-deviation.d.ts +2 -0
- package/dist/rules/governance-recorded-deviation.d.ts.map +1 -0
- package/dist/rules/governance-recorded-deviation.js +73 -0
- package/dist/rules/governance-recorded-deviation.js.map +1 -0
- package/dist/rules/imports-alias-only.d.ts +5 -0
- package/dist/rules/imports-alias-only.d.ts.map +1 -0
- package/dist/rules/imports-alias-only.js +63 -0
- package/dist/rules/imports-alias-only.js.map +1 -0
- package/dist/rules/layer-application-inward.d.ts +2 -0
- package/dist/rules/layer-application-inward.d.ts.map +1 -0
- package/dist/rules/layer-application-inward.js +66 -0
- package/dist/rules/layer-application-inward.js.map +1 -0
- package/dist/rules/layer-domain-purity.d.ts +4 -0
- package/dist/rules/layer-domain-purity.d.ts.map +1 -0
- package/dist/rules/layer-domain-purity.js +75 -0
- package/dist/rules/layer-domain-purity.js.map +1 -0
- package/dist/rules/layer-sideways.d.ts +3 -0
- package/dist/rules/layer-sideways.d.ts.map +1 -0
- package/dist/rules/layer-sideways.js +42 -0
- package/dist/rules/layer-sideways.js.map +1 -0
- package/dist/rules/ports-abstract-class.d.ts +2 -0
- package/dist/rules/ports-abstract-class.d.ts.map +1 -0
- package/dist/rules/ports-abstract-class.js +74 -0
- package/dist/rules/ports-abstract-class.js.map +1 -0
- package/dist/rules/ports-implements-never-extends.d.ts +5 -0
- package/dist/rules/ports-implements-never-extends.d.ts.map +1 -0
- package/dist/rules/ports-implements-never-extends.js +81 -0
- package/dist/rules/ports-implements-never-extends.js.map +1 -0
- package/dist/rules/ports-no-concrete-dependency.d.ts +2 -0
- package/dist/rules/ports-no-concrete-dependency.d.ts.map +1 -0
- package/dist/rules/ports-no-concrete-dependency.js +32 -0
- package/dist/rules/ports-no-concrete-dependency.js.map +1 -0
- package/dist/rules/ports-no-token-constant.d.ts +5 -0
- package/dist/rules/ports-no-token-constant.d.ts.map +1 -0
- package/dist/rules/ports-no-token-constant.js +109 -0
- package/dist/rules/ports-no-token-constant.js.map +1 -0
- package/dist/rules/ports-value-import.d.ts +3 -0
- package/dist/rules/ports-value-import.d.ts.map +1 -0
- package/dist/rules/ports-value-import.js +60 -0
- package/dist/rules/ports-value-import.js.map +1 -0
- package/dist/rules/purity.d.ts +4 -0
- package/dist/rules/purity.d.ts.map +1 -0
- package/dist/rules/purity.js +65 -0
- package/dist/rules/purity.js.map +1 -0
- package/dist/rules/rules.d.ts +4 -0
- package/dist/rules/rules.d.ts.map +1 -0
- package/dist/rules/rules.js +97 -0
- package/dist/rules/rules.js.map +1 -0
- package/dist/rules/scheduling-job-name.d.ts +5 -0
- package/dist/rules/scheduling-job-name.d.ts.map +1 -0
- package/dist/rules/scheduling-job-name.js +98 -0
- package/dist/rules/scheduling-job-name.js.map +1 -0
- package/dist/rules/scheduling-job-triggers-use-case.d.ts +5 -0
- package/dist/rules/scheduling-job-triggers-use-case.d.ts.map +1 -0
- package/dist/rules/scheduling-job-triggers-use-case.js +129 -0
- package/dist/rules/scheduling-job-triggers-use-case.js.map +1 -0
- package/dist/rules/standard-no-parallel-interface.d.ts +2 -0
- package/dist/rules/standard-no-parallel-interface.d.ts.map +1 -0
- package/dist/rules/standard-no-parallel-interface.js +57 -0
- package/dist/rules/standard-no-parallel-interface.js.map +1 -0
- package/dist/rules/test-no-mocks.d.ts +2 -0
- package/dist/rules/test-no-mocks.d.ts.map +1 -0
- package/dist/rules/test-no-mocks.js +50 -0
- package/dist/rules/test-no-mocks.js.map +1 -0
- package/dist/rules/tracing-platform-only.d.ts +2 -0
- package/dist/rules/tracing-platform-only.d.ts.map +1 -0
- package/dist/rules/tracing-platform-only.js +52 -0
- package/dist/rules/tracing-platform-only.js.map +1 -0
- package/dist/support/ancestors.d.ts +4 -0
- package/dist/support/ancestors.d.ts.map +1 -0
- package/dist/support/ancestors.js +7 -0
- package/dist/support/ancestors.js.map +1 -0
- package/dist/support/calls/accessed-name.d.ts +4 -0
- package/dist/support/calls/accessed-name.d.ts.map +1 -0
- package/dist/support/calls/accessed-name.js +14 -0
- package/dist/support/calls/accessed-name.js.map +1 -0
- package/dist/support/calls/callee-name.d.ts +4 -0
- package/dist/support/calls/callee-name.d.ts.map +1 -0
- package/dist/support/calls/callee-name.js +11 -0
- package/dist/support/calls/callee-name.js.map +1 -0
- package/dist/support/calls/has-spread.d.ts +4 -0
- package/dist/support/calls/has-spread.d.ts.map +1 -0
- package/dist/support/calls/has-spread.js +6 -0
- package/dist/support/calls/has-spread.js.map +1 -0
- package/dist/support/calls/method-chain.d.ts +8 -0
- package/dist/support/calls/method-chain.d.ts.map +1 -0
- package/dist/support/calls/method-chain.js +13 -0
- package/dist/support/calls/method-chain.js.map +1 -0
- package/dist/support/calls/missing-keys.d.ts +7 -0
- package/dist/support/calls/missing-keys.d.ts.map +1 -0
- package/dist/support/calls/missing-keys.js +28 -0
- package/dist/support/calls/missing-keys.js.map +1 -0
- package/dist/support/calls/property-of.d.ts +3 -0
- package/dist/support/calls/property-of.d.ts.map +1 -0
- package/dist/support/calls/property-of.js +8 -0
- package/dist/support/calls/property-of.js.map +1 -0
- package/dist/support/classes/class-finder.d.ts +18 -0
- package/dist/support/classes/class-finder.d.ts.map +1 -0
- package/dist/support/classes/class-finder.js +76 -0
- package/dist/support/classes/class-finder.js.map +1 -0
- package/dist/support/classes/class-name.d.ts +4 -0
- package/dist/support/classes/class-name.d.ts.map +1 -0
- package/dist/support/classes/class-name.js +4 -0
- package/dist/support/classes/class-name.js.map +1 -0
- package/dist/support/classes/constructor-of.d.ts +3 -0
- package/dist/support/classes/constructor-of.d.ts.map +1 -0
- package/dist/support/classes/constructor-of.js +5 -0
- package/dist/support/classes/constructor-of.js.map +1 -0
- package/dist/support/classes/enclosing-member.d.ts +8 -0
- package/dist/support/classes/enclosing-member.d.ts.map +1 -0
- package/dist/support/classes/enclosing-member.js +15 -0
- package/dist/support/classes/enclosing-member.js.map +1 -0
- package/dist/support/classes/exported-classes.d.ts +4 -0
- package/dist/support/classes/exported-classes.d.ts.map +1 -0
- package/dist/support/classes/exported-classes.js +22 -0
- package/dist/support/classes/exported-classes.js.map +1 -0
- package/dist/support/classes/is-callable.d.ts +4 -0
- package/dist/support/classes/is-callable.d.ts.map +1 -0
- package/dist/support/classes/is-callable.js +10 -0
- package/dist/support/classes/is-callable.js.map +1 -0
- package/dist/support/classes/is-constructor.d.ts +3 -0
- package/dist/support/classes/is-constructor.d.ts.map +1 -0
- package/dist/support/classes/is-constructor.js +5 -0
- package/dist/support/classes/is-constructor.js.map +1 -0
- package/dist/support/classes/is-function.d.ts +3 -0
- package/dist/support/classes/is-function.d.ts.map +1 -0
- package/dist/support/classes/is-function.js +5 -0
- package/dist/support/classes/is-function.js.map +1 -0
- package/dist/support/classes/is-inline-export.d.ts +3 -0
- package/dist/support/classes/is-inline-export.d.ts.map +1 -0
- package/dist/support/classes/is-inline-export.js +6 -0
- package/dist/support/classes/is-inline-export.js.map +1 -0
- package/dist/support/classes/is-keyed.d.ts +5 -0
- package/dist/support/classes/is-keyed.d.ts.map +1 -0
- package/dist/support/classes/is-keyed.js +5 -0
- package/dist/support/classes/is-keyed.js.map +1 -0
- package/dist/support/classes/key-name.d.ts +3 -0
- package/dist/support/classes/key-name.d.ts.map +1 -0
- package/dist/support/classes/key-name.js +11 -0
- package/dist/support/classes/key-name.js.map +1 -0
- package/dist/support/classes/member-name.d.ts +4 -0
- package/dist/support/classes/member-name.d.ts.map +1 -0
- package/dist/support/classes/member-name.js +7 -0
- package/dist/support/classes/member-name.js.map +1 -0
- package/dist/support/classes/top-level-classes.d.ts +4 -0
- package/dist/support/classes/top-level-classes.d.ts.map +1 -0
- package/dist/support/classes/top-level-classes.js +10 -0
- package/dist/support/classes/top-level-classes.js.map +1 -0
- package/dist/support/classes/visibility-of.d.ts +4 -0
- package/dist/support/classes/visibility-of.d.ts.map +1 -0
- package/dist/support/classes/visibility-of.js +12 -0
- package/dist/support/classes/visibility-of.js.map +1 -0
- package/dist/support/comments/comment-lines.d.ts +15 -0
- package/dist/support/comments/comment-lines.d.ts.map +1 -0
- package/dist/support/comments/comment-lines.js +47 -0
- package/dist/support/comments/comment-lines.js.map +1 -0
- package/dist/support/comments/is-commented-out-code.d.ts +6 -0
- package/dist/support/comments/is-commented-out-code.d.ts.map +1 -0
- package/dist/support/comments/is-commented-out-code.js +108 -0
- package/dist/support/comments/is-commented-out-code.js.map +1 -0
- package/dist/support/comments/is-directive.d.ts +3 -0
- package/dist/support/comments/is-directive.d.ts.map +1 -0
- package/dist/support/comments/is-directive.js +6 -0
- package/dist/support/comments/is-directive.js.map +1 -0
- package/dist/support/comments/is-fragment.d.ts +3 -0
- package/dist/support/comments/is-fragment.d.ts.map +1 -0
- package/dist/support/comments/is-fragment.js +18 -0
- package/dist/support/comments/is-fragment.js.map +1 -0
- package/dist/support/comments/is-jsdoc.d.ts +3 -0
- package/dist/support/comments/is-jsdoc.d.ts.map +1 -0
- package/dist/support/comments/is-jsdoc.js +5 -0
- package/dist/support/comments/is-jsdoc.js.map +1 -0
- package/dist/support/comments/prose-opening.d.ts +3 -0
- package/dist/support/comments/prose-opening.d.ts.map +1 -0
- package/dist/support/comments/prose-opening.js +3 -0
- package/dist/support/comments/prose-opening.js.map +1 -0
- package/dist/support/comments/reads-as-prose.d.ts +3 -0
- package/dist/support/comments/reads-as-prose.d.ts.map +1 -0
- package/dist/support/comments/reads-as-prose.js +7 -0
- package/dist/support/comments/reads-as-prose.js.map +1 -0
- package/dist/support/declarations/access-decorators.d.ts +3 -0
- package/dist/support/declarations/access-decorators.d.ts.map +1 -0
- package/dist/support/declarations/access-decorators.js +3 -0
- package/dist/support/declarations/access-decorators.js.map +1 -0
- package/dist/support/declarations/declaration-reader.d.ts +19 -0
- package/dist/support/declarations/declaration-reader.d.ts.map +1 -0
- package/dist/support/declarations/declaration-reader.js +46 -0
- package/dist/support/declarations/declaration-reader.js.map +1 -0
- package/dist/support/declarations/declared-role-of.d.ts +5 -0
- package/dist/support/declarations/declared-role-of.d.ts.map +1 -0
- package/dist/support/declarations/declared-role-of.js +12 -0
- package/dist/support/declarations/declared-role-of.js.map +1 -0
- package/dist/support/declarations/declared-role.d.ts +9 -0
- package/dist/support/declarations/declared-role.d.ts.map +1 -0
- package/dist/support/declarations/declared-role.js +2 -0
- package/dist/support/declarations/declared-role.js.map +1 -0
- package/dist/support/declarations/declared-roles.d.ts +4 -0
- package/dist/support/declarations/declared-roles.d.ts.map +1 -0
- package/dist/support/declarations/declared-roles.js +20 -0
- package/dist/support/declarations/declared-roles.js.map +1 -0
- package/dist/support/declarations/is-declared-style.d.ts +3 -0
- package/dist/support/declarations/is-declared-style.d.ts.map +1 -0
- package/dist/support/declarations/is-declared-style.js +4 -0
- package/dist/support/declarations/is-declared-style.js.map +1 -0
- package/dist/support/declarations/written-name.d.ts +11 -0
- package/dist/support/declarations/written-name.d.ts.map +1 -0
- package/dist/support/declarations/written-name.js +22 -0
- package/dist/support/declarations/written-name.js.map +1 -0
- package/dist/support/declarations/written-names.d.ts +3 -0
- package/dist/support/declarations/written-names.d.ts.map +1 -0
- package/dist/support/declarations/written-names.js +7 -0
- package/dist/support/declarations/written-names.js.map +1 -0
- package/dist/support/descendants.d.ts +4 -0
- package/dist/support/descendants.d.ts.map +1 -0
- package/dist/support/descendants.js +21 -0
- package/dist/support/descendants.js.map +1 -0
- package/dist/support/exports/derived-forms-of.d.ts +8 -0
- package/dist/support/exports/derived-forms-of.d.ts.map +1 -0
- package/dist/support/exports/derived-forms-of.js +23 -0
- package/dist/support/exports/derived-forms-of.js.map +1 -0
- package/dist/support/exports/explain-exports.d.ts +11 -0
- package/dist/support/exports/explain-exports.d.ts.map +1 -0
- package/dist/support/exports/explain-exports.js +60 -0
- package/dist/support/exports/explain-exports.js.map +1 -0
- package/dist/support/exports/export-explanation.d.ts +9 -0
- package/dist/support/exports/export-explanation.d.ts.map +1 -0
- package/dist/support/exports/export-explanation.js +2 -0
- package/dist/support/exports/export-explanation.js.map +1 -0
- package/dist/support/exports/is-named-after.d.ts +8 -0
- package/dist/support/exports/is-named-after.d.ts.map +1 -0
- package/dist/support/exports/is-named-after.js +16 -0
- package/dist/support/exports/is-named-after.js.map +1 -0
- package/dist/support/exports/module-shape-of.d.ts +4 -0
- package/dist/support/exports/module-shape-of.d.ts.map +1 -0
- package/dist/support/exports/module-shape-of.js +11 -0
- package/dist/support/exports/module-shape-of.js.map +1 -0
- package/dist/support/exports/module-shape.d.ts +10 -0
- package/dist/support/exports/module-shape.d.ts.map +1 -0
- package/dist/support/exports/module-shape.js +2 -0
- package/dist/support/exports/module-shape.js.map +1 -0
- package/dist/support/exports/shares-private-state.d.ts +11 -0
- package/dist/support/exports/shares-private-state.d.ts.map +1 -0
- package/dist/support/exports/shares-private-state.js +36 -0
- package/dist/support/exports/shares-private-state.js.map +1 -0
- package/dist/support/exports/signature-of.d.ts +8 -0
- package/dist/support/exports/signature-of.d.ts.map +1 -0
- package/dist/support/exports/signature-of.js +44 -0
- package/dist/support/exports/signature-of.js.map +1 -0
- package/dist/support/exports/top-level-declaration.d.ts +10 -0
- package/dist/support/exports/top-level-declaration.d.ts.map +1 -0
- package/dist/support/exports/top-level-declaration.js +2 -0
- package/dist/support/exports/top-level-declaration.js.map +1 -0
- package/dist/support/exports/top-level-declarations.d.ts +5 -0
- package/dist/support/exports/top-level-declarations.d.ts.map +1 -0
- package/dist/support/exports/top-level-declarations.js +48 -0
- package/dist/support/exports/top-level-declarations.js.map +1 -0
- package/dist/support/exports/type-closure.d.ts +5 -0
- package/dist/support/exports/type-closure.d.ts.map +1 -0
- package/dist/support/exports/type-closure.js +18 -0
- package/dist/support/exports/type-closure.js.map +1 -0
- package/dist/support/exports/type-family-of.d.ts +8 -0
- package/dist/support/exports/type-family-of.d.ts.map +1 -0
- package/dist/support/exports/type-family-of.js +43 -0
- package/dist/support/exports/type-family-of.js.map +1 -0
- package/dist/support/exports/type-names-in.d.ts +4 -0
- package/dist/support/exports/type-names-in.d.ts.map +1 -0
- package/dist/support/exports/type-names-in.js +21 -0
- package/dist/support/exports/type-names-in.js.map +1 -0
- package/dist/support/functions/code-lines.d.ts +5 -0
- package/dist/support/functions/code-lines.d.ts.map +1 -0
- package/dist/support/functions/code-lines.js +14 -0
- package/dist/support/functions/code-lines.js.map +1 -0
- package/dist/support/functions/described-function.d.ts +11 -0
- package/dist/support/functions/described-function.d.ts.map +1 -0
- package/dist/support/functions/described-function.js +9 -0
- package/dist/support/functions/described-function.js.map +1 -0
- package/dist/support/functions/function-node.d.ts +3 -0
- package/dist/support/functions/function-node.d.ts.map +1 -0
- package/dist/support/functions/function-node.js +2 -0
- package/dist/support/functions/function-node.js.map +1 -0
- package/dist/support/glob-matcher.d.ts +3 -0
- package/dist/support/glob-matcher.d.ts.map +1 -0
- package/dist/support/glob-matcher.js +8 -0
- package/dist/support/glob-matcher.js.map +1 -0
- package/dist/support/globals/ambient-name.d.ts +8 -0
- package/dist/support/globals/ambient-name.d.ts.map +1 -0
- package/dist/support/globals/ambient-name.js +26 -0
- package/dist/support/globals/ambient-name.js.map +1 -0
- package/dist/support/globals/property-name.d.ts +3 -0
- package/dist/support/globals/property-name.d.ts.map +1 -0
- package/dist/support/globals/property-name.js +10 -0
- package/dist/support/globals/property-name.js.map +1 -0
- package/dist/support/hash-private-fix.d.ts +12 -0
- package/dist/support/hash-private-fix.d.ts.map +1 -0
- package/dist/support/hash-private-fix.js +52 -0
- package/dist/support/hash-private-fix.js.map +1 -0
- package/dist/support/imports/describe-target.d.ts +3 -0
- package/dist/support/imports/describe-target.d.ts.map +1 -0
- package/dist/support/imports/describe-target.js +11 -0
- package/dist/support/imports/describe-target.js.map +1 -0
- package/dist/support/imports/import-listener.d.ts +23 -0
- package/dist/support/imports/import-listener.d.ts.map +1 -0
- package/dist/support/imports/import-listener.js +43 -0
- package/dist/support/imports/import-listener.js.map +1 -0
- package/dist/support/imports/in-context.d.ts +4 -0
- package/dist/support/imports/in-context.d.ts.map +1 -0
- package/dist/support/imports/in-context.js +4 -0
- package/dist/support/imports/in-context.js.map +1 -0
- package/dist/support/imports/in-layer.d.ts +5 -0
- package/dist/support/imports/in-layer.d.ts.map +1 -0
- package/dist/support/imports/in-layer.js +4 -0
- package/dist/support/imports/in-layer.js.map +1 -0
- package/dist/support/imports/in-source-root.d.ts +4 -0
- package/dist/support/imports/in-source-root.d.ts.map +1 -0
- package/dist/support/imports/in-source-root.js +5 -0
- package/dist/support/imports/in-source-root.js.map +1 -0
- package/dist/support/imports/inner-layer.d.ts +4 -0
- package/dist/support/imports/inner-layer.d.ts.map +1 -0
- package/dist/support/imports/inner-layer.js +9 -0
- package/dist/support/imports/inner-layer.js.map +1 -0
- package/dist/support/imports/static-string.d.ts +3 -0
- package/dist/support/imports/static-string.d.ts.map +1 -0
- package/dist/support/imports/static-string.js +11 -0
- package/dist/support/imports/static-string.js.map +1 -0
- package/dist/support/kebab-case.d.ts +7 -0
- package/dist/support/kebab-case.d.ts.map +1 -0
- package/dist/support/kebab-case.js +13 -0
- package/dist/support/kebab-case.js.map +1 -0
- package/dist/support/members/parameter-name.d.ts +3 -0
- package/dist/support/members/parameter-name.d.ts.map +1 -0
- package/dist/support/members/parameter-name.js +7 -0
- package/dist/support/members/parameter-name.js.map +1 -0
- package/dist/support/members/parameter-properties.d.ts +4 -0
- package/dist/support/members/parameter-properties.d.ts.map +1 -0
- package/dist/support/members/parameter-properties.js +6 -0
- package/dist/support/members/parameter-properties.js.map +1 -0
- package/dist/support/members/starts-at-this.d.ts +4 -0
- package/dist/support/members/starts-at-this.d.ts.map +1 -0
- package/dist/support/members/starts-at-this.js +10 -0
- package/dist/support/members/starts-at-this.js.map +1 -0
- package/dist/support/outside-concerns/outside-concern-message.d.ts +3 -0
- package/dist/support/outside-concerns/outside-concern-message.d.ts.map +1 -0
- package/dist/support/outside-concerns/outside-concern-message.js +3 -0
- package/dist/support/outside-concerns/outside-concern-message.js.map +1 -0
- package/dist/support/outside-concerns/outside-concern.d.ts +13 -0
- package/dist/support/outside-concerns/outside-concern.d.ts.map +1 -0
- package/dist/support/outside-concerns/outside-concern.js +31 -0
- package/dist/support/outside-concerns/outside-concern.js.map +1 -0
- package/dist/support/ports/binding-call-reader.d.ts +10 -0
- package/dist/support/ports/binding-call-reader.d.ts.map +1 -0
- package/dist/support/ports/binding-call-reader.js +25 -0
- package/dist/support/ports/binding-call-reader.js.map +1 -0
- package/dist/support/ports/dependency-list-listener.d.ts +10 -0
- package/dist/support/ports/dependency-list-listener.d.ts.map +1 -0
- package/dist/support/ports/dependency-list-listener.js +37 -0
- package/dist/support/ports/dependency-list-listener.js.map +1 -0
- package/dist/support/ports/imported-binding.d.ts +11 -0
- package/dist/support/ports/imported-binding.d.ts.map +1 -0
- package/dist/support/ports/imported-binding.js +2 -0
- package/dist/support/ports/imported-binding.js.map +1 -0
- package/dist/support/ports/imported-bindings.d.ts +6 -0
- package/dist/support/ports/imported-bindings.d.ts.map +1 -0
- package/dist/support/ports/imported-bindings.js +19 -0
- package/dist/support/ports/imported-bindings.js.map +1 -0
- package/dist/support/ports/is-port-file.d.ts +4 -0
- package/dist/support/ports/is-port-file.d.ts.map +1 -0
- package/dist/support/ports/is-port-file.js +13 -0
- package/dist/support/ports/is-port-file.js.map +1 -0
- package/dist/support/purity-rule.d.ts +19 -0
- package/dist/support/purity-rule.d.ts.map +1 -0
- package/dist/support/purity-rule.js +74 -0
- package/dist/support/purity-rule.js.map +1 -0
- package/dist/support/rule/define-rule.d.ts +30 -0
- package/dist/support/rule/define-rule.d.ts.map +1 -0
- package/dist/support/rule/define-rule.js +51 -0
- package/dist/support/rule/define-rule.js.map +1 -0
- package/dist/support/rule/docs-of.d.ts +6 -0
- package/dist/support/rule/docs-of.d.ts.map +1 -0
- package/dist/support/rule/docs-of.js +9 -0
- package/dist/support/rule/docs-of.js.map +1 -0
- package/dist/support/rule/rule-docs.d.ts +9 -0
- package/dist/support/rule/rule-docs.d.ts.map +1 -0
- package/dist/support/rule/rule-docs.js +2 -0
- package/dist/support/rule/rule-docs.js.map +1 -0
- package/dist/support/scheduling/is-job-file.d.ts +4 -0
- package/dist/support/scheduling/is-job-file.d.ts.map +1 -0
- package/dist/support/scheduling/is-job-file.js +11 -0
- package/dist/support/scheduling/is-job-file.js.map +1 -0
- package/dist/support/scheduling/registered-job.d.ts +11 -0
- package/dist/support/scheduling/registered-job.d.ts.map +1 -0
- package/dist/support/scheduling/registered-job.js +17 -0
- package/dist/support/scheduling/registered-job.js.map +1 -0
- package/dist/support/standard-interfaces/boundary-names.d.ts +3 -0
- package/dist/support/standard-interfaces/boundary-names.d.ts.map +1 -0
- package/dist/support/standard-interfaces/boundary-names.js +3 -0
- package/dist/support/standard-interfaces/boundary-names.js.map +1 -0
- package/dist/support/standard-interfaces/parallel-names.d.ts +4 -0
- package/dist/support/standard-interfaces/parallel-names.d.ts.map +1 -0
- package/dist/support/standard-interfaces/parallel-names.js +76 -0
- package/dist/support/standard-interfaces/parallel-names.js.map +1 -0
- package/dist/support/standard-interfaces/standard-names-in.d.ts +3 -0
- package/dist/support/standard-interfaces/standard-names-in.d.ts.map +1 -0
- package/dist/support/standard-interfaces/standard-names-in.js +5 -0
- package/dist/support/standard-interfaces/standard-names-in.js.map +1 -0
- package/dist/support/stepdown/call-graph.d.ts +8 -0
- package/dist/support/stepdown/call-graph.d.ts.map +1 -0
- package/dist/support/stepdown/call-graph.js +27 -0
- package/dist/support/stepdown/call-graph.js.map +1 -0
- package/dist/support/stepdown/member-use.d.ts +7 -0
- package/dist/support/stepdown/member-use.d.ts.map +1 -0
- package/dist/support/stepdown/member-use.js +2 -0
- package/dist/support/stepdown/member-use.js.map +1 -0
- package/dist/support/stepdown/member-uses.d.ts +9 -0
- package/dist/support/stepdown/member-uses.d.ts.map +1 -0
- package/dist/support/stepdown/member-uses.js +27 -0
- package/dist/support/stepdown/member-uses.js.map +1 -0
- package/dist/support/stepdown/misplaced-functions.d.ts +11 -0
- package/dist/support/stepdown/misplaced-functions.d.ts.map +1 -0
- package/dist/support/stepdown/misplaced-functions.js +80 -0
- package/dist/support/stepdown/misplaced-functions.js.map +1 -0
- package/dist/support/stepdown/misplaced-members.d.ts +10 -0
- package/dist/support/stepdown/misplaced-members.d.ts.map +1 -0
- package/dist/support/stepdown/misplaced-members.js +73 -0
- package/dist/support/stepdown/misplaced-members.js.map +1 -0
- package/dist/support/suppressions/shares-line-with-code.d.ts +3 -0
- package/dist/support/suppressions/shares-line-with-code.d.ts.map +1 -0
- package/dist/support/suppressions/shares-line-with-code.js +5 -0
- package/dist/support/suppressions/shares-line-with-code.js.map +1 -0
- package/dist/support/suppressions/suppressed-lines.d.ts +4 -0
- package/dist/support/suppressions/suppressed-lines.d.ts.map +1 -0
- package/dist/support/suppressions/suppressed-lines.js +17 -0
- package/dist/support/suppressions/suppressed-lines.js.map +1 -0
- package/dist/support/types/declared-type-name.d.ts +6 -0
- package/dist/support/types/declared-type-name.d.ts.map +1 -0
- package/dist/support/types/declared-type-name.js +33 -0
- package/dist/support/types/declared-type-name.js.map +1 -0
- package/dist/support/types/parameter-binding.d.ts +4 -0
- package/dist/support/types/parameter-binding.d.ts.map +1 -0
- package/dist/support/types/parameter-binding.js +7 -0
- package/dist/support/types/parameter-binding.js.map +1 -0
- package/dist/support/types/parameter-type-name.d.ts +3 -0
- package/dist/support/types/parameter-type-name.d.ts.map +1 -0
- package/dist/support/types/parameter-type-name.js +6 -0
- package/dist/support/types/parameter-type-name.js.map +1 -0
- package/dist/support/types/type-reference-name.d.ts +4 -0
- package/dist/support/types/type-reference-name.d.ts.map +1 -0
- package/dist/support/types/type-reference-name.js +14 -0
- package/dist/support/types/type-reference-name.js.map +1 -0
- package/dist/support/words/same-word.d.ts +3 -0
- package/dist/support/words/same-word.d.ts.map +1 -0
- package/dist/support/words/same-word.js +75 -0
- package/dist/support/words/same-word.js.map +1 -0
- package/dist/support/words/split-words.d.ts +3 -0
- package/dist/support/words/split-words.d.ts.map +1 -0
- package/dist/support/words/split-words.js +12 -0
- package/dist/support/words/split-words.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/docs/rules/application-command-query-separation.md +54 -0
- package/docs/rules/application-handler-shape.md +52 -0
- package/docs/rules/aspects-outside-in.md +54 -0
- package/docs/rules/authz-actor-explicit.md +70 -0
- package/docs/rules/authz-declared.md +87 -0
- package/docs/rules/authz-in-application.md +88 -0
- package/docs/rules/clean-blank-lines.md +87 -0
- package/docs/rules/clean-braces.md +61 -0
- package/docs/rules/clean-file-size.md +43 -0
- package/docs/rules/clean-formatted.md +32 -0
- package/docs/rules/clean-function-ceiling.md +53 -0
- package/docs/rules/clean-function-size.md +45 -0
- package/docs/rules/clean-no-commented-out-code.md +48 -0
- package/docs/rules/clean-no-escape-hatch.md +80 -0
- package/docs/rules/clean-no-flag-argument.md +50 -0
- package/docs/rules/clean-no-hash-private.md +63 -0
- package/docs/rules/clean-no-noise-comment.md +55 -0
- package/docs/rules/clean-one-export-per-file.md +88 -0
- package/docs/rules/clean-stepdown.md +60 -0
- package/docs/rules/context-declared-relationship.md +49 -0
- package/docs/rules/context-extractable.md +109 -0
- package/docs/rules/context-published-language-is-a-contract.md +47 -0
- package/docs/rules/context-published-language-only.md +47 -0
- package/docs/rules/declarations-role-declared.md +109 -0
- package/docs/rules/domain-aggregate-encapsulation.md +63 -0
- package/docs/rules/domain-events-dispatched-on-save.md +83 -0
- package/docs/rules/domain-events-transactional-before-commit.md +92 -0
- package/docs/rules/domain-no-generic-error.md +40 -0
- package/docs/rules/domain-value-object-immutability.md +52 -0
- package/docs/rules/events-consumer-idempotent.md +68 -0
- package/docs/rules/events-name-format.md +50 -0
- package/docs/rules/events-outbox-required.md +57 -0
- package/docs/rules/governance-recorded-deviation.md +55 -0
- package/docs/rules/imports-alias-only.md +73 -0
- package/docs/rules/layer-application-inward.md +62 -0
- package/docs/rules/layer-domain-purity.md +60 -0
- package/docs/rules/layer-infrastructure-no-presentation.md +46 -0
- package/docs/rules/layer-presentation-no-infrastructure.md +46 -0
- package/docs/rules/ports-abstract-class.md +70 -0
- package/docs/rules/ports-implements-never-extends.md +53 -0
- package/docs/rules/ports-no-concrete-dependency.md +52 -0
- package/docs/rules/ports-no-token-constant.md +57 -0
- package/docs/rules/ports-value-import.md +55 -0
- package/docs/rules/purity-no-ambient-randomness.md +43 -0
- package/docs/rules/purity-no-environment.md +45 -0
- package/docs/rules/purity-no-system-clock.md +49 -0
- package/docs/rules/scheduling-job-name.md +57 -0
- package/docs/rules/scheduling-job-triggers-use-case.md +71 -0
- package/docs/rules/standard-no-parallel-interface.md +95 -0
- package/docs/rules/test-no-mocks.md +47 -0
- package/docs/rules/tracing-platform-only.md +65 -0
- package/package.json +56 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# ddd-ts-kit/context-extractable
|
|
2
|
+
|
|
3
|
+
Architecture id: `context/extractable`. Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: every file of a context, tests excluded; each check in the place named below.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
A bounded context is a deployable unit in waiting. Moving one to its own service must change a composition root and adapters, never domain or application code. A join on another context's table, a variable shared through an import or a token borrowed from another module each turn that move into a rewrite.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
In `infrastructure/persistence/`:
|
|
14
|
+
|
|
15
|
+
- `contextSchema('<other>')` or `schemaNameOf('<other>')` with the name of another context of the config
|
|
16
|
+
- a string or template literal that reads as SQL and names `<other_schema>.` or `"<other_schema>".`, the schema of another context of the config
|
|
17
|
+
|
|
18
|
+
In any file of a context:
|
|
19
|
+
|
|
20
|
+
- `export let` and `export var`
|
|
21
|
+
- an exported `const` holding `new Map`, `new Set`, `new WeakMap`, `new WeakSet`, `new Array`, an array literal or an object literal, when the same file changes it (`push`, `set`, `add`, `delete`, an assignment to a member, `Object.assign`, ...)
|
|
22
|
+
|
|
23
|
+
In `<context>.module.ts`:
|
|
24
|
+
|
|
25
|
+
- a name imported from another context, outside its `published-language/`, given to `bind`, `rebind`, `resolve`, or to `handledBy` and `toClass` (directly or in the dependency list)
|
|
26
|
+
|
|
27
|
+
In a role file of a declared-style project (`stack.style: "declared"`; the files of the table below):
|
|
28
|
+
|
|
29
|
+
- anything imported from a port file of another context: its `domain/repositories/*.repository.ts` and its `application/ports/*.port.ts`
|
|
30
|
+
|
|
31
|
+
Incorrect:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// billing/infrastructure/persistence/drizzle-invoice.repository.ts
|
|
35
|
+
await sql`select i.id, p.label from billing.invoices i join catalog.products p on p.id = i.product_id`;
|
|
36
|
+
|
|
37
|
+
// billing/application/ports/rate-cache.ts
|
|
38
|
+
export const rates = new Map<string, number>();
|
|
39
|
+
export function remember(currency: string, rate: number): void {
|
|
40
|
+
rates.set(currency, rate);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// billing/billing.module.ts
|
|
44
|
+
import { ProductReader } from '@/contexts/catalog/application/ports/product-reader.port.js';
|
|
45
|
+
builder.query(GetPrice).public().handledBy(GetPriceHandler, [ProductReader]);
|
|
46
|
+
|
|
47
|
+
// declared style: billing/application/queries/get-price/get-price.handler.ts
|
|
48
|
+
import { ProductReader } from '@/contexts/catalog/application/ports/product-reader.port.js';
|
|
49
|
+
|
|
50
|
+
@QueryHandler(GetPriceQuery, [ProductReader])
|
|
51
|
+
export class GetPriceHandler {}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Correct:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// billing keeps its own projection, fed by catalog.product.listed
|
|
58
|
+
await sql`select i.id, p.label from billing.invoices i join billing.products p on p.id = i.product_id`;
|
|
59
|
+
|
|
60
|
+
// billing/billing.module.ts
|
|
61
|
+
builder.bind(PriceSource).toClass(InProcessPriceSource, [QueryBus]).as('gateway');
|
|
62
|
+
builder.query(GetPrice).public().handledBy(GetPriceHandler, [PriceSource]);
|
|
63
|
+
|
|
64
|
+
// declared style: the port is one of billing, its gateway calls catalog
|
|
65
|
+
import { PriceCatalog } from '@/contexts/billing/application/ports/price-catalog.port.js';
|
|
66
|
+
|
|
67
|
+
@QueryHandler(GetPriceQuery, [PriceCatalog])
|
|
68
|
+
export class GetPriceHandler {}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Details
|
|
72
|
+
|
|
73
|
+
The schema of a context is its name with dashes turned into underscores, as `schemaNameOf` computes it. A text reads as SQL when it holds one of `select`, `insert`, `update`, `delete`, `from`, `join`, `into`, `references`. The import of another context's internals is itself reported by `context/published-language-only`; this rule reports what is done with it.
|
|
74
|
+
|
|
75
|
+
In the declared style there is no module file: a class names the ports it needs next to its decorator, so the import of a port is the wiring. The role files are:
|
|
76
|
+
|
|
77
|
+
| File, relative to the context | Role |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `application/commands/**/*.command.ts`, `application/queries/**/*.query.ts` | message |
|
|
80
|
+
| `application/commands/**/*.handler.ts`, `application/queries/**/*.handler.ts` | handler |
|
|
81
|
+
| `application/integration/handlers/**/*.integration-handler.ts` | integration event handler |
|
|
82
|
+
| `application/event-handlers/**/*.event-handler.ts`, `application/integration/publishers/**/*.publisher.ts` | reaction to a domain event |
|
|
83
|
+
| `application/authorization/**/*.policy.ts` | policy |
|
|
84
|
+
| `application/scheduling/**/*.job.ts` | scheduled job |
|
|
85
|
+
| `infrastructure/persistence/**/*.repository.ts`, `infrastructure/**/*.gateway.ts`, `infrastructure/**/*.adapter.ts` | adapter |
|
|
86
|
+
|
|
87
|
+
Ports of the same context, of `@ddd-ts-kit/kernel`, of `@ddd-ts-kit/auth` and of the platform directory are what a role file wires with. An integration event definition imported from the published language of an upstream (`productListedV1`) is not a port and is not reported. A module file kept in a declared-style project is judged as in the explicit style, and an explicit-style project is judged as before.
|
|
88
|
+
|
|
89
|
+
## Options
|
|
90
|
+
|
|
91
|
+
None.
|
|
92
|
+
|
|
93
|
+
`rules."context/extractable"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line context/extractable -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
94
|
+
|
|
95
|
+
## Limits
|
|
96
|
+
|
|
97
|
+
- Only contexts listed under `contexts` in `ddd-ts-kit.config.json` are known as "another context".
|
|
98
|
+
- A table reached through a query builder (`knex('catalog.products')`, `.withSchema('catalog')`, a Drizzle table object imported from the other context) is not read as SQL; the import of that table object is reported by `context/published-language-only`.
|
|
99
|
+
- A column or an alias that happens to be called like another context (`catalog.id` where `catalog` is an alias) is reported: rename the alias.
|
|
100
|
+
- SQL outside `infrastructure/persistence/` is not read.
|
|
101
|
+
- A shared transaction (two contexts writing in one unit of work) is not visible in one file.
|
|
102
|
+
- An exported container changed only by its importers is not seen; one never changed is taken for a constant. `Object.freeze` is not required.
|
|
103
|
+
- In a role file only the port files of another context are reported: a port that another context declares elsewhere is reported by `context/published-language-only`, as any import of its internals.
|
|
104
|
+
- A port of another context re-exported by a file of the importing context is not seen.
|
|
105
|
+
- A foreign port that reaches the module through the platform or the shared kernel is not seen: `dependency-cruiser` and the generated test that boots each context alone close that gap.
|
|
106
|
+
|
|
107
|
+
## With the CLI checker
|
|
108
|
+
|
|
109
|
+
`ddd-ts-kit check` reports the same id from the text of the files and from the config. This rule is the authority for the code.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ddd-ts-kit/context-published-language-is-a-contract
|
|
2
|
+
|
|
3
|
+
Architecture id: `context/published-language-is-a-contract`. Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: `published-language/` of a context, tests excluded.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
What a context publishes must be serializable and stable. A contract that imports the domain exposes the internal model under another name.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
- any import other than `publishedLanguageAllowedPackages` (default: the kernel, `@ddd-ts-kit/events`, `@ddd-ts-kit/validation` and the schema library of `stack.validation`) and other published languages
|
|
14
|
+
|
|
15
|
+
Incorrect:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// src/contexts/billing/published-language/invoice-issued.v1.integration-event.ts
|
|
19
|
+
import type { Invoice } from '@/contexts/billing/domain/aggregates/invoice.aggregate.js';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Correct:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { defineIntegrationEvent } from '@ddd-ts-kit/events';
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Details
|
|
30
|
+
|
|
31
|
+
Static imports, type-only imports, `export ... from`, dynamic `import()`, `require()`, `import x = require()` and `import("...")` types are all read, through relative paths and the configured `importAlias`.
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
None. `publishedLanguageAllowedPackages` in `ddd-ts-kit.config.json` replaces the allow-list.
|
|
36
|
+
|
|
37
|
+
`rules."context/published-language-is-a-contract"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line context/published-language-is-a-contract -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
38
|
+
|
|
39
|
+
## Limits
|
|
40
|
+
|
|
41
|
+
- The target is classified by its path: a barrel in an allowed layer that re-exports a forbidden one is not followed. `dependency-cruiser` (see `pipeline/depcruise-config.mjs`) resolves the real graph and closes that gap.
|
|
42
|
+
- A computed specifier (`import(name)`) is not judged.
|
|
43
|
+
- `tsconfig` paths other than `importAlias` are not resolved.
|
|
44
|
+
|
|
45
|
+
## With the CLI checker
|
|
46
|
+
|
|
47
|
+
`ddd-ts-kit check` reports the same id from a regex reading of the file. This rule is the authority for the import; the CLI stays the authority for the config (`config/valid`, `context/no-cycle`).
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ddd-ts-kit/context-published-language-only
|
|
2
|
+
|
|
3
|
+
Architecture id: `context/published-language-only`. Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: every file of a context, tests included.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
A bounded context owns its model. Another context that imports its aggregate or its table freezes that model: the published language is the only contract designed to be depended on.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
- an import of another context outside its `published-language/`
|
|
14
|
+
|
|
15
|
+
Incorrect:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// src/contexts/billing/application/...
|
|
19
|
+
import { Product } from '@/contexts/catalog/domain/aggregates/product.aggregate.js';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Correct:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import type { ProductListedV1 } from '@/contexts/catalog/published-language/index.js';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Details
|
|
29
|
+
|
|
30
|
+
Static imports, type-only imports, `export ... from`, dynamic `import()`, `require()`, `import x = require()` and `import("...")` types are all read, through relative paths and the configured `importAlias`.
|
|
31
|
+
|
|
32
|
+
## Options
|
|
33
|
+
|
|
34
|
+
None.
|
|
35
|
+
|
|
36
|
+
`rules."context/published-language-only"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line context/published-language-only -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
37
|
+
|
|
38
|
+
## Limits
|
|
39
|
+
|
|
40
|
+
- The target is classified by its path: a barrel in an allowed layer that re-exports a forbidden one is not followed. `dependency-cruiser` (see `pipeline/depcruise-config.mjs`) resolves the real graph and closes that gap.
|
|
41
|
+
- A computed specifier (`import(name)`) is not judged.
|
|
42
|
+
- `tsconfig` paths other than `importAlias` are not resolved.
|
|
43
|
+
- Files outside the contexts directory (the platform, `main.ts`) are not judged: the composition root knows every context.
|
|
44
|
+
|
|
45
|
+
## With the CLI checker
|
|
46
|
+
|
|
47
|
+
`ddd-ts-kit check` reports the same id from a regex reading of the file. This rule is the authority for the import; the CLI stays the authority for the config (`config/valid`, `context/no-cycle`).
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# ddd-ts-kit/declarations-role-declared
|
|
2
|
+
|
|
3
|
+
Architecture id: `declarations/role-declared`. Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: every file of a context in a declared-style project (`stack.style: "declared"` in `ddd-ts-kit.config.json`), tests excluded. Nothing is reported in an explicit-style project, which is also what a config that does not say is.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
In the declared style a context has no module file: a class says what it is with a decorator of `@ddd-ts-kit/kernel/declarations`, and the composition root is assembled from what the classes say. A role file whose class says nothing is in no assembly: the handler is never registered and the first command fails at run time. A name that is derived instead of written changes when a class is renamed, and with it the idempotency scope of a consumer. A decorator in the domain ties the model to the wiring.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
In a role file (the table below), other than `*.command.ts` and `*.query.ts`, which `authz-declared` holds:
|
|
14
|
+
|
|
15
|
+
- no exported class carries the decorator of the role
|
|
16
|
+
- a class of the file carries another declaration decorator than the one of the role
|
|
17
|
+
|
|
18
|
+
On any class of `application/`, `infrastructure/`, `presentation/` or the context root:
|
|
19
|
+
|
|
20
|
+
- `@IntegrationEventHandler(definition, { consumer })`, `@Policy(permission, { name })` or `@DomainEventHandler(Event, { name })` whose name is not a non-empty string literal: missing, empty, a variable, a template with a substitution, options held in a variable or only spread
|
|
21
|
+
- `@DomainEventHandler(Event, { name })` whose `name` differs from the `name` literal of the event class, when that class is in view
|
|
22
|
+
|
|
23
|
+
Under `domain/`:
|
|
24
|
+
|
|
25
|
+
- a class carrying any declaration decorator: `Requires`, `Public`, `CommandHandler`, `QueryHandler`, `IntegrationEventHandler`, `DomainEventHandler`, `Scheduled`, `Repository`, `Gateway`, `Adapter`, `Policy`
|
|
26
|
+
|
|
27
|
+
| File, relative to the context | Exported class carries |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `application/commands/**/*.handler.ts` | `@CommandHandler` |
|
|
30
|
+
| `application/queries/**/*.handler.ts` | `@QueryHandler` |
|
|
31
|
+
| `application/integration/handlers/**/*.integration-handler.ts` | `@IntegrationEventHandler` |
|
|
32
|
+
| `application/event-handlers/**/*.event-handler.ts` | `@DomainEventHandler` |
|
|
33
|
+
| `application/integration/publishers/**/*.publisher.ts` | `@DomainEventHandler` |
|
|
34
|
+
| `application/authorization/**/*.policy.ts` | `@Policy` |
|
|
35
|
+
| `application/scheduling/**/*.job.ts` | `@Scheduled` |
|
|
36
|
+
| `infrastructure/persistence/**/*.repository.ts` | `@Repository` |
|
|
37
|
+
| `infrastructure/**/*.gateway.ts` | `@Gateway` |
|
|
38
|
+
| `infrastructure/**/*.adapter.ts` | `@Adapter` |
|
|
39
|
+
|
|
40
|
+
Incorrect:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// application/commands/issue-invoice/issue-invoice.handler.ts
|
|
44
|
+
export class IssueInvoiceHandler {}
|
|
45
|
+
|
|
46
|
+
// application/queries/search-invoices/search-invoices.handler.ts
|
|
47
|
+
@CommandHandler(SearchInvoicesQuery, [InvoiceReader])
|
|
48
|
+
export class SearchInvoicesHandler {}
|
|
49
|
+
|
|
50
|
+
// application/authorization/only-issuer-voids.policy.ts
|
|
51
|
+
@Policy(billingPermissions['invoice.void'], { name: policyName })
|
|
52
|
+
export class OnlyIssuerVoidsPolicy {}
|
|
53
|
+
|
|
54
|
+
// application/event-handlers/invoice-issued.event-handler.ts, where InvoiceIssued is named 'billing.invoice.issued'
|
|
55
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.sent' })
|
|
56
|
+
export class InvoiceIssuedEventHandler {}
|
|
57
|
+
|
|
58
|
+
// domain/aggregates/invoice.aggregate.ts
|
|
59
|
+
@Repository(InvoiceRepository)
|
|
60
|
+
export class Invoice {}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Correct:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
// application/commands/issue-invoice/issue-invoice.handler.ts
|
|
67
|
+
import { Clock } from '@ddd-ts-kit/kernel';
|
|
68
|
+
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
69
|
+
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';
|
|
70
|
+
|
|
71
|
+
@CommandHandler(IssueInvoiceCommand, [InvoiceRepository, Clock])
|
|
72
|
+
export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand> {}
|
|
73
|
+
|
|
74
|
+
// application/authorization/only-issuer-voids.policy.ts
|
|
75
|
+
@Policy(billingPermissions['invoice.void'], { name: 'billing.only-issuer-voids' })
|
|
76
|
+
export class OnlyIssuerVoidsPolicy {}
|
|
77
|
+
|
|
78
|
+
// application/event-handlers/invoice-issued.event-handler.ts
|
|
79
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' })
|
|
80
|
+
export class InvoiceIssuedEventHandler {}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Details
|
|
84
|
+
|
|
85
|
+
A decorator counts when its name is one of the ten declaration decorators and that name is imported from `@ddd-ts-kit/kernel/declarations` in the file: `{ Repository }`, an alias `{ Repository as Repo }`, or a namespace `declarations.Repository`. A home-made decorator of the same name, or one of another package (`@Retry` of `@ddd-ts-kit/aspects/decorators`), is ignored.
|
|
86
|
+
|
|
87
|
+
The role of a file is read from its suffix and its folder, as the generator writes them. A class is exported inline, by `export { A }` or by `export default A`. When a class carries another declaration decorator, only that is reported: fixing it also answers the missing one.
|
|
88
|
+
|
|
89
|
+
The event class of `@DomainEventHandler` is in view when it is declared in the same file, or imported by name from a source of the project that exists on disk; that file is then parsed, syntax only, and its `readonly name = '...'` property is read (`as const` and `satisfies` are looked through). When the class cannot be found, or its name is not a literal, nothing is compared.
|
|
90
|
+
|
|
91
|
+
## Options
|
|
92
|
+
|
|
93
|
+
None.
|
|
94
|
+
|
|
95
|
+
`rules."declarations/role-declared"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line declarations/role-declared -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
96
|
+
|
|
97
|
+
## Limits
|
|
98
|
+
|
|
99
|
+
- An event class reached through a barrel (`@/contexts/billing/domain/events/index.js`), a renaming export, a default import or a namespace is not followed: its name is not compared. `ddd-ts-kit check` resolves the same import in the project.
|
|
100
|
+
- A decorator applied through a variable (`const declare = Repository(InvoiceRepository); @declare class ...`) is not recognised.
|
|
101
|
+
- That the dependency list matches the constructor and that a handler handles its message is checked by the compiler, not here; that an adapter implements its port is `ports/implements-never-extends`, and where a job lives and what it is named are `scheduling/job-triggers-use-case` and `scheduling/job-name`.
|
|
102
|
+
- That each role file holds a single declared class is `naming/one-concept-per-file` of `ddd-ts-kit check`.
|
|
103
|
+
- That the generated barrel `<context>.declarations.ts` lists every role file is `declarations/barrel-current` of `ddd-ts-kit check`: it is a fact of the project, not of one file.
|
|
104
|
+
- A role file written outside the folders of the table is not known to be one: `naming/suffix` and `tree/closed` of `ddd-ts-kit check` hold the tree.
|
|
105
|
+
- The unwritten `consumer` of `@IntegrationEventHandler` is also reported by `events-consumer-idempotent`, for what it costs at run time.
|
|
106
|
+
|
|
107
|
+
## With the CLI checker
|
|
108
|
+
|
|
109
|
+
`ddd-ts-kit check` reports the same id from the text of the files and stays the fast edit-time guard. This rule is the authority.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# ddd-ts-kit/domain-aggregate-encapsulation
|
|
2
|
+
|
|
3
|
+
Architecture id: `domain/aggregate-encapsulation` (added by this plugin). Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: `domain/aggregates/` and `domain/entities/` of a context, tests excluded.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
An aggregate guards its invariants. A public constructor lets anyone build an invalid one, a public mutable property or a setter lets anyone change it without the rule that should have run.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
- a public constructor (abstract classes are exempt)
|
|
14
|
+
- a class without constructor and without base class
|
|
15
|
+
- a public property that is neither `readonly` nor a method, including `public` constructor parameter properties and `accessor` fields
|
|
16
|
+
- a public `set` accessor, and a public `setX` method whose body only assigns to `this`
|
|
17
|
+
|
|
18
|
+
Incorrect:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
export class Invoice {
|
|
22
|
+
constructor(public status: string) {}
|
|
23
|
+
setStatus(status: string): void {
|
|
24
|
+
this.status = status;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Correct:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
export class Invoice extends AggregateRoot<string> {
|
|
33
|
+
private constructor(id: string, private state: InvoiceState) {
|
|
34
|
+
super(id);
|
|
35
|
+
}
|
|
36
|
+
static create(id: string, now: Date): Invoice {
|
|
37
|
+
return new Invoice(id, { createdAt: now });
|
|
38
|
+
}
|
|
39
|
+
issue(at: Date): void {
|
|
40
|
+
this.state = { ...this.state, issuedAt: at };
|
|
41
|
+
this.record(new InvoiceIssued(this.id, at));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Details
|
|
47
|
+
|
|
48
|
+
A class that extends another one and declares no constructor inherits the visibility of its base: `AggregateRoot` and `Entity` of the kernel are protected.
|
|
49
|
+
|
|
50
|
+
## Options
|
|
51
|
+
|
|
52
|
+
None.
|
|
53
|
+
|
|
54
|
+
`rules."domain/aggregate-encapsulation"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line domain/aggregate-encapsulation -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
55
|
+
|
|
56
|
+
## Limits
|
|
57
|
+
|
|
58
|
+
- The visibility of an inherited constructor is not checked (no type information is used).
|
|
59
|
+
- A `setX` method that does anything besides assigning is trusted to be an intention.
|
|
60
|
+
|
|
61
|
+
## With the CLI checker
|
|
62
|
+
|
|
63
|
+
New with this plugin: the CLI checker has no equivalent, because the shape of a class needs a syntax tree.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# ddd-ts-kit/domain-events-dispatched-on-save
|
|
2
|
+
|
|
3
|
+
Architecture id: `domain-events/dispatched-on-save`. Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: `application/` and `infrastructure/` of a context, tests excluded.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
Domain events leave with the save. After a repository method that was handed an aggregate resolves, the events the aggregate recorded are dispatched in order, inside the unit of work of the command, so their handlers and the outbox commit or roll back with the state change. A handler that pulls the events and dispatches them itself announces them a second time, or announces them outside the transaction; a repository adapter that dispatches mixes persistence with wiring. Events leave with the save: `await repository.save(aggregate)` and nothing else; a removal that announces an event takes the aggregate.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
- a call to `.pullEvents()` in any production file under `application/` or `infrastructure/` of a context
|
|
14
|
+
- in `application/commands/`, `application/queries/` and a repository adapter (`infrastructure/persistence/**/*.repository.ts`): `DomainEventDispatcher` imported (from any module, type-only imports included), named in a dependency list, or typing a constructor parameter
|
|
15
|
+
|
|
16
|
+
Incorrect:
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
// src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
|
|
20
|
+
import { Clock, DomainEventDispatcher } from '@ddd-ts-kit/kernel';
|
|
21
|
+
|
|
22
|
+
@CommandHandler(IssueInvoice, [InvoiceRepository, Clock, DomainEventDispatcher])
|
|
23
|
+
export class IssueInvoiceHandler {
|
|
24
|
+
constructor(
|
|
25
|
+
private readonly invoices: InvoiceRepository,
|
|
26
|
+
private readonly clock: Clock,
|
|
27
|
+
private readonly dispatcher: DomainEventDispatcher,
|
|
28
|
+
) {}
|
|
29
|
+
|
|
30
|
+
async execute(command: IssueInvoice): Promise<string> {
|
|
31
|
+
const invoice = Invoice.issue(command.customerId, this.clock.now());
|
|
32
|
+
|
|
33
|
+
await this.invoices.save(invoice);
|
|
34
|
+
await this.dispatcher.dispatch(invoice.pullEvents());
|
|
35
|
+
|
|
36
|
+
return invoice.id;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Correct:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
// src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
|
|
45
|
+
import { Clock } from '@ddd-ts-kit/kernel';
|
|
46
|
+
|
|
47
|
+
@CommandHandler(IssueInvoice, [InvoiceRepository, Clock])
|
|
48
|
+
export class IssueInvoiceHandler {
|
|
49
|
+
constructor(
|
|
50
|
+
private readonly invoices: InvoiceRepository,
|
|
51
|
+
private readonly clock: Clock,
|
|
52
|
+
) {}
|
|
53
|
+
|
|
54
|
+
async execute(command: IssueInvoice): Promise<string> {
|
|
55
|
+
const invoice = Invoice.issue(command.customerId, this.clock.now());
|
|
56
|
+
|
|
57
|
+
await this.invoices.save(invoice);
|
|
58
|
+
|
|
59
|
+
return invoice.id;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Details
|
|
65
|
+
|
|
66
|
+
`pullEvents` is read as a method call on anything (`invoice.pullEvents()`, `this.invoice?.pullEvents()`, `invoice['pullEvents']()`): a declaration of that name and a bare identifier are not calls. A dependency list is the last argument of a declaration decorator of `@ddd-ts-kit/kernel/declarations` (`@CommandHandler(M, [..])`, `@QueryHandler`, `@Repository`) and the second argument of `.toClass(C, [..])` and `.handledBy(H, [..])`.
|
|
67
|
+
|
|
68
|
+
Not judged: `domain/` (the aggregate records and hands over its own events), the specs and everything under `test/` of a context, `<context>.module.ts` (the explicit module may still register event handlers on the dispatcher), the platform, `main.ts`, `apps/` and every file outside a context. `application/event-handlers/` and `application/integration/` are held to the `pullEvents()` part only.
|
|
69
|
+
|
|
70
|
+
## Options
|
|
71
|
+
|
|
72
|
+
None.
|
|
73
|
+
|
|
74
|
+
`rules."domain-events/dispatched-on-save"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line domain-events/dispatched-on-save -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
75
|
+
|
|
76
|
+
## Limits
|
|
77
|
+
|
|
78
|
+
- A dispatcher reached under another name (a re-export renamed by a barrel, a home-made port that wraps it) is not recognised.
|
|
79
|
+
- Events pulled by a helper that lives in the platform or in the shared kernel and is called from a handler are not followed.
|
|
80
|
+
|
|
81
|
+
## With the CLI checker
|
|
82
|
+
|
|
83
|
+
`ddd-ts-kit check` reports the same id from the text of the files: one finding per line that calls `.pullEvents(`, per import that binds `DomainEventDispatcher`, per dependency list and per constructor that names it. This rule is the authority.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# ddd-ts-kit/domain-events-transactional-before-commit
|
|
2
|
+
|
|
3
|
+
Architecture id: `domain-events/transactional-before-commit`. Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: production files of a context, on every class carrying `@DomainEventHandler`.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
An effect of a domain event exists only if the state change that recorded the event is committed. A handler that runs before the commit (the default phase) runs inside the transaction of the command, and the commit itself can still fail after the handler ran: a deferred constraint, a serialization failure, a lost connection. That is safe only when the rollback undoes everything the handler did, so a before-commit handler may only have transactional effects. A cache entry, a lock, a job, a message on the bus or a call to a remote system would survive the rollback and tell the world about a fact that never happened.
|
|
10
|
+
|
|
11
|
+
Declare the handler `phase: 'after-commit'` when its effect may be lost on a crash (it then runs at most once), or publish an integration event from a publisher (outbox, at least once) and do the work in the handler of that event when it must not be lost.
|
|
12
|
+
|
|
13
|
+
## Reported
|
|
14
|
+
|
|
15
|
+
The phase of a handler is `after-commit` when the options object of its `@DomainEventHandler` writes `phase: 'after-commit'`; otherwise it is `before-commit`. Its dependencies are the names of the dependency list of the decorator and the types of its constructor parameters, each resolved through the imports of the file.
|
|
16
|
+
|
|
17
|
+
For a before-commit handler, a dependency that is:
|
|
18
|
+
|
|
19
|
+
- `Cache`, `Lock`, `RateLimiter`, `JobScheduler` or `EventBus` of `@ddd-ts-kit/kernel`
|
|
20
|
+
- imported from `infrastructure/` of its context
|
|
21
|
+
- imported from another context
|
|
22
|
+
- imported from the platform directory
|
|
23
|
+
- imported from a package other than `@ddd-ts-kit/kernel` and `@ddd-ts-kit/auth`, a Node.js builtin included
|
|
24
|
+
|
|
25
|
+
For an after-commit handler, a dependency on `IntegrationEventPublisher` of `@ddd-ts-kit/kernel`, and nothing else: after the commit nothing makes the outbox row atomic with a state change, so the handler sends a command through `CommandBus` instead.
|
|
26
|
+
|
|
27
|
+
Incorrect:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// src/contexts/billing/application/event-handlers/invoice-issued.event-handler.ts
|
|
31
|
+
import { Cache } from '@ddd-ts-kit/kernel';
|
|
32
|
+
import { DomainEventHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
33
|
+
import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository.js';
|
|
34
|
+
|
|
35
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [InvoiceRepository, Cache])
|
|
36
|
+
export class InvoiceIssuedEventHandler {
|
|
37
|
+
constructor(
|
|
38
|
+
private readonly invoices: InvoiceRepository,
|
|
39
|
+
private readonly cache: Cache,
|
|
40
|
+
) {}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued', phase: 'after-commit' }, [IntegrationEventPublisher])
|
|
46
|
+
export class InvoiceIssuedEventHandler {}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Correct:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// the state the handler changes commits or rolls back with the command
|
|
53
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [InvoiceRepository, CommandBus])
|
|
54
|
+
export class InvoiceIssuedEventHandler {}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
// an effect no transaction covers runs once the transaction has committed, at most once
|
|
59
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued', phase: 'after-commit' }, [Cache])
|
|
60
|
+
export class InvoiceIssuedEventHandler {}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// an effect that must not be lost goes through the outbox: the handler of the integration event does the work
|
|
65
|
+
@DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [IntegrationEventPublisher, IdGenerator])
|
|
66
|
+
export class InvoiceIssuedPublisher {}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Details
|
|
70
|
+
|
|
71
|
+
A before-commit handler may depend on anything of the `domain/` layer of its context (a repository port, a domain service), on every other port of `@ddd-ts-kit/kernel` (`IntegrationEventPublisher`, `CommandBus`, `QueryBus`, `Clock`, `IdGenerator`, `Logger`, `Metrics`, `ActorContext`, `ExecutionScope`..), on `@ddd-ts-kit/auth`, and on the files of its context outside `infrastructure/` and `application/ports/`. A kernel port imported under another name (`import { Cache as Entries }`) is recognised by the name the kernel exports.
|
|
72
|
+
|
|
73
|
+
Only names that are dependencies are judged: a type-only import that types a method parameter, or an import the class never receives, is not a dependency. A name the file does not import is left alone.
|
|
74
|
+
|
|
75
|
+
## Options
|
|
76
|
+
|
|
77
|
+
None.
|
|
78
|
+
|
|
79
|
+
`rules."domain-events/transactional-before-commit"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line domain-events/transactional-before-commit -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
80
|
+
|
|
81
|
+
## Limits
|
|
82
|
+
|
|
83
|
+
ESLint judges one file, so two parts of the rule are held by `ddd-ts-kit check` alone:
|
|
84
|
+
|
|
85
|
+
- A port of `application/ports/` of the context is accepted before the commit only when it is a persistence port: at least one production class implements it under `infrastructure/persistence/` and none anywhere else under `infrastructure/`. Where the adapters of a port live is not in the file of the handler: this rule reports no port of `application/ports/`.
|
|
86
|
+
- In the explicit styles the class carries no decorator and its phase is the third argument of its `.on(name, callback, { phase: 'after-commit' })` registration in `<context>.module.ts`: a handler without `@DomainEventHandler` is not judged here.
|
|
87
|
+
|
|
88
|
+
Also not seen: a dependency list held in a constant, a port reached through a namespace import (`kernel.Cache`) or a barrel that renames it, and an effect reached without a dependency (a module-level client, a static call).
|
|
89
|
+
|
|
90
|
+
## With the CLI checker
|
|
91
|
+
|
|
92
|
+
`ddd-ts-kit check` reports the same id from the text of the files, and adds what needs the project: the adapters of a port of `application/ports/`, and the phase and the `.toClass(Handler, [..])` list written in the module file of an explicit-style context. This rule is the authority for what one declared class shows.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# ddd-ts-kit/domain-no-generic-error
|
|
2
|
+
|
|
3
|
+
Architecture id: `domain/no-generic-error` (added by this plugin). Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: `domain/` and `application/` of a context, tests excluded.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
An expected business failure has a name and a stable code that presentation maps to a status in one place. `new Error("...")` gives the caller a sentence to parse.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
- `throw new Error(...)` and `throw Error(...)`
|
|
14
|
+
|
|
15
|
+
Incorrect:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
throw new Error('Invoice already issued');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Correct:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
throw new InvoiceAlreadyIssued(this.id);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
None.
|
|
30
|
+
|
|
31
|
+
`rules."domain/no-generic-error"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line domain/no-generic-error -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
32
|
+
|
|
33
|
+
## Limits
|
|
34
|
+
|
|
35
|
+
- Only the global `Error` is reported: `TypeError` and friends are left to review.
|
|
36
|
+
- A generic error returned in a `Result` (`err(new Error())`) or rejected (`Promise.reject`) is not seen.
|
|
37
|
+
|
|
38
|
+
## With the CLI checker
|
|
39
|
+
|
|
40
|
+
New with this plugin: the CLI checker has no equivalent, because the shape of a class needs a syntax tree.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ddd-ts-kit/domain-value-object-immutability
|
|
2
|
+
|
|
3
|
+
Architecture id: `domain/value-object-immutability` (added by this plugin). Default severity: `error` in `recommended`, `error` in `strict`.
|
|
4
|
+
|
|
5
|
+
Applies to: `domain/value-objects/` of a context, tests excluded.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
A value object is its value. If it can change, two holders of the same instance disagree about what they hold, and equality by value stops meaning anything.
|
|
10
|
+
|
|
11
|
+
## Reported
|
|
12
|
+
|
|
13
|
+
- a property or constructor parameter property without `readonly` (private and `#private` included)
|
|
14
|
+
- a `set` accessor
|
|
15
|
+
- outside the constructor, an assignment or an increment that starts at `this` (`this.props.cents += 1`)
|
|
16
|
+
- outside the constructor, an array mutator called on something of `this` (`push`, `pop`, `shift`, `unshift`, `splice`, `sort`, `reverse`, `fill`, `copyWithin`)
|
|
17
|
+
|
|
18
|
+
Incorrect:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
export class Amount {
|
|
22
|
+
constructor(private cents: number) {}
|
|
23
|
+
add(other: Amount): void {
|
|
24
|
+
this.cents += other.cents;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Correct:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
export class Amount extends ValueObject<AmountProps> {
|
|
33
|
+
add(other: Amount): Amount {
|
|
34
|
+
return new Amount({ cents: this.props.cents + other.props.cents });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Options
|
|
40
|
+
|
|
41
|
+
None.
|
|
42
|
+
|
|
43
|
+
`rules."domain/value-object-immutability"` in `ddd-ts-kit.config.json` set to `off` silences the rule, and `// ddd-ts-kit-disable-next-line domain/value-object-immutability -- <reason>` silences one line, exactly as for `ddd-ts-kit check`.
|
|
44
|
+
|
|
45
|
+
## Limits
|
|
46
|
+
|
|
47
|
+
- Deep immutability of what a property holds (`readonly items: string[]`) is not checked: prefer `readonly string[]`.
|
|
48
|
+
- `Map`, `Set` and object mutation through method calls is not seen.
|
|
49
|
+
|
|
50
|
+
## With the CLI checker
|
|
51
|
+
|
|
52
|
+
New with this plugin: the CLI checker has no equivalent, because the shape of a class needs a syntax tree.
|