@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,129 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { className } from '../support/classes/class-name.js';
|
|
3
|
+
import { constructorOf } from '../support/classes/constructor-of.js';
|
|
4
|
+
import { exportedClasses } from '../support/classes/exported-classes.js';
|
|
5
|
+
import { isCallable } from '../support/classes/is-callable.js';
|
|
6
|
+
import { memberName } from '../support/classes/member-name.js';
|
|
7
|
+
import { declarationReader } from '../support/declarations/declaration-reader.js';
|
|
8
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
9
|
+
import { descendants } from '../support/descendants.js';
|
|
10
|
+
import { propertyName } from '../support/globals/property-name.js';
|
|
11
|
+
import { importListener } from '../support/imports/import-listener.js';
|
|
12
|
+
import { inContext } from '../support/imports/in-context.js';
|
|
13
|
+
import { dependencyListListener } from '../support/ports/dependency-list-listener.js';
|
|
14
|
+
import { importedBindings } from '../support/ports/imported-bindings.js';
|
|
15
|
+
import { isJobFile } from '../support/scheduling/is-job-file.js';
|
|
16
|
+
import { registeredJob } from '../support/scheduling/registered-job.js';
|
|
17
|
+
import { parameterTypeName } from '../support/types/parameter-type-name.js';
|
|
18
|
+
const MODEL_FOLDERS = new Set(['aggregates', 'entities', 'services']);
|
|
19
|
+
const IN_THE_COMMAND = 'A job is a schedule: it sends a command through the `CommandBus` and the work (loading aggregates, deciding, saving) is in the handler of that command, where it is authorized, transactional and tested like any other use case.';
|
|
20
|
+
export const schedulingJobTriggersUseCase = defineRule({
|
|
21
|
+
id: 'scheduling/job-triggers-use-case',
|
|
22
|
+
type: 'problem',
|
|
23
|
+
recommended: 'error',
|
|
24
|
+
description: 'A job only triggers use cases: it lives in application/scheduling, implements ScheduledJob, sends a command and touches neither a repository nor the model.',
|
|
25
|
+
messages: {
|
|
26
|
+
notAJob: 'This job file exports no class implementing `ScheduledJob`. Export one class `<Name>Job implements ScheduledJob` with a `run(execution)` method that sends a command.',
|
|
27
|
+
noCommand: `{{className}}.run sends no command: nothing in it calls \`.execute(..)\`. ${IN_THE_COMMAND} Write \`await this.commands.execute(new <Command>(systemActor('<context>.<job>'), execution.scheduledAt))\`.`,
|
|
28
|
+
repository: `{{className}} is given the repository {{name}}. ${IN_THE_COMMAND} Depend on \`CommandBus\` only and move what reads or writes {{name}} to the handler.`,
|
|
29
|
+
model: `This job imports {{target}}. ${IN_THE_COMMAND} Remove the import and move what needs it to the handler.`,
|
|
30
|
+
misplaced: '{{className}} is a scheduled job but lives in {{file}}. Move it to application/scheduling/<name>.job.ts of its context: a job is found, read and tested in one place.',
|
|
31
|
+
},
|
|
32
|
+
create({ file, sourceCode, report }) {
|
|
33
|
+
if (inContext(file) === undefined || file.isTest) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return isJobFile(file.config, file.path) ? jobFile(file, sourceCode, report) : elsewhere(file, sourceCode, report);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
function jobFile(file, sourceCode, tell) {
|
|
40
|
+
const imported = importedBindings(file, sourceCode.ast);
|
|
41
|
+
const isRepository = (name) => name !== undefined && isRepositoryFile(imported.get(name)?.target);
|
|
42
|
+
const owner = () => exportedClasses(sourceCode.ast)[0]?.id?.name ?? 'The job';
|
|
43
|
+
const lists = dependencyListListener(sourceCode.ast, (dependency) => {
|
|
44
|
+
if (isRepository(dependency.name)) {
|
|
45
|
+
tell({ node: dependency, messageId: 'repository', data: { className: owner(), name: dependency.name } });
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const imports = importListener(file, ({ node, target }) => {
|
|
49
|
+
if (isModel(target)) {
|
|
50
|
+
tell({ node, messageId: 'model', data: { target: describeModel(target) } });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
...imports,
|
|
55
|
+
...lists,
|
|
56
|
+
CallExpression(node) {
|
|
57
|
+
imports.CallExpression?.(node);
|
|
58
|
+
lists.CallExpression?.(node);
|
|
59
|
+
},
|
|
60
|
+
Program: (program) => judgeJobs(program, isRepository, tell),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function judgeJobs(program, isRepository, tell) {
|
|
64
|
+
const jobs = exportedClasses(program).filter((node) => node.implements.some((port) => port.expression.type === AST_NODE_TYPES.Identifier && port.expression.name === 'ScheduledJob'));
|
|
65
|
+
if (jobs.length === 0) {
|
|
66
|
+
tell({ loc: { line: 1, column: 0 }, messageId: 'notAJob' });
|
|
67
|
+
}
|
|
68
|
+
for (const job of jobs) {
|
|
69
|
+
judgeJob(job, isRepository, tell);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function judgeJob(job, isRepository, tell) {
|
|
73
|
+
const run = job.body.body.find((member) => isCallable(member) && memberName(member) === 'run');
|
|
74
|
+
if (run === undefined || !sendsCommand(run)) {
|
|
75
|
+
tell({ node: run ?? job.id ?? job, messageId: 'noCommand', data: { className: className(job) } });
|
|
76
|
+
}
|
|
77
|
+
for (const parameter of constructorOf(job.body)?.value.params ?? []) {
|
|
78
|
+
const name = parameterTypeName(parameter);
|
|
79
|
+
if (isRepository(name)) {
|
|
80
|
+
tell({ node: parameter, messageId: 'repository', data: { className: className(job), name } });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function sendsCommand(run) {
|
|
85
|
+
return [...descendants(run)].some((node) => node.type === AST_NODE_TYPES.CallExpression &&
|
|
86
|
+
node.callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
87
|
+
propertyName(node.callee) === 'execute');
|
|
88
|
+
}
|
|
89
|
+
function isRepositoryFile(target) {
|
|
90
|
+
return (target?.kind === 'file' &&
|
|
91
|
+
target.location.area === 'context' &&
|
|
92
|
+
target.location.layer === 'domain' &&
|
|
93
|
+
target.location.inside[0] === 'repositories');
|
|
94
|
+
}
|
|
95
|
+
function isModel(target) {
|
|
96
|
+
if (target.kind !== 'file' || target.location.area !== 'context') {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
const { layer, inside } = target.location;
|
|
100
|
+
return layer === 'infrastructure' || (layer === 'domain' && MODEL_FOLDERS.has(inside[0] ?? ''));
|
|
101
|
+
}
|
|
102
|
+
function describeModel(target) {
|
|
103
|
+
if (target.kind !== 'file' || target.location.area !== 'context') {
|
|
104
|
+
return 'the model';
|
|
105
|
+
}
|
|
106
|
+
return target.location.layer === 'infrastructure' ? 'infrastructure/' : `domain/${target.location.inside[0] ?? ''}/`;
|
|
107
|
+
}
|
|
108
|
+
/** Outside application/scheduling: no class carries `@Scheduled`, and a module registers only jobs that live there. */
|
|
109
|
+
function elsewhere(file, sourceCode, tell) {
|
|
110
|
+
const declarationsOf = declarationReader(sourceCode.ast);
|
|
111
|
+
const imported = importedBindings(file, sourceCode.ast);
|
|
112
|
+
const judgeClass = (node) => {
|
|
113
|
+
for (const declaration of declarationsOf(node).filter((candidate) => candidate.name === 'Scheduled')) {
|
|
114
|
+
tell({ node: declaration.node, messageId: 'misplaced', data: { className: className(node), file: file.path } });
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
ClassDeclaration: judgeClass,
|
|
119
|
+
ClassExpression: judgeClass,
|
|
120
|
+
CallExpression(node) {
|
|
121
|
+
const handler = registeredJob(node)?.handler;
|
|
122
|
+
const target = handler === undefined ? undefined : imported.get(handler.name)?.target;
|
|
123
|
+
if (handler !== undefined && target?.kind === 'file' && !isJobFile(file.config, target.path)) {
|
|
124
|
+
tell({ node: handler, messageId: 'misplaced', data: { className: handler.name, file: target.path } });
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=scheduling-job-triggers-use-case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduling-job-triggers-use-case.js","sourceRoot":"","sources":["../../src/rules/scheduling-job-triggers-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AAGxF,OAAO,EAAE,SAAS,EAAkB,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,UAAU,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAO5E,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEtE,MAAM,cAAc,GAClB,mOAAmO,CAAC;AAEtO,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAY;IAChE,EAAE,EAA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AAI,CAAC,EAAE,CAAC;gBAC7F,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACxG,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-no-parallel-interface.d.ts","sourceRoot":"","sources":["../../src/rules/standard-no-parallel-interface.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,2BAA2B,oKAmCtC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
3
|
+
import { inSourceRoot } from '../support/imports/in-source-root.js';
|
|
4
|
+
import { BOUNDARY_NAMES } from '../support/standard-interfaces/boundary-names.js';
|
|
5
|
+
import { parallelNames } from '../support/standard-interfaces/parallel-names.js';
|
|
6
|
+
import { standardNamesIn } from '../support/standard-interfaces/standard-names-in.js';
|
|
7
|
+
export const standardNoParallelInterface = defineRule({
|
|
8
|
+
id: 'standard/no-parallel-interface',
|
|
9
|
+
type: 'suggestion',
|
|
10
|
+
recommended: 'warn',
|
|
11
|
+
description: 'No home-made copy of a standard interface of the kernel (ILogger, UserContext, PaginatedResult): use the kernel one and extend it by declaration merging.',
|
|
12
|
+
messages: {
|
|
13
|
+
parallel: '{{name}} is a home-made copy of a standard interface: use {{instead}}. Standard interfaces come from @ddd-ts-kit/kernel: import the one named here, and add the fields of the project by declaration merging of the extension interface it leaves open (SessionExtensions, ExecutionContextExtensions, ActorExtensions, LogFields, MetricLabels); an implementation is a class named after its technology (`PinoLogger implements Logger`).',
|
|
14
|
+
},
|
|
15
|
+
create({ file, report }) {
|
|
16
|
+
if (file.isTest || !inSourceRoot(file)) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
const names = parallelNames(file.config.standardInterfaces);
|
|
20
|
+
const judge = (node) => {
|
|
21
|
+
const name = node.id?.name ?? '';
|
|
22
|
+
const instead = names.get(name);
|
|
23
|
+
if (instead === undefined ||
|
|
24
|
+
node.id === null ||
|
|
25
|
+
isAtTheBoundary(file, name) ||
|
|
26
|
+
isImplementation(node, standardNamesIn(instead))) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
report({ node: node.id, messageId: 'parallel', data: { name, instead } });
|
|
30
|
+
};
|
|
31
|
+
return { ClassDeclaration: judge, TSInterfaceDeclaration: judge, TSTypeAliasDeclaration: judge };
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
function isAtTheBoundary({ location }, name) {
|
|
35
|
+
if (!BOUNDARY_NAMES.includes(name)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return location.area === 'platform' || (location.area === 'context' && location.layer === 'presentation');
|
|
39
|
+
}
|
|
40
|
+
/** A class that implements or extends the standard interface is an implementation of it, not a second interface. */
|
|
41
|
+
function isImplementation(node, standardNames) {
|
|
42
|
+
if (node.type !== AST_NODE_TYPES.ClassDeclaration) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const heritage = [node.superClass, ...node.implements.map((port) => port.expression)];
|
|
46
|
+
return heritage.some((type) => type !== null && standardNames.includes(lastName(type) ?? ''));
|
|
47
|
+
}
|
|
48
|
+
/** `Logger` for `Logger` and for `kernel.Logger`. */
|
|
49
|
+
function lastName(type) {
|
|
50
|
+
if (type.type === AST_NODE_TYPES.Identifier) {
|
|
51
|
+
return type.name;
|
|
52
|
+
}
|
|
53
|
+
return type.type === AST_NODE_TYPES.MemberExpression && type.property.type === AST_NODE_TYPES.Identifier
|
|
54
|
+
? type.property.name
|
|
55
|
+
: undefined;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=standard-no-parallel-interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-no-parallel-interface.js","sourceRoot":"","sources":["../../src/rules/standard-no-parallel-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAItF,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAa;IAChE,EAAE,EAAE,gCAAgC;IACpC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,MAAM;IACnB,WAAW,EACT,2JAA2J;IAC7J,QAAQ,EAAE;QACR,QAAQ,EACN,6aAA6a;KAChb;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;QACrB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YACvC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAE5D,MAAM,KAAK,GAAG,CAAC,IAAiB,EAAQ,EAAE;YACxC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEhC,IACE,OAAO,KAAK,SAAS;gBACrB,IAAI,CAAC,EAAE,KAAK,IAAI;gBAChB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;gBAC3B,gBAAgB,CAAC,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,EAChD,C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AC,UAAU,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;QACtG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI;QACpB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-no-mocks.d.ts","sourceRoot":"","sources":["../../src/rules/test-no-mocks.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,WAAW,4KA+BtB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
2
|
+
import { ambientName } from '../support/globals/ambient-name.js';
|
|
3
|
+
import { propertyName } from '../support/globals/property-name.js';
|
|
4
|
+
import { importListener } from '../support/imports/import-listener.js';
|
|
5
|
+
const MOCKING_MEMBERS = new Set(['mock', 'doMock', 'unstable_mockModule', 'fn', 'spyOn', 'mocked']);
|
|
6
|
+
const MOCKING_GLOBALS = new Set(['vi', 'jest']);
|
|
7
|
+
const MOCKING_LIBRARIES = new Set([
|
|
8
|
+
'sinon',
|
|
9
|
+
'ts-mockito',
|
|
10
|
+
'jest-mock',
|
|
11
|
+
'jest-mock-extended',
|
|
12
|
+
'vitest-mock-extended',
|
|
13
|
+
'testdouble',
|
|
14
|
+
'ts-auto-mock',
|
|
15
|
+
'typemoq',
|
|
16
|
+
'moq.ts',
|
|
17
|
+
'@golevelup/ts-jest',
|
|
18
|
+
'@golevelup/ts-vitest',
|
|
19
|
+
]);
|
|
20
|
+
const INSTEAD = 'Use the fake of the port from test/fakes (a working in-memory implementation) and assert its state, the events on the in-memory bus or the returned value instead of calls.';
|
|
21
|
+
export const testNoMocks = defineRule({
|
|
22
|
+
id: 'test/no-mocks',
|
|
23
|
+
type: 'suggestion',
|
|
24
|
+
recommended: 'warn',
|
|
25
|
+
description: "No vi.mock, jest.mock, vi.fn, jest.fn, vi.spyOn, jest.spyOn or mocking library in a context's tests: use the fake of the port.",
|
|
26
|
+
messages: {
|
|
27
|
+
mock: `The test uses {{what}}. ${INSTEAD}`,
|
|
28
|
+
library: `The test imports the mocking library "{{name}}". ${INSTEAD}`,
|
|
29
|
+
},
|
|
30
|
+
create({ file, sourceCode, report }) {
|
|
31
|
+
if (file.location.area !== 'context' || !file.isTest) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
...importListener(file, ({ node, target }) => {
|
|
36
|
+
if (target.kind === 'package' && MOCKING_LIBRARIES.has(target.name)) {
|
|
37
|
+
report({ node, messageId: 'library', data: { name: target.name } });
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
MemberExpression(node) {
|
|
41
|
+
const object = ambientName(sourceCode, node.object) ?? '';
|
|
42
|
+
const member = propertyName(node) ?? '';
|
|
43
|
+
if (MOCKING_GLOBALS.has(object) && MOCKING_MEMBERS.has(member)) {
|
|
44
|
+
report({ node, messageId: 'mock', data: { what: `${object}.${member}` } });
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=test-no-mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-no-mocks.js","sourceRoot":"","sources":["../../src/rules/test-no-mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,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MAAM,MAAM,GAAG,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC1D,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAExC,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC/D,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7E,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing-platform-only.d.ts","sourceRoot":"","sources":["../../src/rules/tracing-platform-only.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB,mKAyB9B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { importListener } from '../support/imports/import-listener.js';
|
|
2
|
+
import { inSourceRoot } from '../support/imports/in-source-root.js';
|
|
3
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
4
|
+
const TRACING_PACKAGE = '@ddd-ts-kit/tracing';
|
|
5
|
+
const OPEN_TELEMETRY_SCOPE = '@opentelemetry/';
|
|
6
|
+
export const tracingPlatformOnly = defineRule({
|
|
7
|
+
id: 'tracing/platform-only',
|
|
8
|
+
type: 'problem',
|
|
9
|
+
recommended: 'error',
|
|
10
|
+
description: 'Tracing is wired once: `@ddd-ts-kit/tracing` and `@opentelemetry/*` are imported only by the platform directory, `main.ts` and `apps/`.',
|
|
11
|
+
messages: {
|
|
12
|
+
tracing: '"{{specifier}}" is imported in {{place}}: tracing is wired once, by the platform. Remove the import: adapters, use cases, events and jobs are observed from outside by `traceApplication()`, given to the kernel module at the composition root; what has to open a span of its own lives in {{platform}}/.',
|
|
13
|
+
},
|
|
14
|
+
create({ file, report }) {
|
|
15
|
+
if (!isJudged(file)) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
return importListener(file, ({ node, specifier, target }) => {
|
|
19
|
+
if (target.kind === 'package' && isTracing(target.name)) {
|
|
20
|
+
report({
|
|
21
|
+
node,
|
|
22
|
+
messageId: 'tracing',
|
|
23
|
+
data: { specifier, place: placeOf(file), platform: file.config.platformDir },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
/** Every source under the source root, tests included, but the platform, `main.ts` and the entry points under `apps/`. */
|
|
30
|
+
function isJudged(file) {
|
|
31
|
+
const { area } = file.location;
|
|
32
|
+
return (inSourceRoot(file) &&
|
|
33
|
+
area !== 'platform' &&
|
|
34
|
+
area !== 'main' &&
|
|
35
|
+
!file.path.startsWith(`${file.config.sourceRoot}/apps/`));
|
|
36
|
+
}
|
|
37
|
+
function isTracing(packageName) {
|
|
38
|
+
return packageName === TRACING_PACKAGE || packageName.startsWith(OPEN_TELEMETRY_SCOPE);
|
|
39
|
+
}
|
|
40
|
+
function placeOf({ location, path }) {
|
|
41
|
+
if (location.area === 'shared-kernel') {
|
|
42
|
+
return 'the shared kernel';
|
|
43
|
+
}
|
|
44
|
+
if (location.area !== 'context') {
|
|
45
|
+
return path;
|
|
46
|
+
}
|
|
47
|
+
if (location.layer === 'module') {
|
|
48
|
+
return `the module file of "${location.context}"`;
|
|
49
|
+
}
|
|
50
|
+
return location.layer === 'root' ? path : `${location.layer}/`;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=tracing-platform-only.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracing-platform-only.js","sourceRoot":"","sources":["../../src/rules/tracing-platform-only.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YA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,CAAC,UAAU,QAAQ,CAAC,CACzD,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,WAAmB;IACpC,OAAO,WAAW,KAAK,eAAe,IAAI,WAAW,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAc;IAC7C,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QACtC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,uBAAuB,QAAQ,CAAC,OAAO,GAAG,CAAC;IACpD,CAAC;IAED,OAAO,QAAQ,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ancestors.d.ts","sourceRoot":"","sources":["../../src/support/ancestors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,+EAA+E;AAC/E,wBAAiB,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAIxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ancestors.js","sourceRoot":"","sources":["../../src/support/ancestors.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,SAAS,CAAC,CAAC,SAAS,CAAC,IAAmB;IAC5C,KAAK,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAClE,MAAM,OAAO,CAAC;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
/** The last name of an access: `access` for `access`, `this.access` and `this.#access` (with its hash). */
|
|
3
|
+
export declare function accessedName(node: TSESTree.Node): string | undefined;
|
|
4
|
+
//# sourceMappingURL=accessed-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessed-name.d.ts","sourceRoot":"","sources":["../../../src/support/calls/accessed-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzE,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAUpE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { keyName } from '../classes/key-name.js';
|
|
3
|
+
import { propertyName } from '../globals/property-name.js';
|
|
4
|
+
/** The last name of an access: `access` for `access`, `this.access` and `this.#access` (with its hash). */
|
|
5
|
+
export function accessedName(node) {
|
|
6
|
+
if (node.type === AST_NODE_TYPES.Identifier) {
|
|
7
|
+
return node.name;
|
|
8
|
+
}
|
|
9
|
+
if (node.type !== AST_NODE_TYPES.MemberExpression) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return node.computed ? propertyName(node) : keyName(node.property);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=accessed-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessed-name.js","sourceRoot":"","sources":["../../../src/support/calls/accessed-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,2GAA2G;AAC3G,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QAClD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
/** The name a call is made under: `resolve` for `resolve(x)`, `bind` for `builder.bind(x)`. */
|
|
3
|
+
export declare function calleeName(node: TSESTree.CallExpression | TSESTree.NewExpression): string | undefined;
|
|
4
|
+
//# sourceMappingURL=callee-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callee-name.d.ts","sourceRoot":"","sources":["../../../src/support/calls/callee-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzE,+FAA+F;AAC/F,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,GAAG,QAAQ,CAAC,aAAa,GAAG,MAAM,GAAG,SAAS,CAQrG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { propertyName } from '../globals/property-name.js';
|
|
3
|
+
/** The name a call is made under: `resolve` for `resolve(x)`, `bind` for `builder.bind(x)`. */
|
|
4
|
+
export function calleeName(node) {
|
|
5
|
+
const { callee } = node;
|
|
6
|
+
if (callee.type === AST_NODE_TYPES.Identifier) {
|
|
7
|
+
return callee.name;
|
|
8
|
+
}
|
|
9
|
+
return callee.type === AST_NODE_TYPES.MemberExpression ? propertyName(callee) : undefined;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=callee-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callee-name.js","sourceRoot":"","sources":["../../../src/support/calls/callee-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,+FAA+F;AAC/F,MAAM,UAAU,UAAU,CAAC,IAAsD;IAC/E,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9C,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5F,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
/** With `{ ...defaults }` a key may be there without being written: the object cannot be judged for what it lacks. */
|
|
3
|
+
export declare function hasSpread(object: TSESTree.ObjectExpression): boolean;
|
|
4
|
+
//# sourceMappingURL=has-spread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-spread.d.ts","sourceRoot":"","sources":["../../../src/support/calls/has-spread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzE,sHAAsH;AACtH,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,GAAG,OAAO,CAEpE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
/** With `{ ...defaults }` a key may be there without being written: the object cannot be judged for what it lacks. */
|
|
3
|
+
export function hasSpread(object) {
|
|
4
|
+
return object.properties.some((property) => property.type === AST_NODE_TYPES.SpreadElement);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=has-spread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-spread.js","sourceRoot":"","sources":["../../../src/support/calls/has-spread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,sHAAsH;AACtH,MAAM,UAAU,SAAS,CAAC,MAAiC;IACzD,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,aAAa,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
export interface ChainLink {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly call: TSESTree.CallExpression;
|
|
5
|
+
}
|
|
6
|
+
/** `builder.command(X).requires(p).handledBy(H)` read from its last call: `command`, `requires`, `handledBy`. */
|
|
7
|
+
export declare function methodChain(last: TSESTree.CallExpression): ChainLink[];
|
|
8
|
+
//# sourceMappingURL=method-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method-chain.d.ts","sourceRoot":"","sources":["../../../src/support/calls/method-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC;CACxC;AAED,iHAAiH;AACjH,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,GAAG,SAAS,EAAE,CAUtE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { propertyName } from '../globals/property-name.js';
|
|
3
|
+
/** `builder.command(X).requires(p).handledBy(H)` read from its last call: `command`, `requires`, `handledBy`. */
|
|
4
|
+
export function methodChain(last) {
|
|
5
|
+
const links = [];
|
|
6
|
+
let current = last;
|
|
7
|
+
while (current.type === AST_NODE_TYPES.CallExpression && current.callee.type === AST_NODE_TYPES.MemberExpression) {
|
|
8
|
+
links.unshift({ name: propertyName(current.callee) ?? '', call: current });
|
|
9
|
+
current = current.callee.object;
|
|
10
|
+
}
|
|
11
|
+
return links;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=method-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method-chain.js","sourceRoot":"","sources":["../../../src/support/calls/method-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAO3D,iHAAiH;AACjH,MAAM,UAAU,WAAW,CAAC,IAA6B;IACvD,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,IAAI,OAAO,GAAkB,IAAI,CAAC;IAElC,OAAO,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACjH,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3E,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* The keys of `required` an options argument visibly lacks. An argument that is not an object
|
|
4
|
+
* literal, or that spreads another object, is not judged: nothing is reported as missing.
|
|
5
|
+
*/
|
|
6
|
+
export declare function missingKeys(options: TSESTree.Node | undefined, required: readonly string[]): string[];
|
|
7
|
+
//# sourceMappingURL=missing-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-keys.d.ts","sourceRoot":"","sources":["../../../src/support/calls/missing-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAKzE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAUrG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { staticString } from '../imports/static-string.js';
|
|
3
|
+
import { propertyOf } from './property-of.js';
|
|
4
|
+
import { hasSpread } from './has-spread.js';
|
|
5
|
+
/**
|
|
6
|
+
* The keys of `required` an options argument visibly lacks. An argument that is not an object
|
|
7
|
+
* literal, or that spreads another object, is not judged: nothing is reported as missing.
|
|
8
|
+
*/
|
|
9
|
+
export function missingKeys(options, required) {
|
|
10
|
+
if (options === undefined) {
|
|
11
|
+
return [...required];
|
|
12
|
+
}
|
|
13
|
+
if (options.type !== AST_NODE_TYPES.ObjectExpression || hasSpread(options)) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return required.filter((key) => !isGiven(propertyOf(options, key)));
|
|
17
|
+
}
|
|
18
|
+
function isGiven(property) {
|
|
19
|
+
if (property === undefined) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const { value } = property;
|
|
23
|
+
if (value.type === AST_NODE_TYPES.Identifier && value.name === 'undefined') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return staticString(value) !== '';
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=missing-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-keys.js","sourceRoot":"","sources":["../../../src/support/calls/missing-keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAkC,EAAE,QAA2B;IACzF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3E,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,OAAO,CAAC,QAAuC;IACtD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IAE3B,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-of.d.ts","sourceRoot":"","sources":["../../../src/support/calls/property-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzE,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAIxG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { keyName } from '../classes/key-name.js';
|
|
3
|
+
export function propertyOf(object, key) {
|
|
4
|
+
return object.properties
|
|
5
|
+
.filter((property) => property.type === AST_NODE_TYPES.Property)
|
|
6
|
+
.find((property) => !property.computed && keyName(property.key) === key);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=property-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-of.js","sourceRoot":"","sources":["../../../src/support/calls/property-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,MAAM,UAAU,UAAU,CAAC,MAAiC,EAAE,GAAW;IACvE,OAAO,MAAM,CAAC,UAAU;SACrB,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,QAAQ,CAAC;SAC/D,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TSESLint, type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import type { LintedFile } from '../../project/linted-file.js';
|
|
3
|
+
type Parser = TSESLint.FlatConfig.Parser;
|
|
4
|
+
/** A class and the program that declares it: the linted file, or the file it is imported from. */
|
|
5
|
+
interface ClassSite {
|
|
6
|
+
readonly program: TSESTree.Program;
|
|
7
|
+
readonly node: TSESTree.ClassDeclaration;
|
|
8
|
+
}
|
|
9
|
+
export type ClassFinder = (name: string) => ClassSite | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Finds the class behind a name of the linted file: declared at its top, or imported by name
|
|
12
|
+
* from a source of the project that exists on disk, which is then parsed with the parser of the
|
|
13
|
+
* run and nothing else (no types, no scope). A barrel, a renaming export or a file that cannot
|
|
14
|
+
* be read or parsed answers undefined: the caller then judges what it sees in the file alone.
|
|
15
|
+
*/
|
|
16
|
+
export declare function classFinder(file: LintedFile, program: TSESTree.Program, parser: Parser | undefined): ClassFinder;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=class-finder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-finder.d.ts","sourceRoot":"","sources":["../../../src/support/classes/class-finder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG/D,KAAK,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC;AAEzC,kGAAkG;AAClG,UAAU,SAAS;IACjB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,CAAC;CAC1C;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,GAAG,SAAS,CAAC;AAgBlE;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAoBhH"}
|