@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/README.md
CHANGED
|
@@ -1,54 +1,335 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
|
18
|
-
|
|
19
|
-
| [
|
|
20
|
-
| [
|
|
21
|
-
| [
|
|
22
|
-
| [
|
|
23
|
-
| [
|
|
24
|
-
| [
|
|
25
|
-
| [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
# How to read the rules
|
|
2
|
+
|
|
3
|
+
A finding names a symptom. Read it along the chain:
|
|
4
|
+
|
|
5
|
+
**symptom → case → why → reason to change**
|
|
6
|
+
|
|
7
|
+
A [symptom](typescript/symptoms.md) is what was seen in the code. It points at the [cases](cases.md) it may indicate: what the code was trying to do. Each case owes one or more whys, its [principles](principles.md), and each principle names its reason to change. The [rules](rules.md) under a principle say what must hold, and the [recipes](typescript/recipes.md) are the known methods that make a rule hold.
|
|
8
|
+
|
|
9
|
+
## Why these rules are strict
|
|
10
|
+
|
|
11
|
+
"my rules are stricter than most because leaving any trade off or judgement based calls to llm leads to the easiest option locally. Which is almost never the better choice."
|
|
12
|
+
|
|
13
|
+
So no principle or rule leaves a trade-off or a judgement call to the reader. It states what must hold. The room for a correct exception is a record, never softness in the text. Being stricter than a cited source is intended.
|
|
14
|
+
|
|
15
|
+
## The model
|
|
16
|
+
|
|
17
|
+
| Kind | What it is | Industry name |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| [Principle](principles.md) | A why. What it protects and its reason to change. | Rationale |
|
|
20
|
+
| [Case](cases.md) | What the code is trying to do ("this needs the current time"). Where the why is owed. | Problem in context |
|
|
21
|
+
| [Rule](rules.md) | What must hold. Carries no exceptions. | Requirement |
|
|
22
|
+
| [Recipe](typescript/recipes.md) | A known method that makes a rule hold, with the reason it was chosen. "It's as binding as it's reasoning. The proof of burden is on the deviation to show that the reason it was chosen no longer holds." | Acceptable means of compliance; pattern |
|
|
23
|
+
| [Symptom](typescript/symptoms.md) | Something seen in code. Suspect by default. May point at several rules. | Code smell |
|
|
24
|
+
| [Check](typescript/checks.md) | How a symptom is found. Imperfect by design. | Enforcement; fitness function |
|
|
25
|
+
| [Record](records.md) | A thought-through use, known debt, or a design decision. | Deviation record; ADR |
|
|
26
|
+
|
|
27
|
+
"Reasons to change" is not on the list. It is the test used to place a boundary and to decide whether two things are one.
|
|
28
|
+
|
|
29
|
+
## The language boundary
|
|
30
|
+
|
|
31
|
+
Principles, cases and rules are cross-language. Recipes, symptoms and checks are written for one language; TypeScript is the one today, under [typescript](typescript/symptoms.md).
|
|
32
|
+
|
|
33
|
+
Two tests for a rule:
|
|
34
|
+
1. It names no language feature. If it only makes sense because of a quirk of the language, it is a symptom or a recipe for that language.
|
|
35
|
+
2. The other rules together do not already give it. If they do, it is a case.
|
|
36
|
+
|
|
37
|
+
## Names, not numbers
|
|
38
|
+
|
|
39
|
+
Rules, principles, cases, recipes and symptoms are named, not numbered. A name's id is the name, hyphenated. [Every CD](numbers.md) maps each old number to its new names. Selections, records and findings still use the numbered clause addresses; each check's mechanics are on its own page under its symptom.
|
|
40
|
+
|
|
41
|
+
[Every CD](numbers.md#every-numbered-discipline) lists each numbered discipline with its title, clauses, files checked and review lens.
|
|
42
|
+
|
|
43
|
+
## Words used the same way everywhere
|
|
44
|
+
|
|
45
|
+
- **Business logic:** all code outside a recorded boundary.
|
|
46
|
+
- **Unit:** one function.
|
|
47
|
+
- **Port:** an interface of ours that business logic is handed.
|
|
48
|
+
- **Adapter:** a unit inside a recorded boundary that fulfils a port.
|
|
49
|
+
- **Passed in:** given as an argument or to the factory that built the unit. Never imported.
|
|
50
|
+
- **One decision:** one reason to change.
|
|
51
|
+
- **Outside dependency:** what was called a package. An internal package is our own code.
|
|
52
|
+
|
|
53
|
+
## The pages
|
|
54
|
+
|
|
55
|
+
| Page | What it holds |
|
|
56
|
+
|---|---|
|
|
57
|
+
| [principles.md](principles.md) | The principles, each with what must hold, what it protects, its reason to change and where a breach sits |
|
|
58
|
+
| [cases.md](cases.md) | The cases under each principle, the whys each owes, and what to do |
|
|
59
|
+
| [rules.md](rules.md) | The named rules |
|
|
60
|
+
| [records.md](records.md) | The record kinds, and today's record formats beside them |
|
|
61
|
+
| [sources.md](sources.md) | The sources behind each principle, rule, recipe and record kind |
|
|
62
|
+
| [typescript/recipes.md](typescript/recipes.md) | The recipes for TypeScript |
|
|
63
|
+
| [typescript/symptoms.md](typescript/symptoms.md) | The symptoms in TypeScript, and how near today's checks come |
|
|
64
|
+
| [typescript/checks.md](typescript/checks.md) | Each check, its margin and its settings |
|
|
65
|
+
| [numbers.md](numbers.md) | Every CD number and its new names |
|
|
66
|
+
|
|
67
|
+
## Selecting checks
|
|
68
|
+
|
|
69
|
+
Adopters select clauses in `disciplines.json`. Selecting one clause adopts its discipline, so every mechanical clause of an adopted discipline must be selected, each through one of its checks, or listed as `"not-run"` or `"not-adopted"`; the check reports the rest as uncovered. Review clauses are judgement clauses: they cannot be selected and are applied in review with the discipline's review lens, as [ADOPTING.md](../ADOPTING.md#9-apply-the-judgement-rules) describes.
|
|
70
|
+
|
|
71
|
+
Exceptions are recorded in `discipline-exceptions.json`; see [the package README](../README.md#hone-records). [The spirit of the rules](SPIRIT.md) explains what the friction is for.
|
|
72
|
+
|
|
73
|
+
## Principles
|
|
74
|
+
|
|
75
|
+
A principle is a why: what it protects and its reason to change. Each is stated in the same four lines: what must hold, what it protects, its reason to change, and where a breach sits.
|
|
76
|
+
|
|
77
|
+
The principles hold in combination, not one at a time. "The principles are not to hold my rulings on their own but in combination."
|
|
78
|
+
|
|
79
|
+
Principles name no language, tool or library. [Cases](cases.md) say what to do for each thing code is trying to do, and [rules](rules.md) say what must hold under each principle.
|
|
80
|
+
|
|
81
|
+
## Not principles
|
|
82
|
+
|
|
83
|
+
- **Failures as values.** A rule under The type checker proves it.
|
|
84
|
+
- **Sensitive data.** Its rules stand on their own with safety as their why.
|
|
85
|
+
- **Determinism.** The test half is in Tests are ours ("inputs the test writes out"). The other half is in One place decides (one unit dates, one numbers) and External behaviour sits at a boundary (a clock depends on more than its arguments).
|
|
86
|
+
- **Reasons to change.** The test that says what one decision is, not a principle.
|
|
87
|
+
|
|
88
|
+
## Rules
|
|
89
|
+
|
|
90
|
+
A rule states what must hold. It carries no exceptions. A rule's id is its name, hyphenated.
|
|
91
|
+
|
|
92
|
+
Each rule passes two tests: it names no language feature, and the other rules together do not already give it. Where a rule only restated its principle, it was dropped and the principle decides. The room for a correct exception is a [record](records.md), never softness in the text.
|
|
93
|
+
|
|
94
|
+
## Rules: No hidden effects
|
|
95
|
+
|
|
96
|
+
No rule. The principle decides. State that changes between calls lives only in an adapter: No hidden effects plus External behaviour sits at a boundary give it, so it is a case.
|
|
97
|
+
|
|
98
|
+
## Rules: External behaviour sits at a boundary
|
|
99
|
+
|
|
100
|
+
Outside dependency: what was called a package. An internal package is our own code, under One reason per module and the layering.
|
|
101
|
+
|
|
102
|
+
## Rules: No leak across a boundary
|
|
103
|
+
|
|
104
|
+
No rule. The principle, now covering data and failures, plus One reason per module, gives one adapter per outside party that maps both ways, so Reads data from outside (request, file, environment, stored row, response) and Sends data out of the program are each a case that owes One reason per module.
|
|
105
|
+
|
|
106
|
+
## Cases
|
|
107
|
+
|
|
108
|
+
A case is what the code is trying to do. It is where the why is owed. A case may owe more than one why. "Owes" lists principles by short name; the first one decides what to do.
|
|
109
|
+
|
|
110
|
+
Short names: Tests ([Tests are ours](principles.md#tests-are-ours)), One place ([One place decides](principles.md#one-place-decides)), Effects ([No hidden effects](principles.md#no-hidden-effects)), Boundary ([External behaviour sits at a boundary](principles.md#external-behaviour-sits-at-a-boundary)), Leak ([No leak across a boundary](principles.md#no-leak-across-a-boundary)), Checker ([The type checker proves it](principles.md#the-type-checker-proves-it)), Language ([Our code reads in the common language](principles.md#our-code-reads-in-the-common-language)), Outside risk ([Outside risk is carried on purpose](principles.md#outside-risk-is-carried-on-purpose)).
|
|
111
|
+
|
|
112
|
+
Cases name no language, tool or library.
|
|
113
|
+
|
|
114
|
+
## Cases: Tests are ours
|
|
115
|
+
|
|
116
|
+
Quoted reasons: "If it calls something and uses its output we hardcode that output using DI." "no for each in tests, hard coded and not dynamic only" "No conditional run time checks within an expect. Use an assert to narrow and standard expects" "if its a unit test it covers the unit it is the companion file to" "They are integration test tools. Per my code disciplines they are for the boundary it needs only."
|
|
117
|
+
|
|
118
|
+
## Cases: One place decides
|
|
119
|
+
|
|
120
|
+
Quoted reasons: "I hold to functions are doers or are orchestrator a teaching." "If it's long it's doing too many things inline." "If nested it's a poorly modelled set of questions for a single job." "the choice of duplicate or not or boundary or not is pretty much always a deep think on "reasons to change"" "all types have a purpose. that purpose is its reason to exist and its reason to change" "dry is true but it must be held with reasons to change not "same functional code right now""
|
|
121
|
+
|
|
122
|
+
## Cases: No hidden effects
|
|
123
|
+
|
|
124
|
+
Quoted reasons: "An effect can be checked at the units seam is about testing what is ours not what isn't." "this is a bunch of nullable and state management mess"
|
|
125
|
+
|
|
126
|
+
Quoted reasons: "An effect can be checked at the units seam is about testing what is ours not what isn't." "this is a bunch of nullable and state management mess"
|
|
127
|
+
|
|
128
|
+
## Cases: External behaviour sits at a boundary
|
|
129
|
+
|
|
130
|
+
Quoted reasons: "we have a clock, why is bare date being used?" "Yes the library and the data are different reasons to change. Often why we have a port for http and a port for the specific resource/domain that utilises the http port to access it."
|
|
131
|
+
|
|
132
|
+
## Cases: No leak across a boundary
|
|
133
|
+
|
|
134
|
+
Quoted reasons: "I didn't want a json parse wrapper. I wanted a boundary on whoever made json" "our usecase of literal json should only be boundaries that are using json. As we should be runtime objects not json as soon as we leave a boundary" "no default, must be provided as env var"
|
|
135
|
+
|
|
136
|
+
## Cases: The type checker proves it
|
|
137
|
+
|
|
138
|
+
Quoted reasons: "sounds like a rule of the type checker in a way. As it makes the output clear to type system instead of hidden in throws" "way too much casting, hint: the correct amount of casting is **0**"
|
|
139
|
+
|
|
140
|
+
## Cases: Our code reads in the common language
|
|
141
|
+
|
|
142
|
+
Quoted reasons: "dont care if its a lambda function or not, meaningful names always" "If the code isn't self explanatory that's the problem. You shouldn't need usage notes at all." "language additions beyond the common language expected of engineers in the space and language obscuring standard operations."
|
|
143
|
+
|
|
144
|
+
Meaning by name, never by position: a unit whose signature is ours takes one argument; a callback shaped by an outside API takes what that API passes.
|
|
145
|
+
|
|
146
|
+
## Cases: Outside risk is carried on purpose
|
|
147
|
+
|
|
148
|
+
Quoted reasons: "Packages need a justification for the maintenance they add."
|
|
149
|
+
|
|
150
|
+
Outside dependency: what was called a package. An internal package is our own code. An internal package falls under One place decides and the layering, not this case.
|
|
151
|
+
|
|
152
|
+
## Outside the cases
|
|
153
|
+
|
|
154
|
+
- **Sensitive data:** safety is their why; no principle forces them.
|
|
155
|
+
- **Records and debt:** see [records](records.md).
|
|
156
|
+
- **A named ban:** no record makes it correct. Existing use is still held as debt, like any symptom.
|
|
157
|
+
- **How rules and checks are written:** spirit pure, strict wording, checks imperfect by design.
|
|
158
|
+
- **Process:** root cause over a guard, no deferring, no ask-me exits, no parallel machinery.
|
|
159
|
+
|
|
160
|
+
## Recipes
|
|
161
|
+
|
|
162
|
+
A recipe is a known method that makes a [rule](rules.md) hold, with the reason it was chosen. Recipes name the tool, the feature and the method. Rules stay as they are.
|
|
163
|
+
|
|
164
|
+
A recipe is "as binding as it's reasoning. The proof of burden is on the deviation to show that the reason it was chosen no longer holds."
|
|
165
|
+
|
|
166
|
+
So every recipe says why it was chosen, and binds as far as that reason holds. **A [deviation record](records.md#deviation) names the recipe and its reason, and shows that this reason does not hold at this site. Showing that another method also meets the rule is not enough.**
|
|
167
|
+
|
|
168
|
+
Where a reason is marked **proposed**, it is not yet accepted.
|
|
169
|
+
|
|
170
|
+
Outside dependency: what was called a package. An internal package is our own code.
|
|
171
|
+
|
|
172
|
+
## Recipes: No hidden effects
|
|
173
|
+
|
|
174
|
+
The principle decides.
|
|
175
|
+
|
|
176
|
+
## Recipes: No leak across a boundary
|
|
177
|
+
|
|
178
|
+
The principle decides.
|
|
179
|
+
|
|
180
|
+
## Recipes: Shipped risk declared
|
|
181
|
+
|
|
182
|
+
Proposed, not accepted: the rule, its case [Ships code for others](cases.md#proposed-cases), and this recipe.
|
|
183
|
+
|
|
184
|
+
## Built-ins and libraries: decided answers
|
|
185
|
+
|
|
186
|
+
Whether code of ours may use a built-in or a library directly, as the principles decide it. Short names in the "By" column: Tests ([Tests are ours](principles.md#tests-are-ours)), One place ([One place decides](principles.md#one-place-decides)), Effects ([No hidden effects](principles.md#no-hidden-effects)), Boundary ([External behaviour sits at a boundary](principles.md#external-behaviour-sits-at-a-boundary)), Leak ([No leak across a boundary](principles.md#no-leak-across-a-boundary)), Checker ([The type checker proves it](principles.md#the-type-checker-proves-it)), Language ([Our code reads in the common language](principles.md#our-code-reads-in-the-common-language)), Outside risk ([Outside risk is carried on purpose](principles.md#outside-risk-is-carried-on-purpose)).
|
|
187
|
+
|
|
188
|
+
| Case | Answer | By |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| `console` | Only through a port passed in | Effects |
|
|
191
|
+
| `Date.now()` in `chargeOrder` | No: it depends on more than its arguments, and dating is another unit's decision | Boundary, One place, Tests |
|
|
192
|
+
| An HTTP client, or our own wrapper of one, imported | No: a port passed in | Boundary |
|
|
193
|
+
| `Intl.NumberFormat` | No: depends on the runtime's locale data | Boundary |
|
|
194
|
+
| `structuredClone`, `Math`, `Map`, `URL` | Direct in business logic; never to compute a test's expectation | Boundary, Tests |
|
|
195
|
+
| `JSON.parse`, `isValidIBAN` | Direct, no wrapper, in the adapter | Leak |
|
|
196
|
+
| `z.infer` as a business-logic type | No: not our own type, and an outside dependency's type in a signature | Leak, Boundary, Language |
|
|
197
|
+
| `addBusinessDays` from a library | No: the decision is not made by a unit of ours | One place |
|
|
198
|
+
| `decimal.js` for integer cents | No: the record cannot say why native was not enough | Outside risk |
|
|
199
|
+
| `neverthrow`, `ts-pattern`, `fp-ts`, `type-fest` | No | Language, Outside risk |
|
|
200
|
+
| lodash | No | named ban |
|
|
201
|
+
|
|
202
|
+
Quoted reasons: "json and Zod indicate a boundary about external behaviour. Same with clock. Math and map are deterministic logic." "Math and map are deterministic logic. Banned in tests." "Zod is the wire. We can use infer to create a native type we then use on an adapter to create our domain object." "For of mutates by its nature. It doesn't return. It's state holding required or side effect based." "no for of, use functional paradigms and avoid mutation, this solution is rejected" "Lodash is banned. Personal rule."
|
|
203
|
+
|
|
204
|
+
## Symptoms
|
|
205
|
+
|
|
206
|
+
A symptom is something seen in code. It is suspect by default, and it may point at several rules. Symptoms here name TypeScript constructs. "Clearly a symptom can exist with ambiguity about reasoning."
|
|
207
|
+
|
|
208
|
+
A finding has two addresses: where the symptom is seen, and where the breach sits. A symptom's id is its name, hyphenated.
|
|
209
|
+
|
|
210
|
+
Where the thing seen is correct use, a [record](records.md) covers it. The record kind is named under "Breach usually sits". No symptom carries an exception.
|
|
211
|
+
|
|
212
|
+
**May indicate** lists cases, then the rules they point at, as case → rule.
|
|
213
|
+
|
|
214
|
+
**Seen by** is one of:
|
|
215
|
+
- **syntax:** the file's tree alone;
|
|
216
|
+
- **types:** needs the type checker;
|
|
217
|
+
- **graph:** needs the import graph;
|
|
218
|
+
- **app:** needs the app's structure;
|
|
219
|
+
- **files:** config, file names or build output;
|
|
220
|
+
- **history:** needs the change history;
|
|
221
|
+
- **person:** only a person sees it.
|
|
222
|
+
|
|
223
|
+
**Check today** is how near today's checks come, from the [checks page](typescript/checks.md): reuse, partial, review (only a review clause covers it), new (nothing covers it), or only review (a person sees it).
|
|
224
|
+
|
|
225
|
+
Outside dependency: what was called a package. An internal package is our own code.
|
|
226
|
+
|
|
227
|
+
## Symptoms: Text and schemas past their reader
|
|
228
|
+
|
|
229
|
+
"Json use and Zod use both imply same sort of symptom". They are two symptoms because two different things are seen.
|
|
230
|
+
|
|
231
|
+
## Checks
|
|
232
|
+
|
|
233
|
+
A check is how a [symptom](typescript/symptoms.md) is found. It is imperfect by design. "We aim for a check to find that. But we assess ways to narrow the margin of error and start with the 80/20 rule and reuse what we have where it is sufficient for first cut of mechanical ways to check what we are looking for."
|
|
234
|
+
|
|
235
|
+
So the symptom states exactly what is seen; a check aims at it and states its margin: what it flags that is not the symptom, and what it misses. An existing check that is sufficient for a first cut is reused.
|
|
236
|
+
|
|
237
|
+
Correct use at an authorised location is never margin: "it flagging the one allowed location is not a fault. It's what authorised locations are for".
|
|
238
|
+
|
|
239
|
+
Today's checks are addressed by clause. [Every CD](numbers.md#every-mechanical-clause) gives the symptom each mechanical clause sees.
|
|
240
|
+
|
|
241
|
+
Outside dependency: what was called a package. An internal package is our own code. Telling an outside dependency from an internal package needs the workspace layout, which is files and config Hone can read.
|
|
242
|
+
|
|
243
|
+
**Columns.**
|
|
244
|
+
- **Reports:** *seen* (where the symptom is), or *seen → breach* (it could also name the breach, given what follows the arrow).
|
|
245
|
+
- **Needs:** syntax, types, graph (imports between files), app (the app's structure), files (config, names, build output), history, person.
|
|
246
|
+
- **Today:**
|
|
247
|
+
- *reuse:* a clause is enough for a first cut.
|
|
248
|
+
- *partial:* every check of the symptom states what it misses.
|
|
249
|
+
- *review:* only a review clause covers it today.
|
|
250
|
+
- *new:* nothing covers it today.
|
|
251
|
+
- **Margin:** what it flags that is not the symptom / what it misses. "Review owes" names what only a person sees.
|
|
252
|
+
- **Settings traced to:** each threshold or setting, and the rule or recipe sentence behind it. *Nothing* means no sentence says so.
|
|
253
|
+
|
|
254
|
+
## Checks: Findings that point at the breach
|
|
255
|
+
|
|
256
|
+
Several symptoms are seen far from their breach. Each finding has two addresses:
|
|
257
|
+
- where the symptom is seen;
|
|
258
|
+
- the rule or rules the symptom indicates, with the place the breach usually sits.
|
|
259
|
+
|
|
260
|
+
Until a check can name the breach, a finding names the rules the symptom points at and where the breach usually sits. It never says only "this line".
|
|
261
|
+
|
|
262
|
+
## Checks: The test-body checks
|
|
263
|
+
|
|
264
|
+
Six checks run together on `CD-27#test-body-logic`: [branch-in-a-test#test-body](typescript/symptoms/branch-in-a-test/test-body.md), [throw-or-catch-in-a-test#try-block](typescript/symptoms/throw-or-catch-in-a-test/try-block.md), [rebinding#test-body](typescript/symptoms/rebinding/test-body.md), [computed-value-in-a-test#test-body](typescript/symptoms/computed-value-in-a-test/test-body.md), [text-past-its-reader#test-body](typescript/symptoms/text-past-its-reader/test-body.md) and [double-with-a-body#logic-in-a-passed-function](typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md). Each check's page lists what it flags.
|
|
265
|
+
|
|
266
|
+
- They read test files only: `*.test.ts` and `*.test.tsx`. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped. Helper files that tests import are not checked.
|
|
267
|
+
- None flags loops, which [loop-statement](typescript/symptoms/loop-keyword/loop-statement.md) covers, or `throw`, which [throw-statement](typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md) covers.
|
|
268
|
+
- None flags element access such as `calls[0]`, calls to free functions, a method called through a computed key, such as `rows["map"]`, or text built with a template literal.
|
|
269
|
+
|
|
270
|
+
They have two editions. Edition 1 runs by default. Edition 2 adds what each check lists under edition 2, and becomes the default in the next major release. To run it now, set `edition`, `"1"` or `"2"`; without it the clause runs edition 1, or the latest edition when `checkEditions` in `disciplines.json` is `"latest"`:
|
|
271
|
+
|
|
272
|
+
```jsonc
|
|
273
|
+
"clauseSettings": {
|
|
274
|
+
"CD-27#test-body-logic": { "edition": "2" }
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Each check's "Allowed forms in a test" sections show a flagged form first, then the forms to write instead. Every form to write instead passes every audit and ESLint clause Hone ships, at each edition its check declares, and compiles under the compiler options [strictness-weakened](typescript/symptoms/strictness-weakened.md) requires. A test reads each check's page and holds every block on it to that. `assert`, `expect`, `it` and `vi` come from `vitest`, and a `declare const` line stands for the unit under test.
|
|
279
|
+
|
|
280
|
+
## Checks: Settings
|
|
281
|
+
|
|
282
|
+
A setting fails only if it changes what a rule requires. It does not fail when it:
|
|
283
|
+
- tunes how early a symptom fires: "Line and complexity are symptoms that flag many things.";
|
|
284
|
+
- is scope a codebase chose: "Exclude is any codebases choice to say this is not in scope. It's never bound by any rules."
|
|
285
|
+
|
|
286
|
+
A default that quietly narrows a rule, which no codebase chose, still fails.
|
|
287
|
+
|
|
288
|
+
**Settings that change what a rule requires today:**
|
|
289
|
+
|
|
290
|
+
| Setting | What it changes | Traced to |
|
|
291
|
+
|---|---|---|
|
|
292
|
+
| Strictness edition 1 flags a flag's presence | requires the recipe's layout, not strictness | a recipe, not a rule. "The older strictness check is probably just a flaw." |
|
|
293
|
+
| `.todo` not flagged | a test that does not run passes | a miss. "Todo not flagged is probably just a false negative." |
|
|
294
|
+
| Accepted helper names | The subprocess-environment check passes a git spawn when its `env:` option mentions one of three hard-coded identifiers: `hermeticGitEnvironment`, `withoutInheritedGitBindings` or `environment`. It matches the name, not what the value holds, so any variable called `environment` passes. | nothing; a margin of the check (it misses by name) |
|
|
295
|
+
| Casing fixed inside Hone | Today file names must be kebab-case or PascalCase, both allowed everywhere, hard-coded. Identifier casing is a fixed option list in Hone's own piece, built on typescript-eslint's naming-convention. The adopter declares neither. | nothing. "Casing should be config from adopter to declare for consistency but requires the folder nuance settings." |
|
|
296
|
+
| Tracked-reference form | which TODO counts as tracked | nothing yet |
|
|
297
|
+
|
|
298
|
+
**Settings that do not:**
|
|
299
|
+
|
|
300
|
+
| Setting | Why |
|
|
301
|
+
|---|---|
|
|
302
|
+
| 50-line limit, complexity 15 | where two broad symptoms fire; they change no rule |
|
|
303
|
+
| `max-params: 2` | a recorded compromise of the check; its miss is margin |
|
|
304
|
+
| `exclude` | scope chosen by the codebase |
|
|
305
|
+
| Edition defaults | "Edition defaults would be for backwards compatability since we went npm." An existing adopter keeps the behaviour it installed. |
|
|
306
|
+
| `confinedPackages` empty by default | "packages is empty because we can't define the universe and if we just said imports at all we would catch internal packages." Seeing every outside dependency needs a way to tell it from an internal package; until then the list is the adopter's to fill. |
|
|
307
|
+
| `__tests__` skipped by default | "probably because of noise level and the fact I don't adopt that folder practice deliberately at all." |
|
|
308
|
+
| `.spec.ts` not treated as a test file by most checks | "Spec is also just not a naming practice I use." Then: "It honestly should be config for user to declare file naming structure so we can match their conventions." Hone has no such config yet; the Companion test file and Integration test suffix recipes are the convention it reads. |
|
|
309
|
+
| Generated folders skipped (`node_modules`, `dist` and the like) | not code of ours |
|
|
310
|
+
| Reading `.test.js` and `.test.mjs` in the subprocess-environment check | it widens one check, not narrows a rule |
|
|
311
|
+
| Suite-body exemption | "A test suite's body is a list of cases, not a coordinator." |
|
|
312
|
+
| Drawer names | Screaming folders |
|
|
313
|
+
| Shorthand list | Whole words |
|
|
314
|
+
| `as const` | Declared, not asserted |
|
|
315
|
+
| Integration suffix | its recipe |
|
|
316
|
+
|
|
317
|
+
## Checks: Folder-scoped settings
|
|
318
|
+
|
|
319
|
+
Hone has no folder-scoped settings yet. "glob or folder specific ruleset settings would be useful to smooth those" (React beside a Node server; GraphQL types generated in a boundary folder).
|
|
320
|
+
|
|
321
|
+
Checks whose convention can differ by folder in one repository:
|
|
322
|
+
- **Name off its casing.** Identifier and file-name conventions: a React folder's PascalCase components beside a Node server's kebab-case files.
|
|
323
|
+
- **Generated code at a boundary.** Checks that would read an outside generator's output as ours: Shorthand name, Name off its casing, Prose in code, Claimed type, Untyped value, Type derived from code, Unit without a running test.
|
|
324
|
+
|
|
325
|
+
What a folder-scoped setting does:
|
|
326
|
+
- It **smooths** a second convention, by choosing which convention a check measures a folder against.
|
|
327
|
+
- It **marks generated code** as an outside party's code at a boundary, under that boundary's record.
|
|
328
|
+
|
|
329
|
+
What it must not be able to do:
|
|
330
|
+
- **Switch a rule off for a folder.** That is a record: an authorised location with its why, or debt.
|
|
331
|
+
- **Change what a rule means.** For example, a looser line limit, a wider parameter count or a narrower test-file definition for a folder.
|
|
332
|
+
|
|
333
|
+
So a setting never deselects a clause and never carries debt.
|
|
334
|
+
|
|
335
|
+
`exclude` is different again. It is scope, outside the model. It needs no rule sentence and no record.
|
package/rules/SPIRIT.md
CHANGED
|
@@ -13,14 +13,14 @@ A finding is rarely about the line it names. It is a signal about the design aro
|
|
|
13
13
|
Take this chain, in order.
|
|
14
14
|
|
|
15
15
|
1. **Measure.** Count the sites for the failing clause. Group them by folder, by the value or dependency involved, and by who wrote them when.
|
|
16
|
-
2. **Ask what each group points at.** Read the
|
|
16
|
+
2. **Ask what each group points at.** Read the symptom's "May indicate" and "Breach usually sits" lines on [the symptoms page](typescript/symptoms.md) and match each group against them. Most groups share one cause.
|
|
17
17
|
3. **Then decide.** Name the cause, where it lives, the forward goal, and the first step that unlocks it. Fix the cause and the sites go with it.
|
|
18
18
|
|
|
19
19
|
Exclusions and settings are not the first move. Reaching for one before step 2 hides the signal before anyone has read it. A count that looks like noise is usually one missing boundary seen from many places.
|
|
20
20
|
|
|
21
21
|
## Debt, not noise
|
|
22
22
|
|
|
23
|
-
On first adoption of an existing codebase, a high count is debt made visible. It is not evidence the rule is wrong for the codebase. The useful response is an assessment for each high-count clause: which cause applies here, where, the forward goal, and the steps toward it, written down where the next person to hit the red check will read it ([ADOPTING step 5a](../ADOPTING.md#5a-write-the-assessment)). A file carve-out holds that debt at rest while the steps are taken. Touching the file pays it
|
|
23
|
+
On first adoption of an existing codebase, a high count is debt made visible. It is not evidence the rule is wrong for the codebase. The useful response is an assessment for each high-count clause: which cause applies here, where, the forward goal, and the steps toward it, written down where the next person to hit the red check will read it ([ADOPTING step 5a](../ADOPTING.md#5a-write-the-assessment)). A file carve-out holds that debt at rest while the steps are taken. Touching the file pays it: the debt [is forfeited](records.md#debt) once the file is touched.
|
|
24
24
|
|
|
25
25
|
## Boundaries are where exceptions belong
|
|
26
26
|
|
|
@@ -43,8 +43,8 @@ Tests are not exempt. A test that needs a cast, a test double with logic, a modu
|
|
|
43
43
|
|
|
44
44
|
## Older than these rules
|
|
45
45
|
|
|
46
|
-
Each rule encodes lessons programmers learned before us and wrote down under names you can look up: the SOLID principles, ports and adapters, "parse, don't validate", making illegal states unrepresentable, the test pyramid, the kinds of test double, and others.
|
|
46
|
+
Each rule encodes lessons programmers learned before us and wrote down under names you can look up: the SOLID principles, ports and adapters, "parse, don't validate", making illegal states unrepresentable, the test pyramid, the kinds of test double, and others. [The sources page](sources.md) names the source behind each principle, rule and recipe, and how the item relates to it. Read them to learn the pattern and the reasoning, not only the rule.
|
|
47
47
|
|
|
48
48
|
## Who does what
|
|
49
49
|
|
|
50
|
-
Each
|
|
50
|
+
Each symptom on [the symptoms page](typescript/symptoms.md) names the cases it may indicate and where the breach usually sits, so a reader can tell which one they have. The repository's own assessment then sharpens that to what is specific to the codebase and its intentions: which cause applies, where, the forward goal and the steps. It does not repeat the rule.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# A value is one of several kinds or states
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "the-type-checker-proves-it"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "our-code-reads-in-the-common-language"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"rule": "kinds-are-named"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
A closed union of our own, a name per kind, no catch-all. Absence or a true-or-false that stands for a state is a named kind.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# An adopter is not handed our risk
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "proposed",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "outside-risk-is-carried-on-purpose"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"rule": "outside-dependencies-justified"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
A case under [Outside dependencies justified](../rules/outside-dependencies-justified.md). A peer dependency is a direct dependency of ours, so it needs a record. The risk it weighs is carried by whoever runs it, the adopter included.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# An operation can fail
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "the-type-checker-proves-it"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "external-behaviour-sits-at-a-boundary"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"rule": "failures-are-values"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Every way it fails is a named variant in its return type. Nothing is thrown, ends the process, becomes true or false, or is swapped for a default or an empty value. Callers handle each variant.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Builds the real implementations
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "one-place-decides"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "external-behaviour-sits-at-a-boundary"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"rule": "doer-or-orchestrator"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"rule": "ports-declared-inside"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
One place, at start-up, builds every real implementation and passes it in. Nothing else builds one.
|
|
24
|
+
|
|
25
|
+
- **Review:** each injected port ships one default production factory
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Causes an effect (writes, logs, sends, exits)
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "no-hidden-effects"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "external-behaviour-sits-at-a-boundary"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"principle": "one-place-decides"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"rule": "written-out-answers"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"rule": "ports-declared-inside"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The effect is a call on a port passed in, and its test checks that call.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Checks a value that may be one of several outcomes
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "tests-are-ours"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "the-type-checker-proves-it"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"rule": "straight-through-tests"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
An assertion proves which outcome it is, so the type narrows; then the test reads it plainly. No condition, optional read or cast.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Checks conditions before its work
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "one-place-decides"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "the-type-checker-proves-it"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"rule": "guard-first"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Each condition that ends the work returns at once, at one level. The work is the last return, never nested in a condition.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Coordinates other units
|
|
2
|
+
|
|
3
|
+
```json
|
|
4
|
+
{
|
|
5
|
+
"standing": "accepted",
|
|
6
|
+
"owes": [
|
|
7
|
+
{
|
|
8
|
+
"principle": "one-place-decides"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"principle": "tests-are-ours"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"rule": "doer-or-orchestrator"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
It picks which of our units run, in what order, and passes their results on. Branching, computing or reshaping between calls is its own unit. A unit that only forwards one call decides nothing: fold it in. A test suite's body is a list of cases, not a coordinator.
|