@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 @@
|
|
|
1
|
+
{"version":3,"file":"aspects-outside-in.js","sourceRoot":"","sources":["../../src/rules/aspects-outside-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAEjF,MAAM,UAAU,GAAG,GAAG,eAAe,aAAa,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAe;IACvD,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,OAAO;IACpB,WAAW,EACT,qKAAqK;IACvK,QAAQ,EAAE;QACR,UAAU,EAAE,IAAI,UAAU,4QAA4Q;KACvS;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;YAClD,IAAI,SAAS,KAAK,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE,CAAC;gBACvE,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,6HAA6H;AAC7H,SAAS,QAAQ,CAAC,IAAgB;IAChC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,gBAAgB,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9G,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,5 @@
|
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type MessageId = 'imported' | 'used' | 'helper' | 'injected' | 'read';
|
|
3
|
+
export declare const authzActorExplicit: TSESLint.RuleModule<MessageId, [], import("../index.js").RuleDocs, TSESLint.RuleListener>;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=authz-actor-explicit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-actor-explicit.d.ts","sourceRoot":"","sources":["../../src/rules/authz-actor-explicit.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAS7F,KAAK,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAuBtE,eAAO,MAAM,kBAAkB,2FA4C7B,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ASTUtils, AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import { accessedName } from '../support/calls/accessed-name.js';
|
|
3
|
+
import { declaredTypeName } from '../support/types/declared-type-name.js';
|
|
4
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
5
|
+
import { propertyName } from '../support/globals/property-name.js';
|
|
6
|
+
import { importListener } from '../support/imports/import-listener.js';
|
|
7
|
+
import { innerLayer } from '../support/imports/inner-layer.js';
|
|
8
|
+
import { parameterTypeName } from '../support/types/parameter-type-name.js';
|
|
9
|
+
/** The two ports that answer "who, in which unit of work" without being handed it. */
|
|
10
|
+
const AMBIENT_PORTS = new Set(['ActorContext', 'ExecutionScope']);
|
|
11
|
+
/** The ports, their adapters of the kernel and what those are built on: a class is a type and an injection token at once, so naming one is reading the ambient context. */
|
|
12
|
+
const AMBIENT = new Set([
|
|
13
|
+
...AMBIENT_PORTS,
|
|
14
|
+
'AsyncLocalStorageExecutionScope',
|
|
15
|
+
'ScopedActorContext',
|
|
16
|
+
'AsyncLocalStorage',
|
|
17
|
+
]);
|
|
18
|
+
/** Kernel helpers that read the execution scope for a repository adapter: audit columns and the tenant of a statement. */
|
|
19
|
+
const INFRASTRUCTURE_HELPERS = new Set(['tenantScopeOf', 'stampCreation', 'stampUpdate']);
|
|
20
|
+
const READS = new Set(['current', 'require']);
|
|
21
|
+
/** What an ambient context is called when its declaration is not in the file. */
|
|
22
|
+
const AMBIENT_RECEIVER = /^#?(?:actors|scopes?)$|actorContext$|executionScope$/i;
|
|
23
|
+
const INSTEAD = 'Read the actor from the command or query (`command.actor`, a message extending AuthorizedCommand or AuthorizedQuery) and pass what the model needs as a value; audit columns, tenant scoping and correlation are read from the execution scope by infrastructure and the platform only.';
|
|
24
|
+
export const authzActorExplicit = defineRule({
|
|
25
|
+
id: 'authz/actor-explicit',
|
|
26
|
+
type: 'problem',
|
|
27
|
+
recommended: 'error',
|
|
28
|
+
description: 'Use cases receive the actor in the command or query: domain/ and application/ never read the ambient ExecutionScope or ActorContext.',
|
|
29
|
+
messages: {
|
|
30
|
+
imported: `{{name}} is imported in the {{layer}} layer, as a type or as the port named in a dependency list: it gives the actor or the execution context of the current unit of work without anybody passing it. ${INSTEAD}`,
|
|
31
|
+
used: `{{name}} is used in the {{layer}} layer: it gives the actor or the execution context of the current unit of work without anybody passing it. ${INSTEAD}`,
|
|
32
|
+
helper: `{{name}} is used in the {{layer}} layer: it reads the execution scope to stamp audit columns or to scope a statement by tenant, which is the work of a repository adapter. ${INSTEAD}`,
|
|
33
|
+
injected: `{{className}} is given {{port}}: a use case whose actor is ambient cannot be called from an integration event handler, a job or a test without setting a global. ${INSTEAD}`,
|
|
34
|
+
read: `{{read}}() reads the ambient context in the {{layer}} layer. ${INSTEAD}`,
|
|
35
|
+
},
|
|
36
|
+
create({ file, sourceCode, report }) {
|
|
37
|
+
const layer = innerLayer(file);
|
|
38
|
+
if (layer === undefined) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
const named = (node, name) => {
|
|
42
|
+
if (name !== undefined && AMBIENT.has(name)) {
|
|
43
|
+
report({ node, messageId: 'used', data: { name, layer } });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
...importListener(file, ({ names }) => importedNames(names, layer, report)),
|
|
48
|
+
MemberExpression(node) {
|
|
49
|
+
named(node.property, propertyName(node));
|
|
50
|
+
if (isHelperOfNamespace(sourceCode, node)) {
|
|
51
|
+
report({ node: node.property, messageId: 'helper', data: { name: propertyName(node), layer } });
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
TSQualifiedName: (node) => named(node.right, node.right.name),
|
|
55
|
+
MethodDefinition: (node) => injectedPorts(node, report),
|
|
56
|
+
CallExpression(node) {
|
|
57
|
+
if (isAmbientRead(sourceCode, node)) {
|
|
58
|
+
report({ node, messageId: 'read', data: { read: sourceCode.getText(node.callee), layer } });
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
function importedNames(names, layer, report) {
|
|
65
|
+
for (const { name, node } of names.filter((imported) => AMBIENT.has(imported.name))) {
|
|
66
|
+
report({ node, messageId: 'imported', data: { name, layer } });
|
|
67
|
+
}
|
|
68
|
+
for (const { name, node } of names.filter((imported) => INFRASTRUCTURE_HELPERS.has(imported.name))) {
|
|
69
|
+
report({ node, messageId: 'helper', data: { name, layer } });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function injectedPorts(node, report) {
|
|
73
|
+
if (node.kind !== 'constructor') {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const className = node.parent.parent.id?.name ?? 'The class';
|
|
77
|
+
for (const parameter of node.value.params) {
|
|
78
|
+
const port = parameterTypeName(parameter);
|
|
79
|
+
if (port !== undefined && AMBIENT_PORTS.has(port)) {
|
|
80
|
+
report({ node: parameter, messageId: 'injected', data: { className, port } });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** `kernel.stampCreation` where `kernel` is an import: a method of the project that happens to carry the name is not the helper. */
|
|
85
|
+
function isHelperOfNamespace(sourceCode, node) {
|
|
86
|
+
if (node.object.type !== AST_NODE_TYPES.Identifier || !INFRASTRUCTURE_HELPERS.has(propertyName(node) ?? '')) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const definitions = ASTUtils.findVariable(sourceCode.getScope(node), node.object.name)?.defs ?? [];
|
|
90
|
+
return definitions.some((definition) => definition.type === TSESLint.Scope.DefinitionType.ImportBinding);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* `.current()` or `.require()` without argument on an ambient context. The declared type of the
|
|
94
|
+
* receiver decides when the file shows it; otherwise its name does.
|
|
95
|
+
*/
|
|
96
|
+
function isAmbientRead(sourceCode, node) {
|
|
97
|
+
const { callee } = node;
|
|
98
|
+
if (callee.type !== AST_NODE_TYPES.MemberExpression ||
|
|
99
|
+
node.arguments.length > 0 ||
|
|
100
|
+
!READS.has(propertyName(callee) ?? '')) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const declared = declaredTypeName(sourceCode, callee.object);
|
|
104
|
+
return declared === undefined ? AMBIENT_RECEIVER.test(accessedName(callee.object) ?? '') : AMBIENT.has(declared);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=authz-actor-explicit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-actor-explicit.js","sourceRoot":"","sources":["../../src/rules/authz-actor-explicit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAqB,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAK5E,sFAAsF;AACtF,MAAM,aAAa,GAAG,IAAI,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
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type MessageId = 'useCase' | 'message' | 'route' | 'emptySecurity' | 'actor';
|
|
3
|
+
export declare const authzDeclared: TSESLint.RuleModule<MessageId, [], import("../index.js").RuleDocs, TSESLint.RuleListener>;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=authz-declared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-declared.d.ts","sourceRoot":"","sources":["../../src/rules/authz-declared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAmBxF,KAAK,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,eAAe,GAAG,OAAO,CAAC;AAQ7E,eAAO,MAAM,aAAa,2FA8CxB,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { calleeName } from '../support/calls/callee-name.js';
|
|
3
|
+
import { hasSpread } from '../support/calls/has-spread.js';
|
|
4
|
+
import { methodChain } from '../support/calls/method-chain.js';
|
|
5
|
+
import { propertyOf } from '../support/calls/property-of.js';
|
|
6
|
+
import { className } from '../support/classes/class-name.js';
|
|
7
|
+
import { constructorOf } from '../support/classes/constructor-of.js';
|
|
8
|
+
import { exportedClasses } from '../support/classes/exported-classes.js';
|
|
9
|
+
import { ACCESS_DECORATORS } from '../support/declarations/access-decorators.js';
|
|
10
|
+
import { DECLARATIONS_ENTRY, declarationReader } from '../support/declarations/declaration-reader.js';
|
|
11
|
+
import { declaredRoleOf } from '../support/declarations/declared-role-of.js';
|
|
12
|
+
import { isDeclaredStyle } from '../support/declarations/is-declared-style.js';
|
|
13
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
14
|
+
import { inLayer } from '../support/imports/in-layer.js';
|
|
15
|
+
import { staticString } from '../support/imports/static-string.js';
|
|
16
|
+
import { classFinder } from '../support/classes/class-finder.js';
|
|
17
|
+
import { parameterBinding } from '../support/types/parameter-binding.js';
|
|
18
|
+
const REGISTRATIONS = new Set(['command', 'query']);
|
|
19
|
+
const HANDLER_BINDINGS = new Set(['handledBy', 'handledByFactory']);
|
|
20
|
+
const DECLARATIONS = new Set(['requires', 'public']);
|
|
21
|
+
const AUTHORIZED_BASES = new Set(['AuthorizedCommand', 'AuthorizedQuery']);
|
|
22
|
+
export const authzDeclared = defineRule({
|
|
23
|
+
id: 'authz/declared',
|
|
24
|
+
type: 'problem',
|
|
25
|
+
recommended: 'error',
|
|
26
|
+
description: 'Every command, query and route declares the permission it requires, or declares itself public, in its module registration or on the message class: nothing is reachable by default.',
|
|
27
|
+
messages: {
|
|
28
|
+
useCase: 'The {{kind}} {{name}} is registered without saying who may send it. Insert `.requires(<a permission of application/authorization>)` before `.{{binding}}(...)`, or `.public()` if anybody may: nothing is reachable by default.',
|
|
29
|
+
message: `The {{kind}} {{className}} says nothing about who may send it. Put \`@Requires(<a permission of application/authorization>)\` from "${DECLARATIONS_ENTRY}" on the class, or \`@Public()\` if anybody may: nothing is reachable by default.`,
|
|
30
|
+
route: "The route {{route}} declares no `security`. Add `security: ['<scheme>']` with the security schemes that apply, or `security: false` if the route is public.",
|
|
31
|
+
emptySecurity: 'The route {{route}} declares `security: []`: no scheme applies, so it is public by accident. Name the schemes that apply, or write `security: false`.',
|
|
32
|
+
actor: '{{className}} extends {{base}} but does not hand the actor it is given to `super(...)`. Take the actor as the first constructor parameter and pass it on, `constructor(actor: Actor, ...) { super(actor); }`: the caller says who acts, the message never decides it.',
|
|
33
|
+
},
|
|
34
|
+
create({ file, sourceCode, context, report }) {
|
|
35
|
+
if (file.isTest) {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
const isModule = inLayer(file, 'module') !== undefined;
|
|
39
|
+
const findClass = classFinder(file, sourceCode.ast, context.languageOptions.parser);
|
|
40
|
+
const tell = (finding) => {
|
|
41
|
+
if (finding !== undefined) {
|
|
42
|
+
report(finding);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const judgeClass = (node) => tell(unforwardedActor(node));
|
|
46
|
+
return {
|
|
47
|
+
Program: (program) => undeclaredMessages(file, program).forEach(tell),
|
|
48
|
+
CallExpression(node) {
|
|
49
|
+
if (isModule) {
|
|
50
|
+
tell(undeclaredUseCase(node, sourceCode, findClass));
|
|
51
|
+
}
|
|
52
|
+
tell(undeclaredRoute(node));
|
|
53
|
+
},
|
|
54
|
+
ClassDeclaration: judgeClass,
|
|
55
|
+
ClassExpression: judgeClass,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
/** In the declared style the message class itself says who may send it: there is no registration to read. */
|
|
60
|
+
function undeclaredMessages(file, program) {
|
|
61
|
+
const role = isDeclaredStyle(file) ? declaredRoleOf(file) : undefined;
|
|
62
|
+
if (role?.decorators.some((decorator) => ACCESS_DECORATORS.has(decorator)) !== true) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
const declarationsOf = declarationReader(program);
|
|
66
|
+
const silent = exportedClasses(program).filter((node) => !declarationsOf(node).some((declaration) => ACCESS_DECORATORS.has(declaration.name)));
|
|
67
|
+
return silent.map((node) => ({
|
|
68
|
+
node: node.id ?? node,
|
|
69
|
+
messageId: 'message',
|
|
70
|
+
data: { kind: role.suffix, className: className(node) },
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function undeclaredUseCase(node, sourceCode, findClass) {
|
|
74
|
+
const binding = node.callee.type === AST_NODE_TYPES.MemberExpression ? (calleeName(node) ?? '') : '';
|
|
75
|
+
if (!HANDLER_BINDINGS.has(binding)) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const chain = methodChain(node);
|
|
79
|
+
const [registration] = chain;
|
|
80
|
+
if (registration === undefined ||
|
|
81
|
+
!REGISTRATIONS.has(registration.name) ||
|
|
82
|
+
chain.some((link) => DECLARATIONS.has(link.name))) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const [message] = registration.call.arguments;
|
|
86
|
+
if (isDeclaredMessage(message, findClass)) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const name = message === undefined ? 'registered here' : sourceCode.getText(message);
|
|
90
|
+
return { node: registration.call, messageId: 'useCase', data: { kind: registration.name, name, binding } };
|
|
91
|
+
}
|
|
92
|
+
/** `@Requires(...)` or `@Public()` on the message class is the declaration, whoever registers the message. */
|
|
93
|
+
function isDeclaredMessage(message, findClass) {
|
|
94
|
+
const site = message?.type === AST_NODE_TYPES.Identifier ? findClass(message.name) : undefined;
|
|
95
|
+
return (site !== undefined &&
|
|
96
|
+
declarationReader(site.program)(site.node).some((declaration) => ACCESS_DECORATORS.has(declaration.name)));
|
|
97
|
+
}
|
|
98
|
+
function undeclaredRoute(node) {
|
|
99
|
+
const [spec] = node.arguments;
|
|
100
|
+
if (calleeName(node) !== 'defineRoute' || spec?.type !== AST_NODE_TYPES.ObjectExpression) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const messageId = judgeSecurity(spec);
|
|
104
|
+
return messageId === undefined
|
|
105
|
+
? undefined
|
|
106
|
+
: { node: propertyOf(spec, 'security') ?? spec, messageId, data: { route: routeLabel(spec) } };
|
|
107
|
+
}
|
|
108
|
+
function judgeSecurity(spec) {
|
|
109
|
+
const security = propertyOf(spec, 'security');
|
|
110
|
+
if (security === undefined) {
|
|
111
|
+
return hasSpread(spec) ? undefined : 'route';
|
|
112
|
+
}
|
|
113
|
+
const { value } = security;
|
|
114
|
+
if (value.type === AST_NODE_TYPES.ArrayExpression) {
|
|
115
|
+
return value.elements.length === 0 ? 'emptySecurity' : undefined;
|
|
116
|
+
}
|
|
117
|
+
return value.type === AST_NODE_TYPES.Identifier && value.name === 'undefined' ? 'route' : undefined;
|
|
118
|
+
}
|
|
119
|
+
function routeLabel(spec) {
|
|
120
|
+
const named = propertyOf(spec, 'operationId') ?? propertyOf(spec, 'path');
|
|
121
|
+
const label = named === undefined ? undefined : staticString(named.value);
|
|
122
|
+
return label === undefined ? 'defined here' : `"${label}"`;
|
|
123
|
+
}
|
|
124
|
+
function unforwardedActor(node) {
|
|
125
|
+
const base = node.superClass === null ? undefined : baseName(node.superClass);
|
|
126
|
+
const constructor = constructorOf(node.body);
|
|
127
|
+
if (base === undefined || !AUTHORIZED_BASES.has(base) || constructor === undefined) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const call = superCall(constructor);
|
|
131
|
+
if (call === undefined || forwardsParameter(call, constructor)) {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
return { node: call, messageId: 'actor', data: { className: className(node), base } };
|
|
135
|
+
}
|
|
136
|
+
function baseName(superClass) {
|
|
137
|
+
if (superClass.type === AST_NODE_TYPES.Identifier) {
|
|
138
|
+
return superClass.name;
|
|
139
|
+
}
|
|
140
|
+
return superClass.type === AST_NODE_TYPES.MemberExpression && superClass.property.type === AST_NODE_TYPES.Identifier
|
|
141
|
+
? superClass.property.name
|
|
142
|
+
: undefined;
|
|
143
|
+
}
|
|
144
|
+
function superCall(constructor) {
|
|
145
|
+
for (const statement of constructor.value.body?.body ?? []) {
|
|
146
|
+
const expression = statement.type === AST_NODE_TYPES.ExpressionStatement ? statement.expression : undefined;
|
|
147
|
+
if (expression?.type === AST_NODE_TYPES.CallExpression && expression.callee.type === AST_NODE_TYPES.Super) {
|
|
148
|
+
return expression;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
/** `super(actor)` or `super(input.actor)`, where the first name is a parameter of the constructor. */
|
|
154
|
+
function forwardsParameter(call, constructor) {
|
|
155
|
+
let root = call.arguments[0];
|
|
156
|
+
while (root?.type === AST_NODE_TYPES.MemberExpression) {
|
|
157
|
+
root = root.object;
|
|
158
|
+
}
|
|
159
|
+
if (root?.type !== AST_NODE_TYPES.Identifier) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
const given = root.name;
|
|
163
|
+
return constructor.value.params
|
|
164
|
+
.map(parameterBinding)
|
|
165
|
+
.some((binding) => binding.type === AST_NODE_TYPES.Identifier && binding.name === given);
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=authz-declared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-declared.js","sourceRoot":"","sources":["../../src/rules/authz-declared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,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,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAoB,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAKzE,MAAM,aAAa,GAAG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AED,sGAAsG;AACtG,SAAS,iBAAiB,CAAC,IAA6B,EAAE,WAAsC;IAC9F,IAAI,IAAI,GAA8B,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAExD,OAAO,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACtD,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;IAExB,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM;SAC5B,GAAG,CAAC,gBAAgB,CAAC;SACrB,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type MessageId = 'declaredOutside' | 'rights' | 'roleTest' | 'authorizerImport' | 'decision' | 'refusal' | 'authInDomain' | 'actorInDomain' | 'rightsInDomain';
|
|
3
|
+
export declare const authzInApplication: TSESLint.RuleModule<MessageId, [], import("../index.js").RuleDocs, TSESLint.RuleListener>;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=authz-in-application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-in-application.d.ts","sourceRoot":"","sources":["../../src/rules/authz-in-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAaxF,KAAK,SAAS,GACV,iBAAiB,GACjB,QAAQ,GACR,UAAU,GACV,kBAAkB,GAClB,UAAU,GACV,SAAS,GACT,cAAc,GACd,eAAe,GACf,gBAAgB,CAAC;AAqCrB,eAAO,MAAM,kBAAkB,2FAmC7B,CAAC"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { ancestors } from '../support/ancestors.js';
|
|
3
|
+
import { accessedName } from '../support/calls/accessed-name.js';
|
|
4
|
+
import { DECLARATIONS_ENTRY } from '../support/declarations/declaration-reader.js';
|
|
5
|
+
import { isDeclaredStyle } from '../support/declarations/is-declared-style.js';
|
|
6
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
7
|
+
import { propertyName } from '../support/globals/property-name.js';
|
|
8
|
+
import { importListener } from '../support/imports/import-listener.js';
|
|
9
|
+
import { inContext } from '../support/imports/in-context.js';
|
|
10
|
+
import { declaredTypeName } from '../support/types/declared-type-name.js';
|
|
11
|
+
import { startsAtThis } from '../support/members/starts-at-this.js';
|
|
12
|
+
const AUTH = '@ddd-ts-kit/auth';
|
|
13
|
+
const KERNEL = '@ddd-ts-kit/kernel';
|
|
14
|
+
const RIGHTS = new Set(['roles', 'permissions']);
|
|
15
|
+
const RIGHTS_AT_THE_BOUNDARY = new Set([...RIGHTS, 'isAdmin']);
|
|
16
|
+
const EQUALITY = new Set(['===', '!==', '==', '!=']);
|
|
17
|
+
/** What a route needs of the auth package: the actor and the session of the request, and the errors it may map. */
|
|
18
|
+
const REQUEST_GLUE = new Set([
|
|
19
|
+
'actorOf',
|
|
20
|
+
'sessionOf',
|
|
21
|
+
'resolveSession',
|
|
22
|
+
'SessionAuthenticator',
|
|
23
|
+
'bearerCredential',
|
|
24
|
+
'inActorContext',
|
|
25
|
+
'principalResolver',
|
|
26
|
+
'HeaderValues',
|
|
27
|
+
'FORBIDDEN',
|
|
28
|
+
'UNAUTHORIZED',
|
|
29
|
+
]);
|
|
30
|
+
const DECISIONS = new Set(['authorize', 'decide', 'check']);
|
|
31
|
+
const AUTHORIZER_NAME = /^#?access$|authorizer/i;
|
|
32
|
+
const AUTHORIZER_TYPE = /^Access$|Authorizer$/;
|
|
33
|
+
const ACTOR_MODEL = new Set(['Actor', 'Actored', 'ActorContext', 'Session', 'ExecutionContext']);
|
|
34
|
+
/** The declarations that say or decide who may do what: they belong on a message or a policy of application/. */
|
|
35
|
+
const ACCESS_DECLARATIONS = new Set(['Requires', 'Public', 'Policy']);
|
|
36
|
+
/** The ports a handler asks for a decision: the class is the type and the injection token. */
|
|
37
|
+
const ACCESS_PORTS = new Set(['Access', 'PolicyAccess']);
|
|
38
|
+
const IN_APPLICATION = 'Declare the permission on the use case (`.requires(...)` in the module, or `@Requires(...)` on the message) and, for a rule that needs loaded state, write a policy in application/authorization evaluated by the handler through `Access`.';
|
|
39
|
+
export const authzInApplication = defineRule({
|
|
40
|
+
id: 'authz/in-application',
|
|
41
|
+
type: 'problem',
|
|
42
|
+
recommended: 'error',
|
|
43
|
+
description: 'The permission is decided in the application layer through the Authorizer and Access ports: no role test in presentation/, no authorization in infrastructure/, no knowledge of rights in domain/.',
|
|
44
|
+
messages: {
|
|
45
|
+
declaredOutside: `{{layer}}/ imports {{name}} from "{{specifier}}": who may do what is declared and decided in application/. Put \`@Requires(...)\` or \`@Public()\` on the command or query, write a rule that needs loaded state as a \`@Policy\` class of application/authorization, and name \`Access\` in the dependency list of a handler only.`,
|
|
46
|
+
rights: `presentation/ reads {{access}}: a route maps a request to a command and decides nothing. Put the actor in the command or query and remove the test. ${IN_APPLICATION}`,
|
|
47
|
+
roleTest: `presentation/ compares {{access}} with a role name. Put the actor in the command or query and remove the test. ${IN_APPLICATION}`,
|
|
48
|
+
authorizerImport: `presentation/ imports {{name}} from "${AUTH}", which decides access. Keep only the request glue here (actorOf, sessionOf, resolveSession, a SessionAuthenticator, inActorContext, the error classes). ${IN_APPLICATION}`,
|
|
49
|
+
decision: `infrastructure/ asks {{call}}() for a decision: an adapter does what it is told. Receive an access scope computed by the handler as a parameter of the port instead. ${IN_APPLICATION}`,
|
|
50
|
+
refusal: `infrastructure/ raises ForbiddenError: refusing is a decision of the application layer. Return what was found (or nothing) and let the handler refuse. ${IN_APPLICATION}`,
|
|
51
|
+
authInDomain: `domain/ imports "${AUTH}": the domain knows nothing of who may do what. Keep invariants here ("an invoice cannot be paid twice") and move the rule about the actor to a policy in application/authorization.`,
|
|
52
|
+
actorInDomain: `domain/ imports {{name}} from "${KERNEL}": the domain never sees the actor, its session or the execution context. Pass the fact the model needs as its own value (an author id, a tenant id) and keep the actor in the handler.`,
|
|
53
|
+
rightsInDomain: 'domain/ reads {{access}}: rights are not part of the model. Let a policy of application/authorization decide and call the aggregate only once the decision is taken.',
|
|
54
|
+
},
|
|
55
|
+
create({ file, sourceCode, report }) {
|
|
56
|
+
const here = inContext(file);
|
|
57
|
+
if (here === undefined || file.isTest) {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
if (here.layer === 'presentation') {
|
|
61
|
+
return presentation(file, sourceCode, report);
|
|
62
|
+
}
|
|
63
|
+
if (here.layer === 'infrastructure') {
|
|
64
|
+
return infrastructure(file, sourceCode, report);
|
|
65
|
+
}
|
|
66
|
+
return here.layer === 'domain' ? domain(file, sourceCode, report) : {};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
function presentation(file, sourceCode, tell) {
|
|
70
|
+
const tellDeclaredOutside = declaredOutside(file, 'presentation', tell);
|
|
71
|
+
const roleTest = (node, tested) => {
|
|
72
|
+
if (isRole(tested)) {
|
|
73
|
+
tell({ node, messageId: 'roleTest', data: { access: sourceCode.getText(tested) } });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
...importListener(file, (site) => {
|
|
78
|
+
tellDeclaredOutside(site);
|
|
79
|
+
tellAuthorizerImport(site, tell);
|
|
80
|
+
}),
|
|
81
|
+
MemberExpression(node) {
|
|
82
|
+
if (RIGHTS_AT_THE_BOUNDARY.has(propertyName(node) ?? '')) {
|
|
83
|
+
tell({ node, messageId: 'rights', data: { access: sourceCode.getText(node) } });
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
BinaryExpression(node) {
|
|
87
|
+
if (!EQUALITY.has(node.operator)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (isText(node.right)) {
|
|
91
|
+
roleTest(node, node.left);
|
|
92
|
+
}
|
|
93
|
+
if (isText(node.left)) {
|
|
94
|
+
roleTest(node, node.right);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
SwitchStatement: (node) => roleTest(node.discriminant, node.discriminant),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function tellAuthorizerImport({ node, target, names, whole }, tell) {
|
|
101
|
+
if (target.kind !== 'package' || target.name !== AUTH) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (whole) {
|
|
105
|
+
tell({ node, messageId: 'authorizerImport', data: { name: 'the whole module' } });
|
|
106
|
+
}
|
|
107
|
+
for (const decider of names.filter(decidesAccess)) {
|
|
108
|
+
tell({ node: decider.node, messageId: 'authorizerImport', data: { name: decider.name } });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* In a declared-style project the decorators of access and the `Access` port are within reach of
|
|
113
|
+
* every layer: they stay in application/. `Access` in presentation/ is already an `authorizerImport`.
|
|
114
|
+
*/
|
|
115
|
+
function declaredOutside(file, layer, tell) {
|
|
116
|
+
const declares = isDeclaredStyle(file);
|
|
117
|
+
return (site) => {
|
|
118
|
+
for (const taken of declares ? takenOutside(layer, site) : []) {
|
|
119
|
+
tell({
|
|
120
|
+
node: taken.node,
|
|
121
|
+
messageId: 'declaredOutside',
|
|
122
|
+
data: { layer, name: taken.name, specifier: site.specifier },
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function takenOutside(layer, { specifier, target, names }) {
|
|
128
|
+
if (specifier === DECLARATIONS_ENTRY) {
|
|
129
|
+
return names.filter((taken) => ACCESS_DECLARATIONS.has(taken.name));
|
|
130
|
+
}
|
|
131
|
+
const fromAuth = target.kind === 'package' && target.name === AUTH;
|
|
132
|
+
return layer === 'infrastructure' && fromAuth ? names.filter((taken) => ACCESS_PORTS.has(taken.name)) : [];
|
|
133
|
+
}
|
|
134
|
+
function decidesAccess(imported) {
|
|
135
|
+
return !REQUEST_GLUE.has(imported.name) && !imported.name.endsWith('Error');
|
|
136
|
+
}
|
|
137
|
+
function isRole(node) {
|
|
138
|
+
return node.type === AST_NODE_TYPES.MemberExpression && propertyName(node) === 'role';
|
|
139
|
+
}
|
|
140
|
+
function isText(node) {
|
|
141
|
+
return node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string';
|
|
142
|
+
}
|
|
143
|
+
function infrastructure(file, sourceCode, tell) {
|
|
144
|
+
const imports = importListener(file, declaredOutside(file, 'infrastructure', tell));
|
|
145
|
+
return {
|
|
146
|
+
...imports,
|
|
147
|
+
CallExpression(node) {
|
|
148
|
+
imports.CallExpression?.(node);
|
|
149
|
+
const { callee } = node;
|
|
150
|
+
if (callee.type !== AST_NODE_TYPES.MemberExpression || !DECISIONS.has(propertyName(callee) ?? '')) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (!isAuthorizer(sourceCode, callee.object) || isAuthorizerAdapter(node)) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
tell({ node, messageId: 'decision', data: { call: sourceCode.getText(callee) } });
|
|
157
|
+
},
|
|
158
|
+
NewExpression(node) {
|
|
159
|
+
if (node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === 'ForbiddenError') {
|
|
160
|
+
tell({ node, messageId: 'refusal' });
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function isAuthorizer(sourceCode, node) {
|
|
166
|
+
return (AUTHORIZER_NAME.test(accessedName(node) ?? '') || AUTHORIZER_TYPE.test(declaredTypeName(sourceCode, node) ?? ''));
|
|
167
|
+
}
|
|
168
|
+
/** An adapter of the Authorizer port (a cache, a remote service) decides by definition: it may delegate to another one. */
|
|
169
|
+
function isAuthorizerAdapter(node) {
|
|
170
|
+
for (const parent of ancestors(node)) {
|
|
171
|
+
if (parent.type !== AST_NODE_TYPES.ClassDeclaration && parent.type !== AST_NODE_TYPES.ClassExpression) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
return parent.implements.some((port) => port.expression.type === AST_NODE_TYPES.Identifier && port.expression.name.endsWith('Authorizer'));
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
function domain(file, sourceCode, tell) {
|
|
179
|
+
return {
|
|
180
|
+
...importListener(file, ({ node, target, names }) => {
|
|
181
|
+
if (target.kind !== 'package') {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (target.name === AUTH) {
|
|
185
|
+
tell({ node, messageId: 'authInDomain' });
|
|
186
|
+
}
|
|
187
|
+
if (target.name !== KERNEL) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
for (const actor of names.filter((imported) => ACTOR_MODEL.has(imported.name))) {
|
|
191
|
+
tell({ node: actor.node, messageId: 'actorInDomain', data: { name: actor.name } });
|
|
192
|
+
}
|
|
193
|
+
}),
|
|
194
|
+
MemberExpression(node) {
|
|
195
|
+
// `this.roles` is the state of a model whose subject is access itself (an identity context), not a test of the caller.
|
|
196
|
+
if (RIGHTS.has(propertyName(node) ?? '') && !startsAtThis(node)) {
|
|
197
|
+
tell({ node, messageId: 'rightsInDomain', data: { access: sourceCode.getText(node) } });
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=authz-in-application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authz-in-application.js","sourceRoot":"","sources":["../../src/rules/authz-in-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AACxF,OAAO,EA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E,cAAc,EAAE,CAAC,CAAC;YAC5C,CAAC;YAED,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC3B,OAAO;YACT,CAAC;YAED,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC/E,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACrF,CAAC;QACH,CAAC,CAAC;QACF,gBAAgB,CAAC,IAAI;YACnB,uHAAuH;YACvH,IAAI,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChE,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-file-size.d.ts","sourceRoot":"","sources":["../../src/rules/clean-file-size.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,mKAwBxB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineRule } from '../support/rule/define-rule.js';
|
|
2
|
+
const MAX_LINES = 350;
|
|
3
|
+
export const cleanFileSize = defineRule({
|
|
4
|
+
id: 'clean/file-size',
|
|
5
|
+
type: 'suggestion',
|
|
6
|
+
recommended: 'error',
|
|
7
|
+
description: 'A file is at most 350 lines, tests included: past that it holds more than one responsibility.',
|
|
8
|
+
messages: {
|
|
9
|
+
tooLong: 'This file is {{count}} lines long (limit {{limit}}). It holds more than one responsibility: move each one to a file named after it (a class, a function with the types of its signature, a group of tests about one behaviour) until every file reads in one sitting.',
|
|
10
|
+
},
|
|
11
|
+
create({ file, sourceCode, report }) {
|
|
12
|
+
if (file.path.endsWith('.d.ts') || file.path.split('/').includes('generated')) {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
Program() {
|
|
17
|
+
const count = sourceCode.lines.at(-1) === '' ? sourceCode.lines.length - 1 : sourceCode.lines.length;
|
|
18
|
+
if (count > MAX_LINES) {
|
|
19
|
+
report({ loc: { line: MAX_LINES + 1, column: 0 }, messageId: 'tooLong', data: { count, limit: MAX_LINES } });
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=clean-file-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-file-size.js","sourceRoot":"","sources":["../../src/rules/clean-file-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAY;IACjD,EAAE,EAAE,iBAAiB;IACrB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,+FAA+F;IAC5G,QAAQ,EAAE;QACR,OAAO,EACL,uQAAuQ;KAC1Q;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9E,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO;YACL,OAAO;gBACL,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC;gBAErG,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;oBACtB,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBAC/G,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hard ceiling of clean/function-size. ESLint gives one severity to a rule name, so the
|
|
3
|
+
* part that is an error whatever the configured limit is a rule of its own.
|
|
4
|
+
*/
|
|
5
|
+
export declare const cleanFunctionCeiling: import("@typescript-eslint/utils/ts-eslint").RuleModule<"ceiling", [], import("../index.js").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
|
+
//# sourceMappingURL=clean-function-ceiling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-function-ceiling.d.ts","sourceRoot":"","sources":["../../src/rules/clean-function-ceiling.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,mKA0B/B,CAAC"}
|