@hailstails/hone 1.4.0 → 2.0.0-pre.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/ADOPTING.md +239 -168
- package/CHANGELOG.md +141 -0
- package/MIGRATING.md +145 -45
- package/README.md +148 -182
- package/chunks/chunk-5HRMJ4O2.js +608 -0
- package/chunks/chunk-5U4JMWNV.js +9 -0
- package/chunks/{chunk-FEWCJU7H.js → chunk-ASUN4AVC.js} +31 -12
- package/chunks/chunk-DGOLOS5A.js +9 -0
- package/chunks/{chunk-HJA4CX7C.js → chunk-FBZBSDED.js} +1 -1
- package/chunks/{chunk-Y2KPZDDV.js → chunk-GNOMK7CR.js} +201 -98
- package/chunks/chunk-IX2VZTBO.js +887 -0
- package/chunks/{chunk-QWA6OVLC.js → chunk-K2W3D3NB.js} +8 -2
- package/chunks/chunk-L7BGRC6D.js +22 -0
- package/chunks/chunk-M6SOGWT7.js +82 -0
- package/chunks/chunk-MWLBA4B3.js +849 -0
- package/chunks/chunk-NRIQD3PI.js +38 -0
- package/chunks/chunk-OKLYWD2Z.js +823 -0
- package/chunks/{chunk-3HFJHJDO.js → chunk-QP5TLOBY.js} +17 -8
- package/chunks/chunk-R75QELTA.js +481 -0
- package/chunks/chunk-RANAKCTW.js +31 -0
- package/chunks/{chunk-NA5L6PUE.js → chunk-RANIXNWY.js} +1 -2
- package/chunks/chunk-RFR3ITBS.js +9 -0
- package/chunks/{chunk-Z4UBS7WI.js → chunk-RGSHTPLA.js} +26 -7
- package/chunks/{chunk-T32FOWZA.js → chunk-TNY2PASL.js} +14 -18
- package/chunks/{chunk-Y4SMWOD2.js → chunk-UJONWHA4.js} +2 -2
- package/chunks/{chunk-WF3PPYRR.js → chunk-VYBO2Q65.js} +4 -2
- package/chunks/chunk-Z6JHBNDS.js +15 -0
- package/chunks/eslint-10-boundary-A4JIQ734.js +14 -0
- package/chunks/eslint-9-boundary-CL5DDBHX.js +34 -0
- package/docs/adding-a-discipline-or-mechanism.md +23 -19
- package/docs/extending.md +6 -5
- package/docs/output-contract.md +713 -16
- package/docs/why-chain-contract.md +6 -6
- package/methods/README.md +2 -2
- package/methods/assessment-template.md +3 -3
- package/methods/lenses/clean-architecture.md +26 -62
- package/methods/lenses/decomposition.md +7 -7
- package/methods/lenses/defended-on-intent.md +6 -6
- package/methods/lenses/di-discipline.md +18 -21
- package/methods/lenses/errors-as-data.md +6 -6
- package/methods/lenses/function-first.md +25 -27
- package/methods/lenses/naming.md +6 -6
- package/methods/lenses/test-discipline.md +8 -8
- package/methods/lenses/type-soundness.md +6 -6
- package/methods/lenses/zod-boundary.md +9 -9
- package/package.json +30 -28
- package/rules/README.md +335 -54
- package/rules/SPIRIT.md +4 -4
- package/rules/cases/a-value-is-one-of-several-kinds-or-states.md +20 -0
- package/rules/cases/an-adopter-is-not-handed-our-risk.md +17 -0
- package/rules/cases/an-operation-can-fail.md +20 -0
- package/rules/cases/builds-the-real-implementations.md +25 -0
- package/rules/cases/causes-an-effect.md +26 -0
- package/rules/cases/checks-a-value-that-may-be-one-of-several-outcomes.md +20 -0
- package/rules/cases/checks-conditions-before-its-work.md +20 -0
- package/rules/cases/coordinates-other-units.md +20 -0
- package/rules/cases/does-one-job.md +23 -0
- package/rules/cases/explains-something-in-prose.md +20 -0
- package/rules/cases/gives-a-value-its-type.md +26 -0
- package/rules/cases/gives-each-unit-its-test.md +20 -0
- package/rules/cases/keeps-state-or-settings-across-calls.md +20 -0
- package/rules/cases/makes-a-new-value-from-what-it-has.md +17 -0
- package/rules/cases/names-something.md +20 -0
- package/rules/cases/needs-the-current-time-a-random-value-a-new-id-or-an-outside-ordering.md +26 -0
- package/rules/cases/puts-code-in-a-file-or-folder.md +20 -0
- package/rules/cases/reads-data-from-outside.md +23 -0
- package/rules/cases/reuses-behaviour-from-another-unit-or-type.md +20 -0
- package/rules/cases/sends-data-out-of-the-program.md +20 -0
- package/rules/cases/sets-how-strictly-the-checker-works.md +14 -0
- package/rules/cases/ships-code-for-others.md +17 -0
- package/rules/cases/states-what-the-unit-gives-back-for-one-case-or-several.md +20 -0
- package/rules/cases/takes-an-outside-dependency.md +38 -0
- package/rules/cases/tests-across-units-or-against-a-real-system.md +20 -0
- package/rules/cases/uses-a-system-or-service-outside-the-program.md +29 -0
- package/rules/cases/uses-what-a-collaborator-gives-back.md +20 -0
- package/rules/cases/writes-basic-logic.md +17 -0
- package/rules/cases.md +71 -0
- package/rules/numbers.md +155 -0
- package/rules/principles/external-behaviour-sits-at-a-boundary.md +12 -0
- package/rules/principles/no-hidden-effects.md +17 -0
- package/rules/principles/no-leak-across-a-boundary.md +19 -0
- package/rules/principles/one-place-decides.md +12 -0
- package/rules/principles/our-code-reads-in-the-common-language.md +12 -0
- package/rules/principles/outside-risk-is-carried-on-purpose.md +13 -0
- package/rules/principles/tests-are-ours.md +12 -0
- package/rules/principles/the-type-checker-proves-it.md +12 -0
- package/rules/principles.md +93 -0
- package/rules/record-kinds/authorised-location.md +26 -0
- package/rules/record-kinds/boundary-record.md +9 -0
- package/rules/record-kinds/debt.md +23 -0
- package/rules/record-kinds/dependency-record.md +9 -0
- package/rules/record-kinds/deviation.md +9 -0
- package/rules/records.md +137 -0
- package/rules/rules/declared-not-asserted.md +16 -0
- package/rules/rules/doer-or-orchestrator.md +16 -0
- package/rules/rules/failures-are-values.md +15 -0
- package/rules/rules/fixed-versions.md +11 -0
- package/rules/rules/guard-first.md +14 -0
- package/rules/rules/handed-what-it-uses.md +16 -0
- package/rules/rules/kinds-are-named.md +16 -0
- package/rules/rules/one-reason-per-module.md +18 -0
- package/rules/rules/one-word-everywhere.md +19 -0
- package/rules/rules/outside-dependencies-justified.md +14 -0
- package/rules/rules/outside-dependencies-stay-at-boundaries.md +18 -0
- package/rules/rules/ports-declared-inside.md +22 -0
- package/rules/rules/shipped-risk-declared.md +11 -0
- package/rules/rules/straight-through-tests.md +15 -0
- package/rules/rules/tested-where-its-owned.md +20 -0
- package/rules/rules/tools-live-in-the-repo.md +11 -0
- package/rules/rules/upstream-stays-untouched.md +11 -0
- package/rules/rules/written-out-answers.md +17 -0
- package/rules/rules.md +185 -0
- package/rules/sources.md +142 -0
- package/rules/typescript/checks.md +1685 -0
- package/rules/typescript/recipes/adapter-per-outside-party.md +18 -0
- package/rules/typescript/recipes/assert-to-narrow.md +18 -0
- package/rules/typescript/recipes/bounded-context-generic.md +19 -0
- package/rules/typescript/recipes/closure-factory.md +20 -0
- package/rules/typescript/recipes/companion-test-file.md +18 -0
- package/rules/typescript/recipes/composed-orchestrator.md +18 -0
- package/rules/typescript/recipes/composition-root.md +18 -0
- package/rules/typescript/recipes/copy-never-write-in.md +18 -0
- package/rules/typescript/recipes/declared-not-bundled.md +17 -0
- package/rules/typescript/recipes/dependency-record.md +20 -0
- package/rules/typescript/recipes/domain-vocabulary-list.md +18 -0
- package/rules/typescript/recipes/entity-module.md +20 -0
- package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +18 -0
- package/rules/typescript/recipes/extension-outside-the-vendored-code.md +18 -0
- package/rules/typescript/recipes/failure-asserted-as-a-value.md +18 -0
- package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +20 -0
- package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +18 -0
- package/rules/typescript/recipes/functional-iteration.md +18 -0
- package/rules/typescript/recipes/guard-clauses.md +18 -0
- package/rules/typescript/recipes/integration-test-owns-its-scratch.md +18 -0
- package/rules/typescript/recipes/integration-test-suffix.md +18 -0
- package/rules/typescript/recipes/iteach-over-typed-rows.md +18 -0
- package/rules/typescript/recipes/map-out-at-the-adapter.md +18 -0
- package/rules/typescript/recipes/meaning-in-names-not-comments.md +22 -0
- package/rules/typescript/recipes/named-exported-type.md +18 -0
- package/rules/typescript/recipes/narrow-ports.md +18 -0
- package/rules/typescript/recipes/one-argument-object.md +19 -0
- package/rules/typescript/recipes/port-in-the-domain.md +19 -0
- package/rules/typescript/recipes/ports-in-the-argument.md +18 -0
- package/rules/typescript/recipes/repo-scripts-only.md +18 -0
- package/rules/typescript/recipes/result-union.md +22 -0
- package/rules/typescript/recipes/screaming-folders.md +20 -0
- package/rules/typescript/recipes/shared-strict-base-config.md +20 -0
- package/rules/typescript/recipes/stub-with-vifn.md +20 -0
- package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +18 -0
- package/rules/typescript/recipes/whole-words.md +18 -0
- package/rules/typescript/recipes/whole-written-out-expectation.md +18 -0
- package/rules/typescript/recipes/world-values-through-a-port.md +18 -0
- package/rules/typescript/recipes/zod-at-the-producers-adapter.md +19 -0
- package/rules/typescript/recipes.md +390 -0
- package/rules/typescript/symptoms/absence-standing-for-a-state.md +36 -0
- package/rules/typescript/symptoms/adapter-built-outside-the-root.md +30 -0
- package/rules/typescript/symptoms/ambient-randomness.md +36 -0
- package/rules/typescript/symptoms/answer-set-in-a-hook.md +45 -0
- package/rules/typescript/symptoms/authored-class-or-this/class-keyword.md +30 -0
- package/rules/typescript/symptoms/authored-class-or-this/static-members-only.md +18 -0
- package/rules/typescript/symptoms/authored-class-or-this.md +49 -0
- package/rules/typescript/symptoms/behaviour-tested-away-from-its-owner.md +44 -0
- package/rules/typescript/symptoms/boolean-in-a-signature/boolean-annotation.md +30 -0
- package/rules/typescript/symptoms/boolean-in-a-signature.md +43 -0
- package/rules/typescript/symptoms/branch-in-a-test/test-body.md +213 -0
- package/rules/typescript/symptoms/branch-in-a-test.md +48 -0
- package/rules/typescript/symptoms/bundled-dependency.md +28 -0
- package/rules/typescript/symptoms/catch-all-failure-kind.md +37 -0
- package/rules/typescript/symptoms/change-spread-across-modules.md +27 -0
- package/rules/typescript/symptoms/claimed-type/cast-to-any.md +29 -0
- package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +34 -0
- package/rules/typescript/symptoms/claimed-type/unlisted-cast-site.md +34 -0
- package/rules/typescript/symptoms/claimed-type.md +56 -0
- package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +144 -0
- package/rules/typescript/symptoms/computed-value-in-a-test.md +36 -0
- package/rules/typescript/symptoms/coverage-gate.md +27 -0
- package/rules/typescript/symptoms/date-used-directly/clock-sources.md +31 -0
- package/rules/typescript/symptoms/date-used-directly.md +46 -0
- package/rules/typescript/symptoms/default-for-a-required-value.md +45 -0
- package/rules/typescript/symptoms/default-on-a-closed-union/default-arm.md +32 -0
- package/rules/typescript/symptoms/default-on-a-closed-union.md +32 -0
- package/rules/typescript/symptoms/dependency-without-a-record.md +33 -0
- package/rules/typescript/symptoms/doer-calling-our-own-unit.md +36 -0
- package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +32 -0
- package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +31 -0
- package/rules/typescript/symptoms/double-with-a-body.md +55 -0
- package/rules/typescript/symptoms/drawer-path/drawer-names.md +28 -0
- package/rules/typescript/symptoms/drawer-path.md +32 -0
- package/rules/typescript/symptoms/duplicate-decision.md +36 -0
- package/rules/typescript/symptoms/edit-inside-vendored-code.md +33 -0
- package/rules/typescript/symptoms/failure-shaped-as-success.md +28 -0
- package/rules/typescript/symptoms/floating-version.md +27 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +30 -0
- package/rules/typescript/symptoms/inherited-environment-in-a-subprocess.md +33 -0
- package/rules/typescript/symptoms/inner-layer-imports-outer.md +33 -0
- package/rules/typescript/symptoms/integration-heavy-suite.md +29 -0
- package/rules/typescript/symptoms/large-input-for-a-few-fields.md +37 -0
- package/rules/typescript/symptoms/library-class-built-in-place.md +42 -0
- package/rules/typescript/symptoms/long-function/function-length.md +47 -0
- package/rules/typescript/symptoms/long-function.md +75 -0
- package/rules/typescript/symptoms/loop-keyword/loop-statement.md +34 -0
- package/rules/typescript/symptoms/loop-keyword.md +49 -0
- package/rules/typescript/symptoms/machine-touched-in-a-unit-test.md +40 -0
- package/rules/typescript/symptoms/many-spellings-of-one-concept.md +29 -0
- package/rules/typescript/symptoms/module-level-state.md +30 -0
- package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +29 -0
- package/rules/typescript/symptoms/module-or-global-patched.md +38 -0
- package/rules/typescript/symptoms/name-off-its-casing/filename-case.md +16 -0
- package/rules/typescript/symptoms/name-off-its-casing/naming-convention.md +20 -0
- package/rules/typescript/symptoms/name-off-its-casing.md +31 -0
- package/rules/typescript/symptoms/no-lock-file.md +27 -0
- package/rules/typescript/symptoms/orchestrator-that-computes.md +27 -0
- package/rules/typescript/symptoms/outside-dependency-vocabulary-for-basic-logic.md +33 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +44 -0
- package/rules/typescript/symptoms/outside-import-past-a-boundary.md +45 -0
- package/rules/typescript/symptoms/outside-type-in-a-signature.md +37 -0
- package/rules/typescript/symptoms/own-type-guard.md +36 -0
- package/rules/typescript/symptoms/port-named-for-a-mechanism.md +34 -0
- package/rules/typescript/symptoms/port-outside-the-domain.md +28 -0
- package/rules/typescript/symptoms/positional-parameters/parameter-count.md +30 -0
- package/rules/typescript/symptoms/positional-parameters.md +43 -0
- package/rules/typescript/symptoms/process-global-used-in-place.md +53 -0
- package/rules/typescript/symptoms/prose-in-code.md +27 -0
- package/rules/typescript/symptoms/rebinding/parameter-reassignment.md +18 -0
- package/rules/typescript/symptoms/rebinding/test-body.md +32 -0
- package/rules/typescript/symptoms/rebinding.md +36 -0
- package/rules/typescript/symptoms/schema-past-its-adapter.md +41 -0
- package/rules/typescript/symptoms/shorthand-name/identifier-names.md +29 -0
- package/rules/typescript/symptoms/shorthand-name.md +32 -0
- package/rules/typescript/symptoms/strictness-weakened/exact-optional-property-types.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/no-fallthrough-cases-in-switch.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/no-implicit-override.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/no-property-access-from-index-signature.md +51 -0
- package/rules/{CD-3/CHECKS.md → typescript/symptoms/strictness-weakened/no-unchecked-indexed-access.md} +23 -38
- package/rules/typescript/symptoms/strictness-weakened/strict.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened/use-unknown-in-catch-variables.md +51 -0
- package/rules/typescript/symptoms/strictness-weakened.md +32 -0
- package/rules/typescript/symptoms/tangled-function/cognitive-complexity.md +42 -0
- package/rules/typescript/symptoms/tangled-function.md +75 -0
- package/rules/typescript/symptoms/test-of-the-type-checker.md +24 -0
- package/rules/typescript/symptoms/test-switched-off/focused-tests.md +15 -0
- package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +15 -0
- package/rules/typescript/symptoms/test-switched-off.md +25 -0
- package/rules/typescript/symptoms/text-past-its-reader/test-body.md +30 -0
- package/rules/typescript/symptoms/text-past-its-reader.md +71 -0
- package/rules/typescript/symptoms/throw-between-our-units.md +46 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +32 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +39 -0
- package/rules/typescript/symptoms/throw-or-catch-in-a-test.md +35 -0
- package/rules/typescript/symptoms/thrown-non-error/throw-only-error.md +15 -0
- package/rules/typescript/symptoms/thrown-non-error.md +27 -0
- package/rules/typescript/symptoms/tool-fetched-at-run-time.md +27 -0
- package/rules/typescript/symptoms/tuple-as-data.md +29 -0
- package/rules/typescript/symptoms/type-derived-from-code/factory-return-types.md +29 -0
- package/rules/typescript/symptoms/type-derived-from-code.md +41 -0
- package/rules/typescript/symptoms/types-only-file.md +36 -0
- package/rules/typescript/symptoms/unasserted-call.md +29 -0
- package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +28 -0
- package/rules/typescript/symptoms/unit-without-a-running-test.md +28 -0
- package/rules/{CD-5/CHECKS.md → typescript/symptoms/untracked-escape/directive-pointers.md} +12 -23
- package/rules/typescript/symptoms/untracked-escape.md +32 -0
- package/rules/typescript/symptoms/untyped-value/explicit-any.md +14 -0
- package/rules/typescript/symptoms/untyped-value/implicit-any-let.md +14 -0
- package/rules/typescript/symptoms/untyped-value.md +36 -0
- package/rules/typescript/symptoms/wide-input.md +37 -0
- package/rules/typescript/symptoms/wide-port.md +32 -0
- package/rules/typescript/symptoms/work-inside-a-condition/else-after-an-exit.md +40 -0
- package/rules/typescript/symptoms/work-inside-a-condition.md +41 -0
- package/rules/typescript/symptoms/write-into-a-parameter/parameter-mutation.md +33 -0
- package/rules/typescript/symptoms/write-into-a-parameter.md +34 -0
- package/rules/typescript/symptoms.md +821 -0
- package/{core → src/application}/conformance/conformance-testing-types.d.ts +16 -6
- package/src/audit.d.ts +20 -0
- package/{api → src}/audit.js +6 -5
- package/{core/rule-set-reader → src/domain/rule-set}/authored-rule-set-types.d.ts +2 -2
- package/{core/values → src/domain/rule-set}/edition-types.d.ts +3 -3
- package/{core/values → src/domain/rule-set}/identifier-types.d.ts +2 -2
- package/{core/conformance → src/domain/runner}/conformance-types.d.ts +1 -1
- package/{core/mechanism-port → src/domain/runner}/piece-failure-types.d.ts +1 -1
- package/{core/mechanism-port → src/domain/runner}/runner-module-types.d.ts +4 -4
- package/src/domain/runner/runner-result-types.d.ts +88 -0
- package/src/eslint-plugin.d.ts +16 -0
- package/src/eslint-plugin.js +72 -0
- package/src/hone.js +13385 -0
- package/src/infrastructure/disciplines-file/version-one-names.json +634 -0
- package/src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/class-keyword.examples.json +84 -0
- package/{mechanisms/eslint/CD-14/cd14/cd14.eslint-plugin.js → src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/eslint-plugin.js} +9 -10
- package/src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/piece.json +12 -0
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +24 -0
- package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/static-members-only.examples.json +36 -0
- package/src/infrastructure/engines/eslint/claimed-type/non-null-assertions/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/claimed-type/non-null-assertions/non-null-assertions.examples.json +48 -0
- package/src/infrastructure/engines/eslint/claimed-type/non-null-assertions/piece.json +22 -0
- package/src/infrastructure/engines/eslint/long-function/function-length/function-length.examples.json +42 -0
- package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +16 -0
- package/{mechanisms/eslint/CD-7/cd7/cd7.eslint-plugin.js → src/infrastructure/engines/eslint/name-off-its-casing/filename-case/eslint-plugin.js} +5 -4
- package/src/infrastructure/engines/eslint/name-off-its-casing/filename-case/filename-case.examples.json +60 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/filename-case/piece.json +11 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/naming-convention.examples.json +78 -0
- package/src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/piece.json +214 -0
- package/src/infrastructure/engines/eslint/positional-parameters/parameter-count/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/positional-parameters/parameter-count/parameter-count.examples.json +30 -0
- package/src/infrastructure/engines/eslint/positional-parameters/parameter-count/piece.json +18 -0
- package/src/infrastructure/engines/eslint/rebinding/parameter-reassignment/eslint-plugin.js +16 -0
- package/src/infrastructure/engines/eslint/rebinding/parameter-reassignment/parameter-reassignment.examples.json +30 -0
- package/src/infrastructure/engines/eslint/rebinding/parameter-reassignment/piece.json +17 -0
- package/{mechanisms → src/infrastructure/engines}/eslint/runner/README.md +5 -5
- package/{mechanisms/eslint/runner → src/infrastructure/engines/eslint/runner/pieces}/eslint-piece-settings-types.d.ts +1 -1
- package/{mechanisms → src/infrastructure/engines}/eslint/runner/runner.js +2189 -1371
- package/{mechanisms/eslint/CD-41 → src/infrastructure/engines/eslint/tangled-function/cognitive-complexity}/README.md +1 -1
- package/src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/cognitive-complexity.examples.json +48 -0
- package/{mechanisms/eslint/CD-41/cd41/cd41.eslint-plugin.js → src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/eslint-plugin.js} +58 -14
- package/src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/piece.json +12 -0
- package/{mechanisms/eslint/CD-27/cd27/cd27.eslint-plugin.js → src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js} +5 -4
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/focused-tests.examples.json +60 -0
- package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/piece.json +12 -0
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +16 -0
- package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +54 -0
- package/{mechanisms/eslint/CD-10/cd10/cd10.eslint-plugin.js → src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/eslint-plugin.js} +5 -4
- package/src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/piece.json +12 -0
- package/src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/throw-only-error.examples.json +54 -0
- package/{mechanisms/eslint/CD-1/cd1/cd1.eslint-plugin.js → src/infrastructure/engines/eslint/untyped-value/explicit-any/eslint-plugin.js} +14 -9
- package/src/infrastructure/engines/eslint/untyped-value/explicit-any/explicit-any.examples.json +36 -0
- package/src/infrastructure/engines/eslint/untyped-value/explicit-any/piece.json +12 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/implicit-any-let.examples.json +48 -0
- package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +16 -0
- package/src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/else-after-an-exit.examples.json +36 -0
- package/{mechanisms/eslint/CD-42/cd42/cd42.eslint-plugin.js → src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/eslint-plugin.js} +29 -13
- package/src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/piece.json +12 -0
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-keyword.examples.json +84 -0
- package/{mechanisms/audit/CD-14 → src/infrastructure/engines/walker/authored-class-or-this/class-keyword}/class-syntax.js +6 -3
- package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/piece.json +10 -0
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-annotation.examples.json +42 -0
- package/{mechanisms/audit/CD-43 → src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation}/boolean-signatures.js +14 -6
- package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/piece.json +9 -0
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/piece.json +95 -0
- package/{mechanisms/audit/CD-27 → src/infrastructure/engines/walker/branch-in-a-test/test-body}/test-body-logic.js +188 -56
- package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body.examples.json +280 -0
- package/{mechanisms/audit/CD-1 → src/infrastructure/engines/walker/claimed-type/cast-to-any}/any-cast.js +7 -4
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/cast-to-any.examples.json +48 -0
- package/src/infrastructure/engines/walker/claimed-type/cast-to-any/piece.json +9 -0
- package/{mechanisms/audit/CD-2 → src/infrastructure/engines/walker/claimed-type/unlisted-cast-site}/cast-expressions.js +13 -6
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/piece.json +14 -0
- package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/unlisted-cast-site.examples.json +54 -0
- package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +18 -0
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.examples.json +30 -0
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +36 -0
- package/src/infrastructure/engines/walker/date-used-directly/clock-sources/piece.json +9 -0
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/default-arm.examples.json +36 -0
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/piece.json +9 -0
- package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +54 -0
- package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +18 -0
- package/{mechanisms/audit/CD-25 → src/infrastructure/engines/walker/double-with-a-body/stub-implementation}/dependency-isolation.js +8 -4
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/piece.json +9 -0
- package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/stub-implementation.examples.json +36 -0
- package/{mechanisms/audit/CD-7 → src/infrastructure/engines/walker/drawer-path/drawer-names}/categorical-paths.js +23 -8
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/drawer-names.examples.json +42 -0
- package/src/infrastructure/engines/walker/drawer-path/drawer-names/piece.json +9 -0
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/git-spawn-environment.examples.json +36 -0
- package/{mechanisms/audit/CD-47 → src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment}/hermetic-git-spawns.js +13 -4
- package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/piece.json +9 -0
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loop-statement.examples.json +48 -0
- package/{mechanisms/audit/CD-15 → src/infrastructure/engines/walker/loop-keyword/loop-statement}/loops.js +12 -4
- package/src/infrastructure/engines/walker/loop-keyword/loop-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +36 -0
- package/{mechanisms/audit/CD-26 → src/infrastructure/engines/walker/module-or-global-patched/module-mock-call}/module-mocking.js +8 -4
- package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +9 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +133 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-or-require.examples.json +42 -0
- package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +14 -0
- package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +18 -0
- package/{mechanisms/audit/runner → src/infrastructure/engines/walker/runner/pieces}/walker-piece.d.ts +8 -14
- package/{mechanisms/audit → src/infrastructure/engines/walker}/runner/runner.js +194 -121
- package/{mechanisms/audit/runner → src/infrastructure/engines/walker/runner/toolchain}/typescript-parse.d.ts +1 -0
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.examples.json +42 -0
- package/{mechanisms/audit/CD-6 → src/infrastructure/engines/walker/shorthand-name/identifier-names}/identifier-names.js +32 -15
- package/src/infrastructure/engines/walker/shorthand-name/identifier-names/piece.json +9 -0
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/exact-optional-property-types.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/no-fallthrough-cases-in-switch.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/no-implicit-override.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/no-property-access-from-index-signature.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/no-unchecked-indexed-access.examples.json +71 -0
- package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +17 -0
- package/{mechanisms/audit/CD-3 → src/infrastructure/engines/walker/strictness-weakened/strict}/compiler-overrides.js +102 -38
- package/src/infrastructure/engines/walker/strictness-weakened/strict/piece.json +13 -0
- package/src/infrastructure/engines/walker/strictness-weakened/strict/strict.examples.json +64 -0
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +17 -0
- package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/use-unknown-in-catch-variables.examples.json +71 -0
- package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +18 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/piece.json +9 -0
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +36 -0
- package/{mechanisms/audit/CD-10 → src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement}/throws-in-tests.js +6 -3
- package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +18 -0
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.examples.json +36 -0
- package/{mechanisms/audit/CD-7a → src/infrastructure/engines/walker/type-derived-from-code/factory-return-types}/factory-return-types.js +5 -3
- package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/piece.json +9 -0
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/companion-test-file.examples.json +36 -0
- package/{mechanisms/audit/CD-23 → src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file}/export-test-sibling.js +7 -4
- package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/piece.json +9 -0
- package/{mechanisms/audit/CD-5 → src/infrastructure/engines/walker/untracked-escape/directive-pointers}/comments-directives.js +40 -19
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/directive-pointers.examples.json +96 -0
- package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/piece.json +16 -0
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.examples.json +42 -0
- package/{mechanisms/audit/CD-44 → src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation}/parameter-mutation.js +22 -7
- package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/piece.json +9 -0
- package/src/rule-set.d.ts +4 -0
- package/src/testing.d.ts +7 -0
- package/src/testing.js +524 -0
- package/api/audit.d.ts +0 -20
- package/api/rule-set.d.ts +0 -4
- package/api/testing.d.ts +0 -5
- package/api/testing.js +0 -238
- package/chunks/chunk-335ITLPO.js +0 -7
- package/chunks/chunk-6SM3HKWO.js +0 -1912
- package/chunks/chunk-E6VR3VRV.js +0 -268
- package/chunks/chunk-FR4FASVM.js +0 -108
- package/chunks/chunk-LDQUT742.js +0 -15
- package/chunks/chunk-MXSIQPCV.js +0 -13
- package/chunks/chunk-RWQ4UNKY.js +0 -24
- package/core/check/tool-command.js +0 -2586
- package/core/mechanism-port/runner-result-types.d.ts +0 -15
- package/mechanisms/audit/CD-1/piece.json +0 -13
- package/mechanisms/audit/CD-10/piece.json +0 -13
- package/mechanisms/audit/CD-14/piece.json +0 -13
- package/mechanisms/audit/CD-15/piece.json +0 -13
- package/mechanisms/audit/CD-17/clock-sources.js +0 -28
- package/mechanisms/audit/CD-17/piece.json +0 -13
- package/mechanisms/audit/CD-19/import-boundaries.js +0 -99
- package/mechanisms/audit/CD-19/piece.json +0 -18
- package/mechanisms/audit/CD-2/piece.json +0 -18
- package/mechanisms/audit/CD-23/piece.json +0 -13
- package/mechanisms/audit/CD-25/piece.json +0 -13
- package/mechanisms/audit/CD-26/piece.json +0 -13
- package/mechanisms/audit/CD-27/piece.json +0 -17
- package/mechanisms/audit/CD-3/piece.json +0 -77
- package/mechanisms/audit/CD-43/piece.json +0 -13
- package/mechanisms/audit/CD-44/piece.json +0 -13
- package/mechanisms/audit/CD-47/piece.json +0 -13
- package/mechanisms/audit/CD-5/piece.json +0 -20
- package/mechanisms/audit/CD-6/piece.json +0 -13
- package/mechanisms/audit/CD-7/piece.json +0 -13
- package/mechanisms/audit/CD-7a/piece.json +0 -13
- package/mechanisms/audit/CD-8/piece.json +0 -13
- package/mechanisms/audit/CD-8/switch-defaults.js +0 -42
- package/mechanisms/eslint/CD-1/piece.json +0 -23
- package/mechanisms/eslint/CD-10/piece.json +0 -15
- package/mechanisms/eslint/CD-14/piece.json +0 -31
- package/mechanisms/eslint/CD-2/cd2/cd2.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-2/piece.json +0 -25
- package/mechanisms/eslint/CD-27/piece.json +0 -23
- package/mechanisms/eslint/CD-40/cd40/cd40.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-40/piece.json +0 -21
- package/mechanisms/eslint/CD-41/piece.json +0 -23
- package/mechanisms/eslint/CD-42/piece.json +0 -15
- package/mechanisms/eslint/CD-44/cd44/cd44.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-44/piece.json +0 -20
- package/mechanisms/eslint/CD-6/cd6/cd6.eslint-plugin.js +0 -15
- package/mechanisms/eslint/CD-6/piece.json +0 -217
- package/mechanisms/eslint/CD-7/piece.json +0 -15
- package/rules/CD-1/CHECKS.md +0 -39
- package/rules/CD-1/README.md +0 -28
- package/rules/CD-1/discipline.json +0 -195
- package/rules/CD-10/CHECKS.md +0 -49
- package/rules/CD-10/README.md +0 -27
- package/rules/CD-10/discipline.json +0 -133
- package/rules/CD-11/CHECKS.md +0 -13
- package/rules/CD-11/README.md +0 -25
- package/rules/CD-11/discipline.json +0 -12
- package/rules/CD-12/CHECKS.md +0 -13
- package/rules/CD-12/README.md +0 -25
- package/rules/CD-12/discipline.json +0 -12
- package/rules/CD-13/CHECKS.md +0 -13
- package/rules/CD-13/README.md +0 -25
- package/rules/CD-13/discipline.json +0 -12
- package/rules/CD-14/CHECKS.md +0 -49
- package/rules/CD-14/README.md +0 -28
- package/rules/CD-14/discipline.json +0 -173
- package/rules/CD-15/CHECKS.md +0 -42
- package/rules/CD-15/README.md +0 -30
- package/rules/CD-15/discipline.json +0 -73
- package/rules/CD-16/CHECKS.md +0 -7
- package/rules/CD-16/README.md +0 -15
- package/rules/CD-17/CHECKS.md +0 -37
- package/rules/CD-17/README.md +0 -28
- package/rules/CD-17/discipline.json +0 -51
- package/rules/CD-18/CHECKS.md +0 -13
- package/rules/CD-18/README.md +0 -25
- package/rules/CD-18/discipline.json +0 -12
- package/rules/CD-19/CHECKS.md +0 -49
- package/rules/CD-19/README.md +0 -29
- package/rules/CD-19/discipline.json +0 -63
- package/rules/CD-2/CHECKS.md +0 -58
- package/rules/CD-2/README.md +0 -30
- package/rules/CD-2/discipline.json +0 -151
- package/rules/CD-20/CHECKS.md +0 -7
- package/rules/CD-20/README.md +0 -15
- package/rules/CD-21/CHECKS.md +0 -13
- package/rules/CD-21/README.md +0 -24
- package/rules/CD-21/discipline.json +0 -12
- package/rules/CD-22/CHECKS.md +0 -13
- package/rules/CD-22/README.md +0 -24
- package/rules/CD-22/discipline.json +0 -12
- package/rules/CD-23/CHECKS.md +0 -35
- package/rules/CD-23/README.md +0 -26
- package/rules/CD-23/discipline.json +0 -57
- package/rules/CD-24/CHECKS.md +0 -7
- package/rules/CD-24/README.md +0 -15
- package/rules/CD-25/CHECKS.md +0 -38
- package/rules/CD-25/README.md +0 -31
- package/rules/CD-25/discipline.json +0 -57
- package/rules/CD-26/CHECKS.md +0 -36
- package/rules/CD-26/README.md +0 -29
- package/rules/CD-26/discipline.json +0 -57
- package/rules/CD-27/CHECKS.md +0 -451
- package/rules/CD-27/README.md +0 -29
- package/rules/CD-27/discipline.json +0 -437
- package/rules/CD-28/CHECKS.md +0 -13
- package/rules/CD-28/README.md +0 -25
- package/rules/CD-28/discipline.json +0 -12
- package/rules/CD-29/CHECKS.md +0 -13
- package/rules/CD-29/README.md +0 -23
- package/rules/CD-29/discipline.json +0 -12
- package/rules/CD-3/README.md +0 -26
- package/rules/CD-3/discipline.json +0 -641
- package/rules/CD-30/CHECKS.md +0 -13
- package/rules/CD-30/README.md +0 -24
- package/rules/CD-30/discipline.json +0 -12
- package/rules/CD-31/CHECKS.md +0 -13
- package/rules/CD-31/README.md +0 -23
- package/rules/CD-31/discipline.json +0 -12
- package/rules/CD-32/CHECKS.md +0 -13
- package/rules/CD-32/README.md +0 -24
- package/rules/CD-32/discipline.json +0 -12
- package/rules/CD-33/CHECKS.md +0 -13
- package/rules/CD-33/README.md +0 -24
- package/rules/CD-33/discipline.json +0 -12
- package/rules/CD-34/CHECKS.md +0 -13
- package/rules/CD-34/README.md +0 -23
- package/rules/CD-34/discipline.json +0 -12
- package/rules/CD-39/CHECKS.md +0 -13
- package/rules/CD-39/README.md +0 -24
- package/rules/CD-39/discipline.json +0 -12
- package/rules/CD-4/CHECKS.md +0 -13
- package/rules/CD-4/README.md +0 -26
- package/rules/CD-4/discipline.json +0 -12
- package/rules/CD-40/CHECKS.md +0 -39
- package/rules/CD-40/README.md +0 -29
- package/rules/CD-40/discipline.json +0 -58
- package/rules/CD-41/CHECKS.md +0 -64
- package/rules/CD-41/README.md +0 -31
- package/rules/CD-41/discipline.json +0 -138
- package/rules/CD-42/CHECKS.md +0 -47
- package/rules/CD-42/README.md +0 -25
- package/rules/CD-42/discipline.json +0 -61
- package/rules/CD-43/CHECKS.md +0 -37
- package/rules/CD-43/README.md +0 -27
- package/rules/CD-43/discipline.json +0 -65
- package/rules/CD-44/CHECKS.md +0 -48
- package/rules/CD-44/README.md +0 -26
- package/rules/CD-44/discipline.json +0 -111
- package/rules/CD-45/CHECKS.md +0 -13
- package/rules/CD-45/README.md +0 -25
- package/rules/CD-45/discipline.json +0 -12
- package/rules/CD-46/CHECKS.md +0 -7
- package/rules/CD-46/README.md +0 -25
- package/rules/CD-47/CHECKS.md +0 -37
- package/rules/CD-47/README.md +0 -31
- package/rules/CD-47/discipline.json +0 -57
- package/rules/CD-5/README.md +0 -28
- package/rules/CD-5/discipline.json +0 -131
- package/rules/CD-6/CHECKS.md +0 -51
- package/rules/CD-6/README.md +0 -28
- package/rules/CD-6/discipline.json +0 -165
- package/rules/CD-7/CHECKS.md +0 -46
- package/rules/CD-7/README.md +0 -29
- package/rules/CD-7/discipline.json +0 -142
- package/rules/CD-7a/CHECKS.md +0 -38
- package/rules/CD-7a/README.md +0 -26
- package/rules/CD-7a/discipline.json +0 -57
- package/rules/CD-8/CHECKS.md +0 -42
- package/rules/CD-8/README.md +0 -26
- package/rules/CD-8/discipline.json +0 -57
- package/rules/CD-9/CHECKS.md +0 -13
- package/rules/CD-9/README.md +0 -26
- package/rules/CD-9/discipline.json +0 -12
- /package/{core/values → src/domain/finding}/anchor.d.ts +0 -0
- /package/{core/values → src/domain/repository}/branded.d.ts +0 -0
- /package/{core/values → src/domain/repository}/repo-path-types.d.ts +0 -0
- /package/{core/values → src/domain}/result.d.ts +0 -0
- /package/{core/values → src/domain/rule-set}/clause-address-types.d.ts +0 -0
- /package/{core/values → src/domain/settings/json-values}/json-value.d.ts +0 -0
- /package/{mechanisms/eslint/CD-14 → src/infrastructure/engines/eslint/authored-class-or-this/class-keyword}/README.md +0 -0
- /package/{mechanisms/eslint/CD-2 → src/infrastructure/engines/eslint/claimed-type/non-null-assertions}/README.md +0 -0
- /package/{mechanisms/eslint/CD-7 → src/infrastructure/engines/eslint/name-off-its-casing/filename-case}/README.md +0 -0
- /package/{mechanisms/eslint/CD-6 → src/infrastructure/engines/eslint/name-off-its-casing/naming-convention}/README.md +0 -0
- /package/{mechanisms/eslint/CD-40 → src/infrastructure/engines/eslint/positional-parameters/parameter-count}/README.md +0 -0
- /package/{mechanisms/eslint/CD-44 → src/infrastructure/engines/eslint/rebinding/parameter-reassignment}/README.md +0 -0
- /package/{mechanisms/eslint/CD-27 → src/infrastructure/engines/eslint/test-switched-off/focused-tests}/README.md +0 -0
- /package/{mechanisms/eslint/CD-10 → src/infrastructure/engines/eslint/thrown-non-error/throw-only-error}/README.md +0 -0
- /package/{mechanisms/eslint/CD-1 → src/infrastructure/engines/eslint/untyped-value/explicit-any}/README.md +0 -0
- /package/{mechanisms/eslint/CD-42 → src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit}/README.md +0 -0
- /package/{mechanisms/audit → src/infrastructure/engines/walker}/runner/README.md +0 -0
- /package/{api → src}/rule-set.js +0 -0
package/rules/CD-15/CHECKS.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# CD-15 checks
|
|
2
|
-
|
|
3
|
-
Read [the rule and its spirit](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
|
-
|
|
5
|
-
## Clauses
|
|
6
|
-
|
|
7
|
-
| Clause | Mechanism | Checks |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| `CD-15#loops` | audit | `for...of`, `for await`, counted `for` and `while` loops |
|
|
10
|
-
|
|
11
|
-
## What the check flags
|
|
12
|
-
- `.ts` and `.tsx` files, including tests and declaration files; generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
|
|
13
|
-
- Lines matching `for (... of ...)` (with or without `await`), `for (init; test; step)` and `while (`. This includes `do...while`. Each kind is reported once per line.
|
|
14
|
-
- Matching is on raw lines, so loop headers split over several lines are missed and the same text inside a string is flagged. Comment lines are ignored.
|
|
15
|
-
- The source rule names element and counted iteration; the check also flags `while`.
|
|
16
|
-
- Draining an `AsyncIterable` with `for await` is allowed by the rule at declared sites; record it as an `authorised-location`.
|
|
17
|
-
|
|
18
|
-
## Example violation
|
|
19
|
-
```ts
|
|
20
|
-
for (const order of orders) {
|
|
21
|
-
totals.push(order.total);
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## How to fix
|
|
26
|
-
```ts
|
|
27
|
-
const totals = orders.map((order) => order.total);
|
|
28
|
-
```
|
|
29
|
-
Replace a counted loop with `Array.from({ length }, (_, position) => ...)`.
|
|
30
|
-
|
|
31
|
-
In a test file, `CD-27#test-body-logic` flags `map` at either edition, and its edition 2 flags `Array.from`: write the values out instead, as [CD-27's allowed forms](../CD-27/CHECKS.md#allowed-forms-in-a-test) show.
|
|
32
|
-
|
|
33
|
-
## Exceptions
|
|
34
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file drains an async stream and cannot use a functional form. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{ "version": 1, "exceptions": [
|
|
38
|
-
{ "kind": "authorised-location", "clause": "CD-15#loops", "file": "src/streams/drain.ts", "reason": "..." }
|
|
39
|
-
] }
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
An `authorised-location` or `clause-wide-carve-out` also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. A `file-carve-out` is debt and needs only its `kind`, `clause` and `file`; its `reason` is an optional note, and a `whyChain` or `provenance` it gives anyway is still judged. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` may give only its `reason`, which will be refused in the next major release. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
|
package/rules/CD-15/README.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# CD-15: Iteration is functional transformation, never an imperative loop
|
|
2
|
-
|
|
3
|
-
## Rule
|
|
4
|
-
|
|
5
|
-
Iteration is a transformation, expressed with `map`, `reduce`, `flatMap`, `filter`, or `Array.from` — so it reads as data flowing through a pipeline rather than as mutable imperative stepping. Pure side-effect iteration (logging, registering listeners) uses `forEach` with a callback that returns void. The two imperative shapes this rule replaces are element iteration (`for…of`) and counted iteration (`for (let i = 0; …; i++)`): the first becomes a functional traversal, and the second becomes `Array.from({ length }, mapper)` where the index is derived from position rather than incremented by a manual counter that can drift out of bounds.
|
|
6
|
-
|
|
7
|
-
**Async stream consumption is iteration this rule does not reach.** Draining an `AsyncIterable` — pulling `await iterator.next()` until exhaustion, or the `for await…of` that desugars to it — is permitted at sites declared as authorised locations for CD-15. The functional forms cannot express it: `map`/`reduce`/`flatMap` over an `AsyncIterable` require materialising the whole stream, which destroys the bounded-residency property that streaming exists to provide. This is a structural fact about the language, not debt — a drain loop at a declared site is fully compliant, carries no paydown obligation, and takes an authorised-location entry, never a carve-out. Everything the rule does reach still binds inside such a loop: the body is a transformation, accumulator updates are whole-value replacements rather than in-place mutation, and synchronous iteration over materialised collections stays functional.
|
|
8
|
-
|
|
9
|
-
Review lens: [function-first](../../methods/lenses/function-first.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
10
|
-
|
|
11
|
-
## Spirit
|
|
12
|
-
|
|
13
|
-
**What the friction is for.** A loop says how to step; a transformation says what is produced. The friction makes naming the transformation the easy path, and removes counters that drift and accumulators changed in place.
|
|
14
|
-
|
|
15
|
-
**What a finding points at.** Match the sites against these causes.
|
|
16
|
-
- *A transformation hidden in control flow.* The body builds one result from each element. Express it as a map, filter or reduce.
|
|
17
|
-
- *Several jobs in one pass.* One loop filters, reshapes and records. Split it into named steps.
|
|
18
|
-
- *Effects mixed with computation.* The loop computes and writes at once. Compute the result first, then perform the effects at the edge.
|
|
19
|
-
- *A stream being drained.* Consuming an async stream is a limit of the language, not debt. Record the site as an authorised location; it is fully compliant.
|
|
20
|
-
|
|
21
|
-
**Where to go.** Iteration reads as data flowing through named transformations, with effects at the end.
|
|
22
|
-
|
|
23
|
-
**Reactions to distrust.**
|
|
24
|
-
- "Loops are faster." Usually unmeasured, and the rule makes no performance carve-out. Measure before arguing it.
|
|
25
|
-
- "It's just tests." A loop in a test is several cases in one. Use one parameterised test over the rows (CD-27).
|
|
26
|
-
- "A loop is clearer here." Clearer to the writer, who knows what it builds. Name what it builds.
|
|
27
|
-
|
|
28
|
-
**Principles behind it.**
|
|
29
|
-
- *Replace Loop with Pipeline* (Martin Fowler, *Refactoring*, second edition). A collection pipeline names each step of the processing.
|
|
30
|
-
- *Functional core, imperative shell* (Gary Bernhardt). The transformation is pure; effects run at the edge on its result.
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 1,
|
|
3
|
-
"id": "CD-15",
|
|
4
|
-
"clauses": [
|
|
5
|
-
{
|
|
6
|
-
"kind": "mechanical",
|
|
7
|
-
"id": "loops",
|
|
8
|
-
"summary": "Iteration is functional transformation, never an imperative loop",
|
|
9
|
-
"mechanisms": [
|
|
10
|
-
"audit"
|
|
11
|
-
],
|
|
12
|
-
"anchor": {
|
|
13
|
-
"kind": "file"
|
|
14
|
-
},
|
|
15
|
-
"cases": {
|
|
16
|
-
"flag": [
|
|
17
|
-
{
|
|
18
|
-
"name": "for-of loop",
|
|
19
|
-
"fileName": "for-of.ts",
|
|
20
|
-
"source": "declare const orders: readonly { readonly total: number }[];\nconst totals: number[] = [];\nfor (const order of orders) {\n totals.push(order.total);\n}\n",
|
|
21
|
-
"expectedLines": [
|
|
22
|
-
3
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"name": "for-await loop",
|
|
27
|
-
"fileName": "for-await.ts",
|
|
28
|
-
"source": "declare const stream: AsyncIterable<number>;\nfor await (const entry of stream) console.log(entry);\n",
|
|
29
|
-
"expectedLines": [
|
|
30
|
-
2
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "counted for loop",
|
|
35
|
-
"fileName": "counted.ts",
|
|
36
|
-
"source": "for (let index = 0; index < 2; index++) console.log(index);\n",
|
|
37
|
-
"expectedLines": [
|
|
38
|
-
1
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "while loop",
|
|
43
|
-
"fileName": "while.ts",
|
|
44
|
-
"source": "declare const queue: number[];\nwhile (queue.length) queue.pop();\n",
|
|
45
|
-
"expectedLines": [
|
|
46
|
-
2
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"allow": [
|
|
51
|
-
{
|
|
52
|
-
"name": "array pipeline",
|
|
53
|
-
"fileName": "pipeline.ts",
|
|
54
|
-
"source": "export const totals = (orders: readonly { readonly total: number }[]): readonly number[] => orders.map((order) => order.total);\n",
|
|
55
|
-
"expectedLines": []
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "loop text in a comment line",
|
|
59
|
-
"fileName": "commented.ts",
|
|
60
|
-
"source": "// while (queue.length) drain();\nexport const value = 1;\n",
|
|
61
|
-
"expectedLines": []
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"name": "switch statement",
|
|
65
|
-
"fileName": "switch.ts",
|
|
66
|
-
"source": "export const pick = (kind: \"a\" | \"b\"): number => {\n switch (kind) {\n case \"a\": return 1;\n case \"b\": return 2;\n }\n};\n",
|
|
67
|
-
"expectedLines": []
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
}
|
package/rules/CD-16/CHECKS.md
DELETED
package/rules/CD-16/README.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# CD-16: No counted for loops
|
|
2
|
-
|
|
3
|
-
## Rule
|
|
4
|
-
|
|
5
|
-
Collapsed into [CD-15](../CD-15/README.md) — counted-loop iteration and
|
|
6
|
-
element iteration are two faces of the same intent (iteration is functional
|
|
7
|
-
transformation, not imperative looping). CD-15 now carries both. This id is
|
|
8
|
-
retained as a redirect so existing citations resolve; it is not independently
|
|
9
|
-
enforced.
|
|
10
|
-
|
|
11
|
-
Review lens: [function-first](../../methods/lenses/function-first.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
12
|
-
|
|
13
|
-
## Spirit
|
|
14
|
-
|
|
15
|
-
See [CD-15's Spirit section](../CD-15/README.md#spirit). A counted loop is the same signal as any other loop, plus a manual index that can drift out of bounds.
|
package/rules/CD-17/CHECKS.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# CD-17 checks
|
|
2
|
-
|
|
3
|
-
Read [the rule and its spirit](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
|
-
|
|
5
|
-
## Clauses
|
|
6
|
-
|
|
7
|
-
| Clause | Mechanism | Checks |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| `CD-17#clock-sources` | audit | `Date.now()` and `new Date` |
|
|
10
|
-
|
|
11
|
-
## What the check flags
|
|
12
|
-
- `.ts` and `.tsx` files, including tests. Generated folders (`node_modules`, `dist`, `build`, `coverage`, `.git`, root `vendor`) are skipped.
|
|
13
|
-
- Any line containing `Date.now()` or `new Date`, one finding per line. Comments and strings are matched too.
|
|
14
|
-
- Other time sources (`performance.now`, timers) are not checked; they are left to review.
|
|
15
|
-
- Other generated code can be left out of the check's scope with `exclude` in disciplines.json. Hand-written code that reads the time is not out of scope; it needs the clock port.
|
|
16
|
-
|
|
17
|
-
## Example violation
|
|
18
|
-
```ts
|
|
19
|
-
const startedAt = Date.now();
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## How to fix
|
|
23
|
-
```ts
|
|
24
|
-
const startedAt = clock.now();
|
|
25
|
-
```
|
|
26
|
-
Accept a clock as a dependency and read time only through it. The one real implementation lives in an adapter.
|
|
27
|
-
|
|
28
|
-
## Exceptions
|
|
29
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the single real clock implementation. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
{ "version": 1, "exceptions": [
|
|
33
|
-
{ "kind": "authorised-location", "clause": "CD-17#clock-sources", "file": "src/adapters/system-clock.ts", "reason": "..." }
|
|
34
|
-
] }
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
An `authorised-location` or `clause-wide-carve-out` also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. A `file-carve-out` is debt and needs only its `kind`, `clause` and `file`; its `reason` is an optional note, and a `whyChain` or `provenance` it gives anyway is still judged. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` may give only its `reason`, which will be refused in the next major release. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
|
package/rules/CD-17/README.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# CD-17: Clock is the only time source
|
|
2
|
-
|
|
3
|
-
## Rule
|
|
4
|
-
|
|
5
|
-
Time is an injected capability, not an ambient global: domain code never calls the runtime's now-primitives directly, it reads the current instant through a clock port. Real time enters through exactly one clock abstraction; tests inject a stub clock that returns written-out instants. Bare time construction anywhere else makes behaviour impossible to replace with a test double, and non-deterministic.
|
|
6
|
-
|
|
7
|
-
Review lens: [di-discipline](../../methods/lenses/di-discipline.md), [test-discipline](../../methods/lenses/test-discipline.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
10
|
-
|
|
11
|
-
**What the friction is for.** Code that reads the time itself behaves differently depending on when it runs. The friction makes time an input, so logic is deterministic and tests can set and advance time on demand.
|
|
12
|
-
|
|
13
|
-
**What a finding points at.** Match the sites against these causes.
|
|
14
|
-
- *Decisions that read the clock.* Business logic asks for the current time in the middle of a calculation. Pass the instant in, or inject the clock.
|
|
15
|
-
- *Time stamped in many places.* Many sites stamp records or events. One clock port at the edge; the instant travels inward as data.
|
|
16
|
-
- *Tests that wait or depend on wall time.* Flaky or slow tests point at a missing clock port. Inject a stub clock that returns written-out instants.
|
|
17
|
-
- *Tests that build their own instants.* A test making dates for itself is choosing time outside the clock. Take instants from the stub clock.
|
|
18
|
-
|
|
19
|
-
**Where to go.** One clock abstraction reads real time. Everything else receives an instant or the clock. Tests set the time they need.
|
|
20
|
-
|
|
21
|
-
**Reactions to distrust.**
|
|
22
|
-
- "It's just a log timestamp." It is still output nobody can pin in a test. Read it through the clock.
|
|
23
|
-
- "It's just tests." The rule covers tests. A test that reads real time cannot be repeated exactly.
|
|
24
|
-
- "Exclude that folder." Then that folder's behaviour depends on the hour it runs. Find the clock port it is missing.
|
|
25
|
-
|
|
26
|
-
**Principles behind it.**
|
|
27
|
-
- *Dependency Inversion Principle* (Robert C. Martin, SOLID). Time is a detail; the logic depends on a clock abstraction it is given.
|
|
28
|
-
- *Functional core, imperative shell* (Gary Bernhardt). Reading the clock is an effect at the shell. The core receives the instant as a value and stays pure.
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 1,
|
|
3
|
-
"id": "CD-17",
|
|
4
|
-
"clauses": [
|
|
5
|
-
{
|
|
6
|
-
"kind": "mechanical",
|
|
7
|
-
"id": "clock-sources",
|
|
8
|
-
"summary": "Clock is the only time source",
|
|
9
|
-
"mechanisms": [
|
|
10
|
-
"audit"
|
|
11
|
-
],
|
|
12
|
-
"anchor": {
|
|
13
|
-
"kind": "file"
|
|
14
|
-
},
|
|
15
|
-
"cases": {
|
|
16
|
-
"flag": [
|
|
17
|
-
{
|
|
18
|
-
"name": "Date.now call",
|
|
19
|
-
"fileName": "started-at.ts",
|
|
20
|
-
"source": "export const startedAt = Date.now();\n",
|
|
21
|
-
"expectedLines": [
|
|
22
|
-
1
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"name": "new Date construction",
|
|
27
|
-
"fileName": "wall-clock.ts",
|
|
28
|
-
"source": "export const stampNow = (): number => new Date().getTime();\n",
|
|
29
|
-
"expectedLines": [
|
|
30
|
-
1
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"allow": [
|
|
35
|
-
{
|
|
36
|
-
"name": "injected clock",
|
|
37
|
-
"fileName": "injected.ts",
|
|
38
|
-
"source": "export const stamp = (clock: { readonly now: () => number }): number => clock.now();\n",
|
|
39
|
-
"expectedLines": []
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "parsing a date string",
|
|
43
|
-
"fileName": "src/parse.ts",
|
|
44
|
-
"source": "export const parsed = (request: { readonly text: string }): number => Date.parse(request.text);\n",
|
|
45
|
-
"expectedLines": []
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
package/rules/CD-18/CHECKS.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# CD-18 checks
|
|
2
|
-
|
|
3
|
-
Read [the rule and its spirit](README.md) first. This page is the mechanics: how the rule is checked, and how to record an exception where the rule allows one.
|
|
4
|
-
|
|
5
|
-
## Clauses
|
|
6
|
-
|
|
7
|
-
| Clause | Mechanism | Checks |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| `CD-18#process-lifecycle-ports` | review | process signals, exit, kill and high-resolution timing arrive through an injected port |
|
|
10
|
-
|
|
11
|
-
## How it is checked
|
|
12
|
-
|
|
13
|
-
Every clause of this discipline is a judgement clause. It cannot be selected in `disciplines.json` and no mechanism checks it; a reviewer applies [the rule](README.md) with its review lens, as [ADOPTING.md](../../ADOPTING.md#9-apply-the-judgement-rules) describes. Selecting no clause of this discipline leaves nothing uncovered.
|
package/rules/CD-18/README.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# CD-18: Process-lifecycle operations arrive through an injected port
|
|
2
|
-
|
|
3
|
-
## Rule
|
|
4
|
-
|
|
5
|
-
Process-lifecycle side effects — signal handlers, exit, kill, high-resolution timing — are a capability that arrives through an injected port, not reached for ambiently on the runtime's process global. Confining them behind a port makes lifecycle behaviour composable and replaceable with a test double in tests, instead of a hidden dependency on the running process.
|
|
6
|
-
|
|
7
|
-
Review lens: [di-discipline](../../methods/lenses/di-discipline.md). The lens reviews the whole rule, including what no check flags. How it is checked: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
10
|
-
|
|
11
|
-
**What the friction is for.** Exiting, handling signals and reading process timers are side effects on the running program. The friction makes them a port the code receives, so lifecycle behaviour can be composed and tested.
|
|
12
|
-
|
|
13
|
-
**What a finding points at.** Match the sites against these causes.
|
|
14
|
-
- *Exit called deep inside.* A function ends the process instead of returning. Return the outcome; let the entry point decide to exit.
|
|
15
|
-
- *Signal handling scattered.* Several modules register handlers. Gather lifecycle in one port wired at startup.
|
|
16
|
-
- *Timing read from the process.* Code measures time through the process global. Inject it.
|
|
17
|
-
|
|
18
|
-
**Where to go.** Lifecycle operations arrive through one injected port. Only the composition root touches the real process.
|
|
19
|
-
|
|
20
|
-
**Reactions to distrust.**
|
|
21
|
-
- "It's a CLI, exit is normal." Exit at the entry point. Everywhere else, return.
|
|
22
|
-
|
|
23
|
-
**Principles behind it.**
|
|
24
|
-
- *Dependency Inversion Principle* (Robert C. Martin, SOLID). Code depends on a lifecycle abstraction, not the runtime global.
|
|
25
|
-
- *Functional core, imperative shell* (Gary Bernhardt). The decision to stop is a value; stopping happens at the shell.
|
package/rules/CD-19/CHECKS.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# CD-19 checks
|
|
2
|
-
|
|
3
|
-
Read [the rule and its spirit](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
|
-
|
|
5
|
-
## Clauses
|
|
6
|
-
|
|
7
|
-
| Clause | Mechanism | Checks |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| `CD-19#import-boundaries` | audit | imports of the packages the repository confines, and any `node:` import |
|
|
10
|
-
|
|
11
|
-
## What the check flags
|
|
12
|
-
- `.ts` and `.tsx` files, including tests and declaration files; generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
|
|
13
|
-
- A line with `from "<specifier>"` where the specifier is a package listed in the clause's `confinedPackages` setting (see [Settings](#settings)) or a subpath of one: `hono` covers `hono` and `hono/cors`, and `@scope/name` covers `@scope/name` and `@scope/name/client`. A longer name is a different package, so `hono` does not cover `honox` or `hono-extra`. With no packages listed, which is the default, no library import is flagged. Type-only imports and matches inside strings are flagged too.
|
|
14
|
-
- A `node:` specifier in an import, `export ... from`, `import("node:...")`, `import type`, `import x = require(...)` or `require("node:...")`. Unprefixed `fs` is not detected.
|
|
15
|
-
- The source rule covers every third-party dependency; the check covers only the listed packages. The rest is left to review.
|
|
16
|
-
|
|
17
|
-
## Settings
|
|
18
|
-
List each package the repository confines behind a wrapping port in `disciplines.json`, then record each wrapping file as an `authorised-location`:
|
|
19
|
-
|
|
20
|
-
```json
|
|
21
|
-
"clauseSettings": {
|
|
22
|
-
"CD-19#import-boundaries": { "confinedPackages": ["winston", "uuid"] }
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Example violation
|
|
27
|
-
With `"confinedPackages": ["uuid"]`, both lines are flagged; with the default, only the first.
|
|
28
|
-
```ts
|
|
29
|
-
import { readFileSync } from "node:fs";
|
|
30
|
-
import { v4 } from "uuid";
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## How to fix
|
|
34
|
-
```ts
|
|
35
|
-
import { createFileReader } from "./file-reader.ts";
|
|
36
|
-
import { createIdGenerator } from "./id-generator.ts";
|
|
37
|
-
```
|
|
38
|
-
Import your own port. Only the wrapping file imports the library.
|
|
39
|
-
|
|
40
|
-
## Exceptions
|
|
41
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` for the file that is the wrapping boundary for that dependency. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
42
|
-
|
|
43
|
-
```json
|
|
44
|
-
{ "version": 1, "exceptions": [
|
|
45
|
-
{ "kind": "authorised-location", "clause": "CD-19#import-boundaries", "file": "src/adapters/file-reader.ts", "reason": "..." }
|
|
46
|
-
] }
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
An `authorised-location` or `clause-wide-carve-out` also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. A `file-carve-out` is debt and needs only its `kind`, `clause` and `file`; its `reason` is an optional note, and a `whyChain` or `provenance` it gives anyway is still judged. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` may give only its `reason`, which will be refused in the next major release. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
|
package/rules/CD-19/README.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# CD-19: External dependencies confined to wrapping ports at the boundary
|
|
2
|
-
|
|
3
|
-
## Rule
|
|
4
|
-
|
|
5
|
-
Every dependency on code the project does not own — a third-party library or the runtime's own standard library alike — is confined to a single wrapping port at the boundary; the rest of the codebase depends on that port, never the vendor or platform surface, runtime or type-only. A dependency swap then touches one file, the vendor's types never leak inward, and each confined capability is nameable and replaceable with a test double. There is no inline carve-out: a stdlib call in the middle of business logic is as much a violation as a scattered library import. Opening a new wrapping site for a new dependency is a deliberate, recorded decision.
|
|
6
|
-
|
|
7
|
-
Review lens: [function-first](../../methods/lenses/function-first.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
10
|
-
|
|
11
|
-
**What the friction is for.** Depending on code you do not own hands that code a say in the shape of yours. The friction makes depending on your own port the easy path, so a swap touches one file, vendor types stay out, and every capability has a name and a test double.
|
|
12
|
-
|
|
13
|
-
**What a finding points at.** Match the sites against these causes.
|
|
14
|
-
- *A capability with no name.* Many files import the same library or runtime module. Name the capability, wrap it once, inject it.
|
|
15
|
-
- *A port that leaks.* A wrapper exists but passes vendor types or objects through, so callers import the vendor anyway. Make the port speak your types.
|
|
16
|
-
- *Decisions doing I/O.* A runtime call sits in the middle of business logic. Separate the decision from the effect; the effect arrives through a port.
|
|
17
|
-
- *Construction spread everywhere.* Each module builds its own dependencies. Move construction to one composition root that passes ports in.
|
|
18
|
-
|
|
19
|
-
**Where to go.** Each external capability has one wrapping file, recorded as its authorised location. Everything else imports your port. Opening a new wrapper is a recorded decision, not an inline one.
|
|
20
|
-
|
|
21
|
-
**Reactions to distrust.**
|
|
22
|
-
- "It's only the standard library." The same reasons apply: it cannot be replaced in a test and it ties logic to a platform. The rule makes no stdlib carve-out.
|
|
23
|
-
- "Wrapping is boilerplate." One small file per capability, against the whole codebase knowing a vendor's surface.
|
|
24
|
-
- "Exclude that folder." An excluded folder is a boundary nobody designed. Design it, then authorise the one file.
|
|
25
|
-
|
|
26
|
-
**Principles behind it.**
|
|
27
|
-
- *Dependency Inversion Principle* (Robert C. Martin, SOLID). Your code depends on an abstraction you own; the vendor detail depends on it, not the other way round.
|
|
28
|
-
- *Ports and adapters* (Alistair Cockburn, hexagonal architecture). The application talks through ports; one adapter per outside system translates. Swapping the system means swapping the adapter.
|
|
29
|
-
- *Functional core, imperative shell* (Gary Bernhardt). Decisions stay pure; effects live at the edge and arrive through ports.
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 1,
|
|
3
|
-
"id": "CD-19",
|
|
4
|
-
"clauses": [
|
|
5
|
-
{
|
|
6
|
-
"kind": "mechanical",
|
|
7
|
-
"id": "import-boundaries",
|
|
8
|
-
"summary": "External dependencies confined to wrapping ports at the boundary",
|
|
9
|
-
"mechanisms": [
|
|
10
|
-
"audit"
|
|
11
|
-
],
|
|
12
|
-
"anchor": {
|
|
13
|
-
"kind": "file"
|
|
14
|
-
},
|
|
15
|
-
"cases": {
|
|
16
|
-
"flag": [
|
|
17
|
-
{
|
|
18
|
-
"name": "node: import",
|
|
19
|
-
"fileName": "reads-file.ts",
|
|
20
|
-
"source": "import { readFileSync } from \"node:fs\";\n\nexport const read = readFileSync;\n",
|
|
21
|
-
"expectedLines": [
|
|
22
|
-
1
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"name": "require of a node: module",
|
|
27
|
-
"fileName": "requires.ts",
|
|
28
|
-
"source": "export const loaded = require(\"node:path\");\n",
|
|
29
|
-
"expectedLines": [
|
|
30
|
-
1
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"allow": [
|
|
35
|
-
{
|
|
36
|
-
"name": "library import while no specifier is confined",
|
|
37
|
-
"fileName": "imports-winston.ts",
|
|
38
|
-
"source": "import winston from \"winston\";\n\nexport const useWinston = (): unknown => winston;\n",
|
|
39
|
-
"expectedLines": []
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "project-owned import",
|
|
43
|
-
"fileName": "own.ts",
|
|
44
|
-
"source": "import { logger } from \"./logger-port.ts\";\n\nexport const log = logger;\n",
|
|
45
|
-
"expectedLines": []
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"name": "unlisted library import",
|
|
49
|
-
"fileName": "other.ts",
|
|
50
|
-
"source": "import { z } from \"zod\";\n\nexport const schema = z;\n",
|
|
51
|
-
"expectedLines": []
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"name": "unprefixed fs is not detected",
|
|
55
|
-
"fileName": "bare-fs.ts",
|
|
56
|
-
"source": "import { readFileSync } from \"fs\";\n\nexport const read = readFileSync;\n",
|
|
57
|
-
"expectedLines": []
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
package/rules/CD-2/CHECKS.md
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# CD-2 checks
|
|
2
|
-
|
|
3
|
-
Read [the rule and its spirit](README.md) first. This page is the mechanics: what each check flags and misses, how to fix a flagged site, and how to record an exception.
|
|
4
|
-
|
|
5
|
-
## Clauses
|
|
6
|
-
|
|
7
|
-
| Clause | Mechanism | Checks |
|
|
8
|
-
| --- | --- | --- |
|
|
9
|
-
| `CD-2#cast-expressions` | audit | a type assertion that is not on the permitted list |
|
|
10
|
-
| `CD-2#non-null-assertions` | eslint | a non-null assertion, `x!`, or a definite assignment assertion, `let x!: T` or `field!: T` |
|
|
11
|
-
|
|
12
|
-
## What the check flags
|
|
13
|
-
- `.ts` and `.tsx` files; generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
|
|
14
|
-
- Every `x as T` and `<T>x` assertion except a const assertion, `as const` or `<const>x`. Assertions whose type contains `any` are CD-1's and are not repeated here.
|
|
15
|
-
- `as unknown` and `<unknown>x` are flagged. Widening never needs an assertion: annotate instead, `const parsed: unknown = JSON.parse(text)`.
|
|
16
|
-
- A cast through `unknown`, such as `raw as unknown as User`, `(<unknown>raw) as User` or one wrapped in `!` or `satisfies`, is flagged with its own message, and so is its `unknown` half. It is the escape hatch that turns any value into any type; check the value's shape at runtime at the boundary instead.
|
|
17
|
-
- `@ts-expect-error`, `@ts-ignore` and `@ts-nocheck` in the `.ts` and `.tsx` files this clause checks are reported as `inline-disable` native exceptions of this clause, where the compiler honours them and whether or not they hide a cast. Directives in `.mts`, `.cts` and JavaScript files are not read. Each is debt on this clause in its file: an `authorised-location` or `file-carve-out` on the file covers it, a `clause-wide-carve-out` does not, and a tracked reference on the comment (CD-5) does not stand in for the record.
|
|
18
|
-
- Test files, test helpers and scripts are checked like any other source; a test that needs a cast needs a typed stub or a narrower port.
|
|
19
|
-
- There are no settings: a boundary that forces a cast is an exception record, as below.
|
|
20
|
-
|
|
21
|
-
## What the ESLint check flags
|
|
22
|
-
Needs ESLint adopted through the projection; see [the ESLint piece](../../mechanisms/eslint/CD-2/README.md).
|
|
23
|
-
- `hone-cd2/no-restricted-syntax` is ESLint's `no-restricted-syntax` with two selectors, one per form.
|
|
24
|
-
- `TSNonNullExpression` flags every non-null assertion, `x!`, wherever it sits: a read such as `user.name!`, a call such as `totals.get(key)!.toFixed(2)`, an assignment target such as `basket.total! = 0`. It is the same node typescript-eslint's `no-non-null-assertion` reports.
|
|
25
|
-
- `[definite=true]` flags every definite assignment assertion: `let total!: number` and a class field `balance!: number`.
|
|
26
|
-
- Each finding sits on the line where the asserted expression or the declared name starts.
|
|
27
|
-
- Allowed: logical not `!ready`, `!==`, an optional property `total?: number`, `??` fallbacks, and an initialised binding.
|
|
28
|
-
- There are no settings. No `audit` mechanism checks this clause, so a repository without ESLint lists it as `"not-run"`, and review owes it.
|
|
29
|
-
|
|
30
|
-
## Example violation
|
|
31
|
-
```ts
|
|
32
|
-
const user = response as User;
|
|
33
|
-
const name = user.name!;
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## How to fix
|
|
37
|
-
```ts
|
|
38
|
-
const user = userSchema.parse(response);
|
|
39
|
-
const name = user.name ?? "anonymous";
|
|
40
|
-
```
|
|
41
|
-
Parse or narrow the value so the type follows from a check rather than from an assertion. For a value that may be absent, handle the absent case with a check, a fallback or an early return; for a binding assigned later, initialise it where it is declared or make it a `const` built from what it needs.
|
|
42
|
-
|
|
43
|
-
In a test file, `CD-27#test-body-logic` flags an `if` check at either edition, and its edition 2 flags the `??` fallback: there, `assert.isDefined` a value that may be missing before reading it, as [CD-27's allowed forms](../CD-27/CHECKS.md#a-short-circuit) show.
|
|
44
|
-
|
|
45
|
-
When handing a value across a boundary truly forces a cast, such as a library that types its schemas loosely or a database driver that returns unparsed rows, put the cast in the one adapter file at that boundary and record that file as an `authorised-location` with a why-chain. With clean boundaries that is one file and one record; casts scattered across many files are the sign the boundary is missing.
|
|
46
|
-
|
|
47
|
-
## Exceptions
|
|
48
|
-
Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a file sits on an external boundary that forces an assertion, such as an adapter. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs no `whyChain`. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
|
|
49
|
-
|
|
50
|
-
```json
|
|
51
|
-
{ "version": 1, "exceptions": [
|
|
52
|
-
{ "kind": "authorised-location", "clause": "CD-2#cast-expressions", "file": "src/adapters/row-reader.ts", "reason": "..." }
|
|
53
|
-
] }
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Records on `CD-2#non-null-assertions` take the same kinds. Existing `!` debt is usually a `file-carve-out` per file, or one `clause-wide-carve-out` while an assessment's steps pay it down. An `eslint-disable` naming `hone-cd2/no-restricted-syntax`, or naming no rule, is held only by an `authorised-location` or `file-carve-out` on this clause and its file; a `clause-wide-carve-out` does not hold it. The projection carries every record for it, so run `hone project` after recording one.
|
|
57
|
-
|
|
58
|
-
An `authorised-location` or `clause-wide-carve-out` also needs a `whyChain` that follows the [why-chain contract](../../docs/why-chain-contract.md): five whys chained cause to cause, a `rootCause`, its `rootCheck`, a `readback` and an `owner`. A record imported from an earlier system carries `provenance` instead. A `file-carve-out` is debt and needs only its `kind`, `clause` and `file`; its `reason` is an optional note, and a `whyChain` or `provenance` it gives anyway is still judged. With `"fileExceptionWhyChains": "optional"` in `disciplines.json`, an `authorised-location` may give only its `reason`, which will be refused in the next major release. [The exceptions format](../../README.md#discipline-exceptionsjson) gives each shape.
|
package/rules/CD-2/README.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# CD-2: Closed enumerated list of permitted cast sites
|
|
2
|
-
|
|
3
|
-
## Rule
|
|
4
|
-
|
|
5
|
-
A type assertion tells the compiler the value is something the compiler cannot see — it is a claim the type system can no longer check. Casting is therefore permitted only at a closed, enumerated list of sites where an external boundary genuinely forces it, each one an exception record for the file at that boundary. Everywhere else a cast is a design smell: the type is wrong, so fix the type rather than assert over it. Adding a site to the permitted list is a deliberate, recorded amendment, not an inline decision.
|
|
6
|
-
|
|
7
|
-
Review lens: [type-soundness](../../methods/lenses/type-soundness.md). The lens reviews the whole rule, including what no check flags. What each check flags, how to fix a flagged site, and how to record an exception: [CHECKS.md](CHECKS.md). The thinking behind every rule: [the spirit of the rules](../SPIRIT.md).
|
|
8
|
-
|
|
9
|
-
## Spirit
|
|
10
|
-
|
|
11
|
-
**What the friction is for.** A cast is a claim the compiler cannot check. The friction makes the honest route, parsing the value or fixing its type, the easy one. The few claims that remain are visible and sit in known places.
|
|
12
|
-
|
|
13
|
-
**What a finding points at.** Match the sites against these causes.
|
|
14
|
-
- *Parsing skipped at a boundary.* Raw input is asserted into shape instead of checked. Parse it once where it enters and the type follows.
|
|
15
|
-
- *A declared type that is wrong.* The code builds something its type does not describe. Fix the declaration and the cast goes.
|
|
16
|
-
- *A boundary that is missing.* Casts cluster around one library or data source across many files. Make one wrapping file the boundary and keep the rest cast-free.
|
|
17
|
-
- *A return type wider than its use.* A function returns a broad type and every caller narrows it. Return the narrow type.
|
|
18
|
-
- *A parameter type wider than its use.* A function asks for a whole record but reads two fields. It shows in tests, where someone casts a two-field object through to the full type rather than build it all. The function asks for more than it needs. Accept only the fields it uses; the test then builds those two fields honestly.
|
|
19
|
-
|
|
20
|
-
**Where to go.** Casts live only in a few named boundary files, each recorded as an authorised location. Clean boundaries make that cheap; that is what authorised locations are for. Everywhere else the type follows from a check.
|
|
21
|
-
|
|
22
|
-
**Reactions to distrust.**
|
|
23
|
-
- "It's just tests." Tests are violations too. A test that casts is building a value its type does not allow. Either build it properly, or the unit asks for more than it uses.
|
|
24
|
-
- "Add a permission for this shape." Measure first. A permission can hide a real defect, such as database rows that were never parsed.
|
|
25
|
-
- "The library forces it." It forces one site. Put that site in the wrapping file.
|
|
26
|
-
|
|
27
|
-
**Principles behind it.**
|
|
28
|
-
- *Parse, don't validate* (Alexis King). A parse produces the type; a cast only claims it. Parse once at the boundary and the claim is never needed.
|
|
29
|
-
- *Interface Segregation Principle* (Robert C. Martin, SOLID). Depend only on what you use. A parameter that asks for exactly the fields it reads needs no cast to satisfy, in production or in tests.
|
|
30
|
-
- *Ports and adapters* (Alistair Cockburn, hexagonal architecture). The adapter at the edge is where outside shapes are translated, so it is the one place an unavoidable assertion belongs.
|