@hailstails/hone 1.5.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 +237 -166
- package/CHANGELOG.md +127 -0
- package/MIGRATING.md +130 -47
- package/README.md +148 -182
- package/chunks/chunk-5HRMJ4O2.js +608 -0
- package/chunks/chunk-5U4JMWNV.js +9 -0
- package/chunks/{chunk-2O46EB4E.js → chunk-ASUN4AVC.js} +25 -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 +21 -19
- package/docs/extending.md +5 -5
- package/docs/output-contract.md +700 -14
- package/docs/why-chain-contract.md +6 -6
- package/methods/README.md +2 -2
- package/methods/assessment-template.md +1 -1
- package/methods/lenses/clean-architecture.md +19 -54
- package/methods/lenses/decomposition.md +7 -7
- package/methods/lenses/defended-on-intent.md +4 -4
- package/methods/lenses/di-discipline.md +8 -8
- package/methods/lenses/errors-as-data.md +6 -6
- package/methods/lenses/function-first.md +9 -9
- 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 +268 -4
- package/rules/SPIRIT.md +1 -1
- 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 +36 -59
- package/rules/numbers.md +121 -121
- 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 +50 -46
- 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 +17 -30
- 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 +117 -81
- package/rules/typescript/checks.md +1668 -202
- 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 +247 -218
- 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 -40
- 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 -25
- 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 +623 -414
- 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 +2186 -1372
- 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 +183 -54
- 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 +191 -120
- 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-5U4VTFD5.js +0 -1949
- 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 -2909
- package/core/mechanism-port/runner-result-types.d.ts +0 -19
- 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 -41
- package/rules/CD-1/README.md +0 -15
- package/rules/CD-1/discipline.json +0 -195
- package/rules/CD-10/CHECKS.md +0 -51
- package/rules/CD-10/README.md +0 -15
- package/rules/CD-10/discipline.json +0 -133
- package/rules/CD-11/CHECKS.md +0 -15
- package/rules/CD-11/README.md +0 -15
- package/rules/CD-11/discipline.json +0 -12
- package/rules/CD-12/CHECKS.md +0 -15
- package/rules/CD-12/README.md +0 -15
- package/rules/CD-12/discipline.json +0 -12
- package/rules/CD-13/CHECKS.md +0 -15
- package/rules/CD-13/README.md +0 -15
- package/rules/CD-13/discipline.json +0 -12
- package/rules/CD-14/CHECKS.md +0 -51
- package/rules/CD-14/README.md +0 -15
- package/rules/CD-14/discipline.json +0 -173
- package/rules/CD-15/CHECKS.md +0 -44
- package/rules/CD-15/README.md +0 -15
- package/rules/CD-15/discipline.json +0 -73
- package/rules/CD-16/CHECKS.md +0 -9
- package/rules/CD-16/README.md +0 -15
- package/rules/CD-17/CHECKS.md +0 -39
- package/rules/CD-17/README.md +0 -15
- package/rules/CD-17/discipline.json +0 -51
- package/rules/CD-18/CHECKS.md +0 -15
- package/rules/CD-18/README.md +0 -15
- package/rules/CD-18/discipline.json +0 -12
- package/rules/CD-19/CHECKS.md +0 -51
- package/rules/CD-19/README.md +0 -15
- package/rules/CD-19/discipline.json +0 -63
- package/rules/CD-2/CHECKS.md +0 -60
- package/rules/CD-2/README.md +0 -15
- package/rules/CD-2/discipline.json +0 -151
- package/rules/CD-20/CHECKS.md +0 -9
- package/rules/CD-20/README.md +0 -15
- package/rules/CD-21/CHECKS.md +0 -15
- package/rules/CD-21/README.md +0 -15
- package/rules/CD-21/discipline.json +0 -12
- package/rules/CD-22/CHECKS.md +0 -15
- package/rules/CD-22/README.md +0 -15
- package/rules/CD-22/discipline.json +0 -12
- package/rules/CD-23/CHECKS.md +0 -37
- package/rules/CD-23/README.md +0 -15
- package/rules/CD-23/discipline.json +0 -57
- package/rules/CD-24/CHECKS.md +0 -9
- package/rules/CD-24/README.md +0 -15
- package/rules/CD-25/CHECKS.md +0 -40
- package/rules/CD-25/README.md +0 -15
- package/rules/CD-25/discipline.json +0 -57
- package/rules/CD-26/CHECKS.md +0 -38
- package/rules/CD-26/README.md +0 -15
- package/rules/CD-26/discipline.json +0 -57
- package/rules/CD-27/CHECKS.md +0 -460
- package/rules/CD-27/README.md +0 -15
- package/rules/CD-27/discipline.json +0 -437
- package/rules/CD-28/CHECKS.md +0 -15
- package/rules/CD-28/README.md +0 -15
- package/rules/CD-28/discipline.json +0 -12
- package/rules/CD-29/CHECKS.md +0 -15
- package/rules/CD-29/README.md +0 -15
- package/rules/CD-29/discipline.json +0 -12
- package/rules/CD-3/README.md +0 -15
- package/rules/CD-3/discipline.json +0 -641
- package/rules/CD-30/CHECKS.md +0 -15
- package/rules/CD-30/README.md +0 -15
- package/rules/CD-30/discipline.json +0 -12
- package/rules/CD-31/CHECKS.md +0 -15
- package/rules/CD-31/README.md +0 -15
- package/rules/CD-31/discipline.json +0 -12
- package/rules/CD-32/CHECKS.md +0 -15
- package/rules/CD-32/README.md +0 -26
- package/rules/CD-32/discipline.json +0 -12
- package/rules/CD-33/CHECKS.md +0 -15
- package/rules/CD-33/README.md +0 -26
- package/rules/CD-33/discipline.json +0 -12
- package/rules/CD-34/CHECKS.md +0 -15
- package/rules/CD-34/README.md +0 -25
- package/rules/CD-34/discipline.json +0 -12
- package/rules/CD-39/CHECKS.md +0 -15
- package/rules/CD-39/README.md +0 -26
- package/rules/CD-39/discipline.json +0 -12
- package/rules/CD-4/CHECKS.md +0 -15
- package/rules/CD-4/README.md +0 -15
- package/rules/CD-4/discipline.json +0 -12
- package/rules/CD-40/CHECKS.md +0 -41
- package/rules/CD-40/README.md +0 -15
- package/rules/CD-40/discipline.json +0 -58
- package/rules/CD-41/CHECKS.md +0 -66
- package/rules/CD-41/README.md +0 -15
- package/rules/CD-41/discipline.json +0 -138
- package/rules/CD-42/CHECKS.md +0 -49
- package/rules/CD-42/README.md +0 -15
- package/rules/CD-42/discipline.json +0 -61
- package/rules/CD-43/CHECKS.md +0 -39
- package/rules/CD-43/README.md +0 -15
- package/rules/CD-43/discipline.json +0 -65
- package/rules/CD-44/CHECKS.md +0 -50
- package/rules/CD-44/README.md +0 -15
- package/rules/CD-44/discipline.json +0 -111
- package/rules/CD-45/CHECKS.md +0 -15
- package/rules/CD-45/README.md +0 -15
- package/rules/CD-45/discipline.json +0 -12
- package/rules/CD-46/CHECKS.md +0 -9
- package/rules/CD-46/README.md +0 -27
- package/rules/CD-47/CHECKS.md +0 -39
- package/rules/CD-47/README.md +0 -15
- package/rules/CD-47/discipline.json +0 -57
- package/rules/CD-5/README.md +0 -15
- package/rules/CD-5/discipline.json +0 -131
- package/rules/CD-6/CHECKS.md +0 -53
- package/rules/CD-6/README.md +0 -15
- package/rules/CD-6/discipline.json +0 -165
- package/rules/CD-7/CHECKS.md +0 -48
- package/rules/CD-7/README.md +0 -15
- package/rules/CD-7/discipline.json +0 -142
- package/rules/CD-7a/CHECKS.md +0 -40
- package/rules/CD-7a/README.md +0 -15
- package/rules/CD-7a/discipline.json +0 -57
- package/rules/CD-8/CHECKS.md +0 -44
- package/rules/CD-8/README.md +0 -15
- package/rules/CD-8/discipline.json +0 -57
- package/rules/CD-9/CHECKS.md +0 -15
- package/rules/CD-9/README.md +0 -15
- package/rules/CD-9/discipline.json +0 -12
- package/rules/typescript/symptoms.json +0 -1005
- /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/ADOPTING.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This page takes a TypeScript repository from nothing to a checked, passing run. Do the steps in order. Every command is run from the root of the repository being checked, which this page calls `<repo>`. Nothing here needs AIDLC or any agent harness. A repository that adopted the disciplines through the older standalone copy route follows [MIGRATING.md](MIGRATING.md), which uses these steps.
|
|
4
4
|
|
|
5
|
-
Hone reads `
|
|
5
|
+
Hone reads `hone.config.json` in `<repo>`, runs the listed checks over every git-tracked file, answers what they find by the records in `hone-records`, and prints one report ending in `verdict: pass` or `verdict: fail`. A repository that already runs version 1, with `disciplines.json`, runs `hone upgrade` once instead of writing these files by hand, as [MIGRATING.md](MIGRATING.md#20-moving-from-version-1-to-version-2) section 20 says, then follows this page from step 5.
|
|
6
6
|
|
|
7
7
|
## 1. Check the prerequisites
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ Hone ships as one npm package tarball of built JavaScript, so it needs no TypeSc
|
|
|
18
18
|
|
|
19
19
|
**The npm package is named `@hailstails/hone`.** The unscoped name `hone` on npm belongs to an unrelated package: never run `npm install hone`. The package `@hailstails/hone` installs one command, `hone`. Its tarball is named `hailstails-hone-<version>.tgz`, the file name `npm pack` gives a scoped package. Its first pre-release was released under the old name `honed`; [MIGRATING.md](MIGRATING.md#11-moving-from-honed-to-hailstailshone) says how to move from it.
|
|
20
20
|
|
|
21
|
-
Hone follows semantic versioning: only a major release removes or renames a
|
|
21
|
+
Hone follows semantic versioning: only a major release removes or renames a check address, config key or flag, or changes what one means ([README.md](README.md#compatibility)).
|
|
22
22
|
|
|
23
23
|
The main route is the npm registry. Stable releases are published under the dist-tag `latest`, which names the newest stable release approved on npm; `npm view @hailstails/hone dist-tags.latest` prints its version. Pre-releases are published under `next`. Install that version exactly, with `<version>` in place:
|
|
24
24
|
|
|
@@ -32,7 +32,7 @@ With pnpm, add it as a development dependency, using `-Dw` in place of `-D` at t
|
|
|
32
32
|
pnpm add -D --save-exact @hailstails/hone@<version>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Pin the exact version. A major release can remove or rename a
|
|
35
|
+
Pin the exact version. A major release can remove or rename a check address, config key or flag, and an install by tag can record a range in `package.json`, such as `^` and the version, which a later install without the lockfile, or an update, moves to a newer release that nobody chose. With an exact pin, the version changes only when you change it (step 10). Check the name before you run it: `@hailstails/hone`, never the unscoped `hone`. With Yarn, add `@hailstails/hone@<version>` exactly with its own `add -D` command at the workspace root. `latest` can trail the newest GitHub release for a while; [README.md](README.md#developing-hone) says how a version reaches npm.
|
|
36
36
|
|
|
37
37
|
The alternative is a tarball, copied into the repository so every teammate and CI runner installs the same Hone without the registry. Its three dependencies still come from the registry, or the mirror your package manager uses, at releases inside the ranges the tarball's `package.json` declares, and the repository's lockfile records which. This page writes its location as `<hone-tarball>`: a path such as `vendor/hailstails-hone/hailstails-hone-<version>.tgz`, or an `https://` URL your team serves it from. Download the tarball attached to the latest [GitHub release](https://github.com/HailsTails/hone/releases), or build it from a pinned commit as below.
|
|
38
38
|
|
|
@@ -71,16 +71,16 @@ Add the two commands to the root `package.json` scripts:
|
|
|
71
71
|
|
|
72
72
|
Options for one run go after the script name. npm needs `--` before them, as in `npm run --silent hone:check -- --base-revision origin/main`. pnpm takes them straight after the script name, as in `pnpm run --silent hone:check --base-revision origin/main`. This guide shows both wherever a command takes options.
|
|
73
73
|
|
|
74
|
-
`hone` is the package's one command, with
|
|
74
|
+
`hone` is the package's one command, with six subcommands: `hone check` runs the check, `hone project` writes the ESLint projection, `hone record-debt` writes the debt records of an adopting repository, for its findings and for the inline disables that hide findings (step 7a), `hone prune-debt` removes the records of debt that is paid, `hone authorise` writes an authorised location (step 7), and `hone upgrade` moves a version 1 repository to version 2 (step 10). A seventh command, `hone split-records`, belongs to version 1: on a version 2 repository it prints `load failure: not-ready-yet` and exits `2`, and `hone split-records --help` prints its version 1 help on every repository. `hone` with no subcommand, or with a name that is none of the seven, exits `2` with one `load failure: arguments-invalid` line that names all seven and points at `hone --help`, which prints the usage.
|
|
75
75
|
|
|
76
|
-
Hone runs on the toolchain the repository already uses, which the package declares as peer dependencies: `typescript` is a required peer, because every `
|
|
76
|
+
Hone runs on the toolchain the repository already uses, which the package declares as peer dependencies: `typescript` is a required peer, because every check on the `walker` engine needs it, and the ESLint packages are optional peers, needed only for checks on the `eslint` engine. npm 7 and later install a missing required peer on their own, and some other package managers only warn about one, so declare `typescript` yourself at the repository root, at the version the repository already uses, rather than let the package manager choose or skip it. Keep the versions you have; Hone supports these ranges:
|
|
77
77
|
|
|
78
78
|
| Package | Needed for | Range |
|
|
79
79
|
| --- | --- | --- |
|
|
80
|
-
| `typescript` | any `
|
|
81
|
-
| `eslint` | any `eslint`
|
|
82
|
-
| `@typescript-eslint/parser` | any `eslint`
|
|
83
|
-
| `@typescript-eslint/eslint-plugin` | any `eslint`
|
|
80
|
+
| `typescript` | any `walker` check | `>=4.8.4 <7.0.0` |
|
|
81
|
+
| `eslint` | any `eslint` check | `^9.39.5 \|\| ^10.15.0` |
|
|
82
|
+
| `@typescript-eslint/parser` | any `eslint` check | `^8.73.0` |
|
|
83
|
+
| `@typescript-eslint/eslint-plugin` | any `eslint` check | `^8.73.0` |
|
|
84
84
|
|
|
85
85
|
A repository that already has them in range needs nothing more. A package that is missing or out of range is named when the check runs; add it at a version inside its range and inside the range your other tooling accepts, without moving ESLint or TypeScript to another major for Hone's sake.
|
|
86
86
|
|
|
@@ -90,85 +90,112 @@ Commit `package.json`, the lockfile and the tarball if it is a file in the repos
|
|
|
90
90
|
|
|
91
91
|
## 3. Read what each discipline means
|
|
92
92
|
|
|
93
|
-
[rules/numbers.md](rules/numbers.md#every-numbered-discipline) lists every discipline, and [rules/README.md](rules/README.md) explains how the named pages read. Rules are referred to by name; a number is only a clause address. Each
|
|
93
|
+
[rules/numbers.md](rules/numbers.md#every-numbered-discipline) lists every discipline, and [rules/README.md](rules/README.md) explains how the named pages read. Rules are referred to by name; a number is only a clause address. Each check has its own page under its symptom, `rules/typescript/symptoms/<symptom>/<check>.md`: exactly what it flags, its settings, a violation and its fix. Read the named pages first; [the spirit of the rules](rules/SPIRIT.md) explains the approach for the whole set. Each check is listed in `hone.config.json` by its address, `<symptom>#<check>`, such as `authored-class-or-this#class-keyword`; the table in step 4 lists every one beside the rule's clause address, such as `CD-14#class-syntax`. A clause whose mechanism is `review` is a judgement clause: it has no check and is applied in review, with the review lens its rule item names (step 9).
|
|
94
94
|
|
|
95
|
-
A check covers only what its
|
|
95
|
+
A check covers only what its page says it flags. Read the whole rule, not only the check: where a rule asks for more than its check can see, the check page says which part is left to review, and the rule's review lens covers that part.
|
|
96
96
|
|
|
97
|
-
Where to start: for an API,
|
|
97
|
+
Where to start: for an API, [No leak across a boundary](rules/principles.md#no-leak-across-a-boundary) with its recipe [Zod at the producer's adapter](rules/typescript/recipes.md#zod-at-the-producers-adapter), [Failures are values](rules/rules.md#failures-are-values) and [Ports declared inside](rules/rules.md#ports-declared-inside) are useful next, most of them applied in review. For React, first select the type and test disciplines that apply to component code; do not apply server ports or process-lifecycle rules to browser code.
|
|
98
98
|
|
|
99
|
-
## 4. Write
|
|
99
|
+
## 4. Write hone.config.json
|
|
100
100
|
|
|
101
|
-
Create `<repo>/
|
|
101
|
+
Create `<repo>/hone.config.json`. List every check you adopt with the engine that runs it. This example lists `loop-keyword#loop-statement`, `date-used-directly#clock-sources` and `unit-without-a-running-test#companion-test-file`:
|
|
102
102
|
|
|
103
103
|
```json
|
|
104
104
|
{
|
|
105
|
-
"version":
|
|
105
|
+
"version": 2,
|
|
106
106
|
"ruleSets": {},
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
107
|
+
"checks": {
|
|
108
|
+
"loop-keyword#loop-statement": "walker",
|
|
109
|
+
"date-used-directly#clock-sources": "walker",
|
|
110
|
+
"unit-without-a-running-test#companion-test-file": "walker"
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
- `
|
|
116
|
-
-
|
|
117
|
-
- A
|
|
118
|
-
- A
|
|
119
|
-
-
|
|
120
|
-
- `"not-run"`: the
|
|
121
|
-
- `"not-adopted"`: the
|
|
122
|
-
- A `"not-run"` or `"not-adopted"`
|
|
123
|
-
- When a
|
|
124
|
-
- Not adopted: the rule does not apply to this codebase; a tech lead declares that, in the open. Set the
|
|
125
|
-
- Adopted,
|
|
126
|
-
-
|
|
127
|
-
- `exclude` lists folders or exact files that no
|
|
128
|
-
- `
|
|
129
|
-
- `checkEditions` stays out, or `"pinned"`, unless you want stricter checks as soon as they ship. When Hone tightens a check, the stricter check arrives as a new edition
|
|
115
|
+
- `checks` keys are check addresses, `<symptom>#<check>`, listed in the table below and on the check pages; the value is an engine the check lists, `walker` or `eslint`, `"not-run"` or `"not-adopted"`. A check of a rule set of your own is written `<ruleSet>/<symptom>#<check>`.
|
|
116
|
+
- Listing a check adopts it. Only a listed check runs. A check of a symptom that a listed check sees, listed nowhere, is offered under `available` and never fails the run. The symptom [Strictness weakened](rules/typescript/symptoms.md#strictness-weakened) has seven checks, one per compiler flag; list the ones you want. Checks that are one rule today run together: listing one of the six test-body checks without the others stops the run with `checks-run-together` naming them.
|
|
117
|
+
- A symptom may span engines; list each of its checks on an engine that has it, or mark it. `authored-class-or-this#class-keyword` runs on `walker` or `eslint` but `authored-class-or-this#static-members-only` only on `eslint`, so adopting that symptom means adopting the ESLint engine for at least that check; see [README.md](README.md#adopting-the-eslint-mechanism). If ESLint cannot work in this repository, list such a check as `"not-run"`, as below.
|
|
118
|
+
- A check's value in `checks` is one of three:
|
|
119
|
+
- an engine id, such as `walker`: the check runs and its findings fail the run;
|
|
120
|
+
- `"not-run"`: the check is adopted, but its engine is not run; the report lists it under `not-run` as `<check> adopted, engine not run: enforced by review`;
|
|
121
|
+
- `"not-adopted"`: the check is not adopted; the report lists it under `not-adopted`.
|
|
122
|
+
- A `"not-run"` or `"not-adopted"` check is never run and never projected, not even as `"off"`, and its engine is not loaded unless another check uses it, so a repository that lists every ESLint check this way needs no ESLint installed. Both leave the run a whole assessment.
|
|
123
|
+
- When a check cannot simply run clean, [the spirit of the rules](rules/SPIRIT.md#not-adopted-not-run-carved-out-escaped) names three declared states. Choose one deliberately, with reasons:
|
|
124
|
+
- Not adopted: the rule does not apply to this codebase; a tech lead declares that, in the open. Set the check to `"not-adopted"`.
|
|
125
|
+
- Adopted, engine not run: the rule binds, but its check is not a true measure of the rule's intent here, or cannot work here for a technical reason. The check is set aside; the intent is still owed, through review. Set the check to `"not-run"`. The ESLint-only checks of `name-off-its-casing` in a repository without ESLint are the usual case: `"name-off-its-casing#naming-convention": "not-run", "name-off-its-casing#filename-case": "not-run"`.
|
|
126
|
+
- Debt: the rule binds and its check is sound, but the codebase has debt it cannot address right now. Keep the check's engine, so it still runs, and record the debt file by file as debt records, which `hone record-debt` writes for you (step 7a).
|
|
127
|
+
- `exclude` lists folders or exact files that no engine checks, as repository paths with forward slashes; an entry containing `*` is refused, because globs are not supported. A folder entry excludes everything under it. It is the only way to narrow what Hone checks: there is no include list, and every tracked file outside `exclude` is checked, including any folder added later. Use it for generated or third-party code, and, to check only part of a repository, list every other folder. The walker already skips `node_modules`, `dist`, `build`, `coverage`, `.git` and a top-level `vendor` folder. The ESLint engine lints every tracked TypeScript file outside `exclude`, including any the repository's own ESLint config ignores: an ignore in that config does not narrow what Hone checks, and each selected check lists such a file under `unrecorded` as `<check> eslint ignore <file>` until the ignore is removed or the file is listed in `exclude`.
|
|
128
|
+
- `checkSettings` gives a check the settings its check page lists under Settings, keyed by check address. `outside-import-past-a-boundary#import-or-require`, for example, flags only imports of the packages you list in its `confinedOutsideDependencies`, which its check page still calls `confinedPackages`; `trackerPatterns` on `untracked-escape#directive-pointers` narrows tracked references to your tracker's format. See [README.md](README.md#honeconfigjson).
|
|
129
|
+
- `checkEditions` stays out, or `"pinned"`, unless you want stricter checks as soon as they ship. When Hone tightens a check, the stricter check arrives as a new edition, listed on the check's page, and becomes the default only in a major release. `"latest"` runs the newest edition of every listed check, so a minor upgrade can add findings. To take one check's newer edition only, give it `"edition"` in its `checkSettings` entry. The report lists the edition each such check ran under `editions`.
|
|
130
130
|
- `ruleSets` stays `{}` unless you write disciplines of your own; see [docs/extending.md](docs/extending.md).
|
|
131
131
|
|
|
132
|
-
Every clause address
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
132
|
+
Every check Hone ships, with the engines that can run it and the clause address its rule's pages know it by:
|
|
133
|
+
|
|
134
|
+
| Check to list | Engines | Clause address on the rule pages |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| `claimed-type#cast-to-any` | `walker` | `CD-1#any-cast` |
|
|
137
|
+
| `untyped-value#explicit-any` | `eslint` | `CD-1#explicit-any` |
|
|
138
|
+
| `untyped-value#implicit-any-let` | `eslint` | `CD-1#implicit-any-let` |
|
|
139
|
+
| `claimed-type#unlisted-cast-site` | `walker` | `CD-2#cast-expressions` |
|
|
140
|
+
| `claimed-type#non-null-assertions` | `eslint` | `CD-2#non-null-assertions` |
|
|
141
|
+
| `strictness-weakened#strict` | `walker` | `CD-3#strict` |
|
|
142
|
+
| `strictness-weakened#no-unchecked-indexed-access` | `walker` | `CD-3#no-unchecked-indexed-access` |
|
|
143
|
+
| `strictness-weakened#exact-optional-property-types` | `walker` | `CD-3#exact-optional-property-types` |
|
|
144
|
+
| `strictness-weakened#no-implicit-override` | `walker` | `CD-3#no-implicit-override` |
|
|
145
|
+
| `strictness-weakened#no-fallthrough-cases-in-switch` | `walker` | `CD-3#no-fallthrough-cases-in-switch` |
|
|
146
|
+
| `strictness-weakened#no-property-access-from-index-signature` | `walker` | `CD-3#no-property-access-from-index-signature` |
|
|
147
|
+
| `strictness-weakened#use-unknown-in-catch-variables` | `walker` | `CD-3#use-unknown-in-catch-variables` |
|
|
148
|
+
| `untracked-escape#directive-pointers` | `walker` | `CD-5#comments-directives` |
|
|
149
|
+
| `shorthand-name#identifier-names` | `walker` | `CD-6#identifier-names` |
|
|
150
|
+
| `name-off-its-casing#naming-convention` | `eslint` | `CD-6#naming-convention` |
|
|
151
|
+
| `drawer-path#drawer-names` | `walker` | `CD-7#categorical-paths` |
|
|
152
|
+
| `name-off-its-casing#filename-case` | `eslint` | `CD-7#filename-case` |
|
|
153
|
+
| `type-derived-from-code#factory-return-types` | `walker` | `CD-7a#factory-return-types` |
|
|
154
|
+
| `default-on-a-closed-union#default-arm` | `walker` | `CD-8#switch-defaults` |
|
|
155
|
+
| `throw-or-catch-in-a-test#throw-statement` | `walker` | `CD-10#throws-in-tests` |
|
|
156
|
+
| `thrown-non-error#throw-only-error` | `eslint` | `CD-10#throw-only-error` |
|
|
157
|
+
| `authored-class-or-this#class-keyword` | `walker` or `eslint` | `CD-14#class-syntax` |
|
|
158
|
+
| `authored-class-or-this#static-members-only` | `eslint` | `CD-14#static-only-class` |
|
|
159
|
+
| `loop-keyword#loop-statement` | `walker` | `CD-15#loops` |
|
|
160
|
+
| `date-used-directly#clock-sources` | `walker` | `CD-17#clock-sources` |
|
|
161
|
+
| `outside-import-past-a-boundary#import-or-require` | `walker` | `CD-19#import-boundaries` |
|
|
162
|
+
| `unit-without-a-running-test#companion-test-file` | `walker` | `CD-23#export-test-sibling` |
|
|
163
|
+
| `double-with-a-body#stub-implementation` | `walker` | `CD-25#dependency-isolation` |
|
|
164
|
+
| `module-or-global-patched#module-mock-call` | `walker` | `CD-26#module-mocking` |
|
|
165
|
+
| `branch-in-a-test#test-body` | `walker` | `CD-27#test-body-logic` |
|
|
166
|
+
| `throw-or-catch-in-a-test#try-block` | `walker` | `CD-27#test-body-logic` |
|
|
167
|
+
| `rebinding#test-body` | `walker` | `CD-27#test-body-logic` |
|
|
168
|
+
| `computed-value-in-a-test#test-body` | `walker` | `CD-27#test-body-logic` |
|
|
169
|
+
| `text-past-its-reader#test-body` | `walker` | `CD-27#test-body-logic` |
|
|
170
|
+
| `double-with-a-body#logic-in-a-passed-function` | `walker` | `CD-27#test-body-logic` |
|
|
171
|
+
| `test-switched-off#focused-tests` | `eslint` | `CD-27#focused-tests` |
|
|
172
|
+
| `test-switched-off#skipped-tests` | `eslint` | `CD-27#skipped-tests` |
|
|
173
|
+
| `positional-parameters#parameter-count` | `eslint` | `CD-40#parameter-count` |
|
|
174
|
+
| `tangled-function#cognitive-complexity` | `eslint` | `CD-41#cognitive-complexity` |
|
|
175
|
+
| `long-function#function-length` | `eslint` | `CD-41#function-length` |
|
|
176
|
+
| `work-inside-a-condition#else-after-an-exit` | `eslint` | `CD-42#useless-else` |
|
|
177
|
+
| `boolean-in-a-signature#boolean-annotation` | `walker` | `CD-43#boolean-signatures` |
|
|
178
|
+
| `write-into-a-parameter#parameter-mutation` | `walker` | `CD-44#parameter-mutation` |
|
|
179
|
+
| `rebinding#parameter-reassignment` | `eslint` | `CD-44#parameter-reassignment` |
|
|
180
|
+
| `inherited-environment-in-a-subprocess#git-spawn-environment` | `walker` | `CD-47#hermetic-git-spawns` |
|
|
181
|
+
|
|
182
|
+
Adopting a symptom with a check whose only engine is `eslint` needs the ESLint engine, or that check listed as `"not-run"`.
|
|
156
183
|
|
|
157
184
|
Starting with a few disciplines and adding more once the run passes is easier than fixing everything at once.
|
|
158
185
|
|
|
159
|
-
### 4a. Set up ESLint for `eslint`
|
|
186
|
+
### 4a. Set up ESLint for `eslint` checks
|
|
160
187
|
|
|
161
|
-
Skip this if every
|
|
188
|
+
Skip this if every listed check runs on the `walker`. Otherwise, after writing `hone.config.json`, write the ESLint projection:
|
|
162
189
|
|
|
163
190
|
```bash
|
|
164
191
|
npm run --silent hone:project
|
|
165
192
|
```
|
|
166
193
|
|
|
167
|
-
It prints `
|
|
194
|
+
It prints `hone.eslint.mjs written` and `hone.eslint.d.mts written`; the second file types the first as ESLint's `Linter.Config[]`, so a TypeScript config can import it. Spread its default export last in the repository's flat config. The projection sets rules only, so the config must also parse TypeScript, with the `@typescript-eslint/parser` that step 2 installs; without it the repository's own `eslint` run fails on the first type annotation while Hone's check still passes. A repository with no ESLint config yet can start from this `eslint.config.mjs`:
|
|
168
195
|
|
|
169
196
|
```js
|
|
170
197
|
import typescriptParser from "@typescript-eslint/parser";
|
|
171
|
-
import projection from "./
|
|
198
|
+
import projection from "./hone.eslint.mjs";
|
|
172
199
|
|
|
173
200
|
export default [
|
|
174
201
|
{ files: ["**/*.{ts,tsx,mts,cts}"], languageOptions: { parser: typescriptParser } },
|
|
@@ -178,10 +205,10 @@ export default [
|
|
|
178
205
|
|
|
179
206
|
To confirm it, run the repository's own `eslint` on one TypeScript file with a type annotation, for example `node_modules/.bin/eslint src/index.ts` with a file of your own; it must report findings or nothing, never `Parsing error`.
|
|
180
207
|
|
|
181
|
-
In a monorepo where ESLint resolves each file from its nearest config, `hone:project` also writes a `
|
|
208
|
+
In a monorepo where ESLint resolves each file from its nearest config, `hone:project` also writes a `hone.eslint.mjs` slice, with its `hone.eslint.d.mts` declaration of the type, beside each package's tracked `eslint.config.*`, holding only that package's records with paths relative to the package. Where one ESLint 9 run applies the root config to every file, package configs are never loaded and get no slice. A package config keeps its slice even in a folder the root config ignores, since a lint run from that package loads its own config without the root's ignores. A folder holding its own `hone.config.json` is a nested Hone configuration, which is not supported yet ([#72](https://github.com/HailsTails/hone/issues/72)): when the ESLint engine would check a file under it, `check` and `project` stop with `load failure: not-ready-yet eslint-config-roots: this release does not run a repository that holds other version 2 repositories yet; …` before anything is checked or written, and the line says to move the folder out and run it on its own with `--repo`. A run that lists only walker checks does not stop, and a folder with no such file gets no slice. The root config spreads the root projection last, and each package config spreads its own slice last, never the root one:
|
|
182
209
|
|
|
183
210
|
```js
|
|
184
|
-
import projection from "./
|
|
211
|
+
import projection from "./hone.eslint.mjs";
|
|
185
212
|
|
|
186
213
|
export default [
|
|
187
214
|
{ files: ["**/*.{ts,tsx,mts,cts}"] },
|
|
@@ -189,29 +216,29 @@ export default [
|
|
|
189
216
|
];
|
|
190
217
|
```
|
|
191
218
|
|
|
192
|
-
A package whose `eslint.config.*` is generated and not tracked needs its folder listed so Hone writes its slice, and the slice spread where the tool takes extra configuration. Each listed folder must be one git tracks files under, spelled exactly as git spells it, or the check stops with `config-root-untracked`. sku 16.6.1 is such a tool: its `packages/sku/src/utils/configureApp.ts` writes `eslint.config.mjs` into the project on every sku command and adds it to `.gitignore`, and that config applies the `dangerouslySetESLintConfig` function that `packages/sku/src/types/types.ts` declares as taking and returning `Linter.Config[]`. For sku, list the package in `
|
|
219
|
+
A package whose `eslint.config.*` is generated and not tracked needs its folder listed so Hone writes its slice, and the slice spread where the tool takes extra configuration. Each listed folder must be one git tracks files under, spelled exactly as git spells it, or the check stops with `config-root-untracked`. sku 16.6.1 is such a tool: its `packages/sku/src/utils/configureApp.ts` writes `eslint.config.mjs` into the project on every sku command and adds it to `.gitignore`, and that config applies the `dangerouslySetESLintConfig` function that `packages/sku/src/types/types.ts` declares as taking and returning `Linter.Config[]`. For sku, list the package in `hone.config.json` and spread the slice in `sku.config.ts`:
|
|
193
220
|
|
|
194
221
|
```json
|
|
195
222
|
{ "eslintConfigRoots": ["packages/web"] }
|
|
196
223
|
```
|
|
197
224
|
|
|
198
225
|
```ts
|
|
199
|
-
import projection from "./
|
|
226
|
+
import projection from "./hone.eslint.mjs";
|
|
200
227
|
|
|
201
228
|
export default {
|
|
202
229
|
dangerouslySetESLintConfig: (skuEslintConfig) => [...skuEslintConfig, ...projection],
|
|
203
230
|
};
|
|
204
231
|
```
|
|
205
232
|
|
|
206
|
-
The check names a slice that is missing
|
|
233
|
+
The check names a slice that is missing or out of date, and names a listed folder whose `eslint.config.*` is not on disk as `unconfigured`: until the tool has written it, nothing loads the slice, so run the tool's configure step (for sku, any sku command or `sku configure`) before the check. A package that spreads nothing at all has its checks out of effect at once, and the check reports `engine-not-run eslint not-included` rather than trust what it could not have measured. A package that spreads the root projection instead of its slice is reported the same way only once a record answers a file in it; until then both projections give it the same rules, so the check says nothing, and silence is not proof the spread is right. To confirm the spread before recording debt, run ESLint from the package folder on a file the check flags and see the same finding. [README.md](README.md#package-slices) has the details. Hone detects which config the team's ESLint run applies from the installed `eslint` version and the lint scripts; see [README.md](README.md#runtime). Detection is wrong when a task runner (turbo, nx, `pnpm -r`) starts ESLint 9 inside each package, because each package then uses its own config, and when ESLint 9 gets the lookup flag outside the scripts. In those repositories set the lookup in `hone.config.json`:
|
|
207
234
|
|
|
208
235
|
```json
|
|
209
236
|
{ "eslintConfigLookup": "nearest-to-file" }
|
|
210
237
|
```
|
|
211
238
|
|
|
212
|
-
Use `"nearest-to-file"` when ESLint runs per package, with ESLint 10, or with ESLint 9 and `--flag v10_config_lookup_from_file
|
|
239
|
+
Use `"nearest-to-file"` when ESLint runs per package, with ESLint 10, or with ESLint 9 and `--flag v10_config_lookup_from_file`. Use `"repository-root"` for one ESLint 9 run from the repository root, whose root `eslint.config.*` then applies to every file. To confirm the setting, lint a package file the way the team does (for example `pnpm exec eslint packages/a/src/x.ts` from where the lint script runs) and check that it reports the same finding the Hone check lists for that file.
|
|
213
240
|
|
|
214
|
-
Commit the projection, every slice and the configs. Hone's check reads this configuration and fails if the projection or a slice is missing, not in effect, or out of date, so re-run `hone:project` whenever `
|
|
241
|
+
Commit the projection, every slice and the configs. Hone's check reads this configuration and fails if the projection or a slice is missing, not in effect, or out of date, so re-run `hone:project` whenever `hone.config.json` or `hone-records` changes or Hone is updated. The projection imports one plugin, `@hailstails/hone/eslint-plugin`, registered under the namespace `hone`, so the repository's ESLint must resolve `@hailstails/hone` from the repository root. Hone's own ESLint run uses the repository's root `eslint` from step 2, the same copy the projection's pieces load; its verdict is the same on 9.x and 10.x. [README.md](README.md#adopting-the-eslint-mechanism) has the details.
|
|
215
242
|
|
|
216
243
|
## 5. Run the check
|
|
217
244
|
|
|
@@ -225,13 +252,13 @@ npm run --silent hone:check
|
|
|
225
252
|
| `1` | `verdict: fail`: the report says why |
|
|
226
253
|
| `2` | an input could not be loaded or a check crashed; the output is one line starting `load failure:` or names the failing piece |
|
|
227
254
|
|
|
228
|
-
`npm run` passes the exit code through. `sh: hone: not found` or `'hone' is not recognized` means step 2's install is missing; run `npm install`. A `load failure:
|
|
255
|
+
`npm run` passes the exit code through. `sh: hone: not found` or `'hone' is not recognized` means step 2's install is missing; run `npm install`. A `load failure: engine-failed <engine> toolchain-unavailable <package> ...` line names every toolchain package that is missing from the repository root or outside its range; install a version of each in the range it prints. For a `typescript` that is not installed, the line says the install is incomplete, since a supported install always has its required peer: add `typescript` to the root's `devDependencies` and reinstall. An `engine-failed <engine> toolchain-shadowed <package> resolved from ...` line means a copy of that package sits inside Hone's own install folder, which the line names: delete that `node_modules` folder and reinstall.
|
|
229
256
|
|
|
230
257
|
Add the check to the repository's existing validation script, and run that script in CI and in any pre-push hook the repository already has, so the check runs wherever the other checks run.
|
|
231
258
|
|
|
232
259
|
A known limit: `hone check` runs its own ESLint pass over the governed files, even when the repository's own lint has just run. A hook that runs both pays for lint twice. Reusing the repository's lint run is planned after 1.0.
|
|
233
260
|
|
|
234
|
-
A first adoption assesses
|
|
261
|
+
A first adoption assesses forfeiture at push only, so that a hotfix in a file that holds debt is not blocked in CI while the check is new: set `"forfeiture": "elsewhere"` in `hone.config.json`. CI and the pre-push hook then run different commands. The pre-push hook assesses forfeiture for its run:
|
|
235
262
|
|
|
236
263
|
```bash
|
|
237
264
|
npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main
|
|
@@ -243,15 +270,15 @@ With pnpm:
|
|
|
243
270
|
pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main
|
|
244
271
|
```
|
|
245
272
|
|
|
246
|
-
A run that leaves
|
|
273
|
+
A run that leaves forfeiture to another run ends `verdict: pass (partial assessment)` or `verdict: fail (partial assessment)`, not `verdict: pass` or `verdict: fail`. A hook or gate that matches `verdict: pass` or `verdict: fail` at the end of the line reads neither, and may report the run as unverified. Act on the exit code, or match all four verdict lines that [docs/output-contract.md](docs/output-contract.md#the-version-2-report) lists.
|
|
247
274
|
|
|
248
|
-
CI leaves
|
|
275
|
+
CI leaves forfeiture to the hook, and with `elsewhere` in effect it can run the check with no base revision:
|
|
249
276
|
|
|
250
277
|
```bash
|
|
251
278
|
npm run --silent hone:check
|
|
252
279
|
```
|
|
253
280
|
|
|
254
|
-
A
|
|
281
|
+
Records carried over by `hone upgrade` follow the same setting. A run given no base leaves them to the run that has one: it prints `carried standing elsewhere` with how many, and passes as a partial assessment when nothing else fails. A run given a base judges them against it, whatever `forfeiture` says. So keep at least one run that has a base, the pre-push hook above, or they are never judged. If CI should judge them too, pass the pull request's base commit; the base is then used for those records only, and no debt is forfeited. CI needs that one commit fetched, for example `git fetch --depth=1 origin <base-commit>`, not the full history:
|
|
255
282
|
|
|
256
283
|
```bash
|
|
257
284
|
npm run --silent hone:check -- --base-revision <base-commit>
|
|
@@ -263,11 +290,11 @@ With pnpm:
|
|
|
263
290
|
pnpm run --silent hone:check --base-revision <base-commit>
|
|
264
291
|
```
|
|
265
292
|
|
|
266
|
-
A team that assesses
|
|
293
|
+
A team that assesses forfeiture in CI leaves `forfeiture` unset and runs `npm run --silent hone:check -- --base-revision origin/main` there, or `pnpm run --silent hone:check --base-revision origin/main`; the check then needs that revision and the history back to where the branch left it, for example `fetch-depth: 0` with `actions/checkout`.
|
|
267
294
|
|
|
268
|
-
The trade: a push that bypasses the hook, for example with `git push --no-verify`, leaves no later gate, so
|
|
295
|
+
The trade: a push that bypasses the hook, for example with `git push --no-verify`, leaves no later gate, so debt can stop being forfeited unnoticed. Every run that leaves forfeiture to another run says so in its report (step 6). With `eslint` checks, the repository's own `eslint` run also reports them in the editor, from the projection.
|
|
269
296
|
|
|
270
|
-
Tell any coding agent working in the repository, in its project instructions: "Read the rule pages under `node_modules/@hailstails/hone/rules/` for the
|
|
297
|
+
Tell any coding agent working in the repository, in its project instructions: "Read the rule pages under `node_modules/@hailstails/hone/rules/` for the checks listed in `hone.config.json` before editing. When a check fails, read the `symptoms` section of the report and the section for the failing check in `disciplines.assessment.md`, and, in node_modules/@hailstails/hone/rules/typescript/symptoms.md, the "May indicate" and "Breach usually sits" lines of each symptom the check names, before changing anything; do not add a record, exclusion or setting to make it pass. Before handing off, run the repository's validation command, report its exit code and findings, and apply the judgement rules listed in `disciplines.assessment.md` with their review lenses." Copying the rule pages does not make an agent read them; the instruction does. Step 5a writes `disciplines.assessment.md`; Hone itself does not read or name it.
|
|
271
298
|
|
|
272
299
|
### 5a. Write the assessment
|
|
273
300
|
|
|
@@ -281,82 +308,102 @@ Start from the template the package ships:
|
|
|
281
308
|
cp node_modules/@hailstails/hone/methods/assessment-template.md disciplines.assessment.md
|
|
282
309
|
```
|
|
283
310
|
|
|
284
|
-
Fill the top sections: the rules adopted, the
|
|
311
|
+
Fill the top sections: the rules adopted, the checks not adopted because the rule does not apply here, the checks adopted with their engine not run because the check is not a true measure here or cannot work here, and the judgement rules adopted (step 9). Step 4 says how each is declared in `hone.config.json`; the assessment says why. The template names each by clause address; name each by its check address instead.
|
|
285
312
|
|
|
286
|
-
Then write one section per high-count
|
|
313
|
+
Then write one section per high-count check. Hone has no threshold for this. A check is high-count when its findings will not all be fixed in the change that adopts it: three findings in one file you fix today need no section; three findings in three folders you will not reach this week do.
|
|
287
314
|
|
|
288
315
|
The assessment is usually drafted by a coding agent. Give it this instruction as it is:
|
|
289
316
|
|
|
290
317
|
```text
|
|
291
318
|
Draft disciplines.assessment.md from node_modules/@hailstails/hone/methods/assessment-template.md, using the latest hone:check report.
|
|
292
319
|
|
|
293
|
-
For each
|
|
320
|
+
For each check in the report's findings section whose findings will not all be fixed in this change:
|
|
294
321
|
1. Measure. Count its findings and group them by folder, by the value, library or dependency involved, and by the shape of the code.
|
|
295
322
|
2. Read the code at several sites in each group, not only the report lines.
|
|
296
|
-
3. Read the
|
|
323
|
+
3. Read the check's rule page, node_modules/@hailstails/hone/rules/<ID>/README.md, and, in node_modules/@hailstails/hone/rules/typescript/symptoms.md, each symptom the check names, closely, then the `symptoms` section of the report.
|
|
297
324
|
4. Match each group against the symptom's "May indicate" and "Breach usually sits" lines. Name the cause exactly as the symptoms page names it. If no listed cause fits, say so and describe what the sites show; do not pick the closest.
|
|
298
|
-
5. Write the
|
|
325
|
+
5. Write the check's section from the template, headed by its check address: the cause, the count and example sites as file:line, the forward goal in this codebase's terms, and the steps that change the code toward it, starting with the step that unlocks the others.
|
|
299
326
|
|
|
300
|
-
Exclusions,
|
|
327
|
+
Exclusions, records, settings and not adopting a check are never a cause, a goal or a step. The Debt line says how existing debt is held while the steps are taken; write it last, after the rest of the section. A section that gives only counts, or whose steps are about recording exceptions, is not done.
|
|
301
328
|
|
|
302
|
-
Stop when every such
|
|
329
|
+
Stop when every such check has a section. Report the sections for review before changing code or recording anything.
|
|
303
330
|
```
|
|
304
331
|
|
|
305
|
-
Review the draft as you would a design: the causes and the goals are the decisions in it. Commit it beside `
|
|
332
|
+
Review the draft as you would a design: the causes and the goals are the decisions in it. Commit it beside `hone.config.json`. Hone does not read it, so point reviewers and agents at it, as step 5's instruction does. Record debt (step 7) only after the assessment, and note each record in the check's Debt line. Keep the file current: when steps land or a count changes, update the section; when a check has no findings left, delete its section.
|
|
306
333
|
|
|
307
|
-
A finished section reads like this
|
|
334
|
+
A finished section reads like this, for the check `claimed-type#unlisted-cast-site`:
|
|
308
335
|
|
|
309
336
|
```markdown
|
|
310
|
-
##
|
|
337
|
+
## claimed-type#unlisted-cast-site
|
|
311
338
|
|
|
312
339
|
- **Cause here:** Parsing skipped at a boundary. Database rows are cast to domain types where they are read.
|
|
313
340
|
- **Sites:** 118 at 3f1c2ab, in src/orders/ and src/billing/. For example src/orders/order-reader.ts:41, src/billing/invoice-reader.ts:17.
|
|
314
341
|
- **Forward goal:** rows are parsed once in the storage port, and services receive typed orders and invoices.
|
|
315
342
|
- **Steps:** 1. A schema per table read, in the storage port. 2. The port returns parsed types. 3. Delete the casts, one folder at a time.
|
|
316
|
-
- **Debt:** held by the orders team;
|
|
343
|
+
- **Debt:** held by the orders team; debt records in hone-records/debt/claimed-type.json, paid off as each file is touched.
|
|
317
344
|
```
|
|
318
345
|
|
|
319
346
|
## 6. Read the report
|
|
320
347
|
|
|
321
|
-
The report prints only the sections that have entries, each with its count, then the verdict. A finding line
|
|
348
|
+
The report prints only the sections that have entries, each with its count, then the verdict. A finding line names the check that raised it, the engine, the place and the snippet, then what the check may indicate and, where it names one, the fix:
|
|
322
349
|
|
|
323
350
|
```text
|
|
324
|
-
<
|
|
325
|
-
|
|
351
|
+
<check> <engine> <file>:<line>:<column> <snippet> may indicate: <indicated>
|
|
352
|
+
<check> <engine> <file>:<line>:<column> <snippet> may indicate: <indicated> fix: <fix> (<fix page>#<section>)
|
|
353
|
+
loop-keyword#loop-statement walker src/basket.ts:15:0 for (const line of this.lines) { may indicate: no-hidden-effects, ports-declared-inside, doer-or-orchestrator
|
|
326
354
|
```
|
|
327
355
|
|
|
328
|
-
|
|
356
|
+
A finding of a clause the symptom catalogue gives no check, such as one from a rule set of your own, prints its clause address and its mechanism, without the indication.
|
|
357
|
+
|
|
358
|
+
[docs/output-contract.md](docs/output-contract.md#the-version-2-report) lists every line the report can print, exactly as printed, and which parts are stable. Lines are 1-based and columns 0-based. The run passes only when every failing section is empty. The sections, in the order they print, are:
|
|
329
359
|
|
|
330
360
|
| Section | Meaning and what to do |
|
|
331
361
|
| --- | --- |
|
|
332
|
-
| `excluded` | the `exclude` entries from `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `editions` | each
|
|
336
|
-
| `findings` | violations: fix the code, or
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
344
|
-
| `
|
|
345
|
-
| `
|
|
346
|
-
| `
|
|
347
|
-
| `
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
362
|
+
| `excluded` | the `exclude` entries from `hone.config.json` that were left out of the run; informational, check it is what you meant |
|
|
363
|
+
| `not-adopted` | the checks `hone.config.json` lists as `"not-adopted"`; informational, they were neither run nor projected |
|
|
364
|
+
| `not-run` | the checks `hone.config.json` lists as `"not-run"`, each as `<check> adopted, engine not run: enforced by review`; informational, they were neither run nor projected, and the rule is still owed through review |
|
|
365
|
+
| `editions` | each check with more than one edition, with the edition that ran and the latest; informational, see `checkEditions` in [step 4](#4-write-honeconfigjson) |
|
|
366
|
+
| `findings` | violations: fix the code, or answer them with a record (step 7) |
|
|
367
|
+
| `answered` | findings a record answers, each with the record that answers it; informational |
|
|
368
|
+
| `available` | a check no setting lists whose symptom a listed check sees; informational, list it in `hone.config.json` with an engine to run it |
|
|
369
|
+
| `stale` | a record that answers no finding and holds no native exception, which says why when it is debt: nothing it holds is found, its file is gone, or its file is excluded. Debt is removed by the `hone prune-debt` command its line names; run it, then `npm run --silent hone:project`. Delete every other stale record by hand ([README.md](README.md#pruning-paid-debt)) |
|
|
370
|
+
| `forfeited` | debt on a file this change touched, which no longer answers: fix the file; `hone prune-debt` then removes the record |
|
|
371
|
+
| `unrecorded` | a native exception no record holds, as `<check> <engine> <kind> <detail>`: remove it, or record it where step 7 allows. An inline disable, an `eslint-disable` naming no rule, and a lint-script option each print their own line; [README.md](README.md#commands) lists them. A lint-script option weakens the script's whole run, so no record can cover it: remove it from the script |
|
|
372
|
+
| `misnamed` | an inline disable naming a version 1 rule id, or an id no check of this run has, which suppresses nothing: name the rule the check now has |
|
|
373
|
+
| `paid` | debt that another record answers in place of, for a finding this run raised, with the exact `hone prune-debt` command that removes it; informational next step, it never fails the run |
|
|
374
|
+
| `refused` | a record that cannot be read or applied, with the reason: correct or delete it |
|
|
375
|
+
| `unmeasured` | something could not be measured; each line says what, why and what Hone needs, for example `forfeiture-unmeasured no-base-revision: no --base-revision was given, so debt cannot be checked for forfeiture; pass --base-revision with the branch's base, such as origin/main, or leave forfeiture to another run with "forfeiture": "elsewhere" in hone.config.json or --forfeiture elsewhere` |
|
|
376
|
+
| `projection-problems` | a projection or package slice that differs from what `hone project` writes now, is not written, is not in effect, or has no configuration to load it, each with what to do, for example `eslint out-of-date: hone.eslint.mjs differs from what hone project writes now; run node /work/shop/node_modules/@hailstails/hone/core/check/tool-command.js project --repo /work/shop and commit every file it writes` |
|
|
377
|
+
| `assessment` | a concern this run left to another run, for example `forfeiture elsewhere: 37 debt records not checked for forfeiture in this run`; informational, and the verdict line then reads `verdict: pass (partial assessment)` or `verdict: fail (partial assessment)` |
|
|
378
|
+
| `settings-notes` | what `hone.config.json` declares that no check reads yet; informational |
|
|
379
|
+
| `record-notes` | a note on a record, such as a case or an `owes` the catalogue does not list, by its records file and index; informational |
|
|
380
|
+
| `carried` | records `hone upgrade` carried from version 1, with what each lacks and whether the base held them; informational, see [MIGRATING.md](MIGRATING.md#20-moving-from-version-1-to-version-2) |
|
|
381
|
+
| `symptoms` | printed last, one note for each symptom the findings name: what it may indicate, where the breach usually sits, the recipes that answer it, its correct uses and where to record each, and the page that explains it; guidance, it never fails the run |
|
|
382
|
+
|
|
383
|
+
To print less, set `"reportOutput"` in `hone.config.json` for the repository, or pass `--report-output <output>` for one run, which wins over the file. `full` is the default and prints the report above; `actionable` leaves out the informational sections and keeps the failing, next-step and guidance ones; `counts` prints only each section's heading and count, adding `informational`, `next-step` or `guidance` after the sections that never fail the run so every other line names a section that failed it; `verdict-only` prints only the verdict line. Every output ends in the verdict line, and the exit code is the same whichever output you choose. An unknown value fails the run with exit `2`, as `arguments-invalid` for the option or `file-malformed` for the file.
|
|
384
|
+
|
|
385
|
+
## 7. Record what a check cannot be made to accept
|
|
386
|
+
|
|
387
|
+
Before recording anything, take the chain in [the spirit of the rules](rules/SPIRIT.md#when-the-check-is-red): measure the sites for each failing check, ask what each group points at using the `symptoms` section of the report, the "May indicate" and "Breach usually sits" lines of each symptom on [the symptoms page](rules/typescript/symptoms.md) and the check's section in `disciplines.assessment.md` (step 5a), then decide. Fix the cause where you can; a record is not the first move. Where a finding is correct in a place, or owed and cannot be fixed yet, answer it with a record in `<repo>/hone-records`, one file for each kind and symptom or recipe:
|
|
388
|
+
|
|
389
|
+
- **Debt** is known debt in one file: `hone-records/debt/<symptom>.json` with the symptom's name as `answers`, or `<symptom>#<check>` to reach one check of it, and the `file`. It is forfeited, and fails the run, as soon as that file changes since `--base-revision`. An `eslint-disable` comment or a `@ts-expect-error`, `@ts-ignore` or `@ts-nocheck` directive in a file is held only by a record on its check and file: until one holds it, such a comment is `unrecorded` and fails the run. Step 7a writes that debt for the findings and for such comments.
|
|
390
|
+
- **An authorised location** says the symptom is correct in that file, for example the single adapter that reads the real clock when the catalogue lists that case: `hone-records/authorised-locations/<symptom>.json`. `hone authorise` writes one from the arguments it is given, with the why-chain the person supplies.
|
|
391
|
+
- **A boundary record** says a module is where an outside party is met, such as the clock adapter, in `hone-records/boundary-records.json`:
|
|
392
|
+
|
|
393
|
+
```json
|
|
394
|
+
{
|
|
395
|
+
"version": 2,
|
|
396
|
+
"records": [
|
|
397
|
+
{ "module": "src/clock.ts", "outsideParty": "runtime:clock", "ports": ["Clock"] }
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
- **A deviation** says why a file does not follow a recipe the catalogue gives, in `hone-records/deviations/<recipe>.json`. **A dependency record** says why a package is used where the platform's own way exists, in `hone-records/dependency-records.json`.
|
|
403
|
+
|
|
404
|
+
Which kind answers a finding is in the `symptoms` section of the report: each symptom's note lists the situations that are correct uses of it and the record kind that expresses each. [README.md](README.md#hone-records) gives every kind's fields. A record that answers nothing is `stale` and fails the run, except a dependency record, which no check reads yet and so is never stale, so record only what a finding needs: debt while the check still finds it, a location or boundary where the symptom is correct. If the check is not a true measure of the rule here, or cannot work here, list it as `"not-run"` instead; if the rule does not apply, list it as `"not-adopted"` (step 4).
|
|
405
|
+
|
|
406
|
+
An authorised location needs its `case`, its `owes` and a `whyChain` shaped like this, with exactly five steps in `whys`; debt needs none:
|
|
360
407
|
|
|
361
408
|
```json
|
|
362
409
|
"whyChain": {
|
|
@@ -368,27 +415,25 @@ A `file-carve-out` is debt and needs only its `kind`, `clause` and `file`; its `
|
|
|
368
415
|
{ "why": "...", "because": "...", "evidence": "..." }
|
|
369
416
|
],
|
|
370
417
|
"rootCause": "...",
|
|
371
|
-
"
|
|
418
|
+
"rootEvidence": "...",
|
|
372
419
|
"readback": "...",
|
|
373
420
|
"owner": "..."
|
|
374
421
|
}
|
|
375
422
|
```
|
|
376
423
|
|
|
377
|
-
The chain runs cause to cause: each why asks why the answer before it is true, each answer cites evidence that can be checked again, the root names the fifth answer's cause and is checked against today, and the readback runs back from the root to the symptom with "therefore". [The why-chain contract](docs/why-chain-contract.md) has a worked example, the checks Hone runs, and what review still judges. A chain that breaks a check is refused
|
|
424
|
+
The chain runs cause to cause: each why asks why the answer before it is true, each answer cites evidence that can be checked again, the root names the fifth answer's cause and is checked against today, and the readback runs back from the root to the symptom with "therefore". [The why-chain contract](docs/why-chain-contract.md) has a worked example, the checks Hone runs, and what review still judges. A chain that breaks a check is refused. `file` is an exact repository path.
|
|
378
425
|
|
|
379
|
-
|
|
426
|
+
Records an earlier version wrote are moved by `hone upgrade` and kept word for word under `carried`, as [MIGRATING.md](MIGRATING.md#20-moving-from-version-1-to-version-2) section 20 says. They are checked against `--base-revision`: any record you write or change yourself needs its full form.
|
|
380
427
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
Existing debt needs no chain and no reason: a `file-carve-out` names only its clause and file, and step 7a writes those records for you. Add a `reason` if you want to leave future developers a note on what the debt signals. A run with any file carve-out still needs `--base-revision`, or it reports `forfeiture-unmeasured` and fails. `"fileExceptionWhyChains": "optional"` in `disciplines.json` lets an `authorised-location` give only its `reason` too, but a reason-only `authorised-location` will be refused in the next major release. A `clause-wide-carve-out` still needs its `whyChain`, and a `whyChain` or `provenance` you give anyway is still checked. [README.md](README.md#discipline-exceptionsjson) has the details.
|
|
428
|
+
Existing debt needs no chain and no case: a debt record names only its symptom and file, and step 7a writes those records for you. Add a `note` if you want to leave future developers a note on what the debt signals. A run with any debt still needs `--base-revision`, or it reports `forfeiture-unmeasured` and fails, unless forfeiture is left to another run (step 5). [README.md](README.md#hone-records) has the details.
|
|
384
429
|
|
|
385
430
|
### 7a. Record the debt you inherit
|
|
386
431
|
|
|
387
|
-
A repository with existing code usually has more findings than the change that adopts Hone can fix. `hone record-debt` writes a
|
|
432
|
+
A repository with existing code usually has more findings than the change that adopts Hone can fix. `hone record-debt` writes a debt record for each symptom, check and file the check finds broken, and for each inline disable or TypeScript directive that hides one, so the first passing run does not wait on hundreds of records written by hand. Do this after the assessment (step 5a), and after fixing what you are going to fix in this change.
|
|
388
433
|
|
|
389
|
-
1. **Decide the permanent exceptions first.** List each file or folder that breaks a
|
|
390
|
-
2. **Leave `
|
|
391
|
-
3. **Finish every source file this change edits.**
|
|
434
|
+
1. **Decide the permanent exceptions first.** List each file or folder that breaks a check on purpose and always will, such as the one adapter that reads the real clock. Those are not debt. They get an authorised location or a boundary record with their own reason, written by a person, so keep them out of the generated records with `--leave`.
|
|
435
|
+
2. **Leave `hone.config.json` as it is.** Debt needs no why-chain and no case, so the command needs no setting and never sets one. The same command records debt a later change uncovers, such as a newly listed check or a newer edition: run it again against the branch's base.
|
|
436
|
+
3. **Finish every source file this change edits.** Forfeiture is assessed against the branch's base, the revision your pre-push hook and CI pass to the check (step 5), such as `origin/main`, not against the commit you run from. A file the adopting change edits has changed since that base, so a record for it is forfeited there, even after you commit the edit; the command writes none for such a file and says so. In each file this change edits, fix every finding of each check, or take the edit out of this change and make it later in a change that fixes the file. A file this change adds has no record to lose: point 4 reports it `touched`.
|
|
392
437
|
4. **Run it once, with the branch's base as `--base-revision`**, one `--leave` for each path from point 1. Fetch the base first, so the revision is current:
|
|
393
438
|
|
|
394
439
|
```bash
|
|
@@ -396,17 +441,17 @@ A repository with existing code usually has more findings than the change that a
|
|
|
396
441
|
node_modules/.bin/hone record-debt --repo . --base-revision origin/main --leave src/clock.ts --leave src/adapters
|
|
397
442
|
```
|
|
398
443
|
|
|
399
|
-
It prints one line per
|
|
400
|
-
5. **Re-project and check against the same base.** With any `eslint`
|
|
401
|
-
6. **Review the diff.** Nothing takes effect until you commit it. Each generated record
|
|
444
|
+
It prints one line per finding and per native exception under `unrecorded`. `recorded` lines are records it added to `hone-records`. `left` lines are files under a `--leave` path: write their records now, each with its own reason. `touched` lines are files this change created or changed: fix them, or record them yourself with a reason of your own. `already-recorded` and `unrecordable` lines say why nothing was written, and each `unrecordable` line says what to do instead; for an `ignore` it is to remove the ignore, or to list a generated or vendored file in `exclude` so that Hone's setting and the team's ignore agree; [README.md](README.md#recording-inherited-debt) has the details. When it recorded anything, a last line names the `hone project` command that puts the records into effect, which point 5 runs.
|
|
445
|
+
5. **Re-project and check against the same base.** With any `eslint` check, run `npm run --silent hone:project`. Then run `npm run --silent hone:check -- --forfeiture this-run --base-revision origin/main` (with pnpm, `pnpm run --silent hone:check --forfeiture this-run --base-revision origin/main`). `--forfeiture this-run` makes this run assess forfeiture whatever `forfeiture` says, as the run that assesses it for your repository does: the pre-push hook with `"forfeiture": "elsewhere"` (step 5), or CI without it. A `forfeited` line names a file this change edits: go back to point 3 for it. A check against `HEAD` hides those lines, because nothing has changed since `HEAD`, and the hook or CI then fails where this run passed. The generated records cover the findings and the inline disables and directives that hide them, so what stays under `unrecorded` is what no record can hold: an `ignore`, a `suppression-entry`, an inline rule configuration, a `config-override` or a lint-script option. Each has an `unrecordable` line from point 4 that says what to do about it. For an `ignore`, the findings in the file are already recorded, so removing it hides nothing, and a generated or vendored file can instead be listed in `exclude` so that Hone's setting and the team's ignore agree; for a `suppression-entry`, the findings in the file are already recorded, so removing it hides nothing; for a `config-override`, remove it or narrow it to the files that need it.
|
|
446
|
+
6. **Review the diff.** Nothing takes effect until you commit it. Each generated record is debt holding only its symptom, check and file: inherited debt that nobody has reviewed, and the reviewer of the adopting change reads it as that. Note them in each check's Debt line in `disciplines.assessment.md`.
|
|
402
447
|
|
|
403
|
-
The records are the same as any other
|
|
448
|
+
The records are the same as any other debt record: each is forfeited once its file changes, which is how the debt is paid down. A file with no earlier revision gets no record, because it has no debt to inherit. The command is for adoption, but it does not refuse to run again: forfeiture already stops it turning new findings into debt, since a record written for a file just changed is forfeited by the next check that assesses forfeiture. That holds only where forfeiture is assessed. With `"forfeiture": "elsewhere"` (step 5), it is assessed only by the run that the repository leaves it to, such as the pre-push hook, so a push that bypasses that run lets such a record through until a later run assesses it.
|
|
404
449
|
|
|
405
|
-
Running it again only adds records for
|
|
450
|
+
Running it again only adds records for symptoms, checks and files that have none; it never removes or rewrites one. Debt that is paid is listed `paid`, or `stale` when nothing it holds is found, and `forfeited` once its file is touched. `hone prune-debt` removes it, as [README.md](README.md#pruning-paid-debt) says; any other record that has gone stale you delete by hand.
|
|
406
451
|
|
|
407
452
|
## 8. Prove one failure and correction
|
|
408
453
|
|
|
409
|
-
Before relying on the check, prove that it fails on a real violation in your repository and passes once it is fixed. With
|
|
454
|
+
Before relying on the check, prove that it fails on a real violation in your repository and passes once it is fixed. With `date-used-directly#clock-sources` listed, create `src/discipline-probe.ts` (any path the check covers) containing exactly:
|
|
410
455
|
|
|
411
456
|
```ts
|
|
412
457
|
const probeStartedAt = Date.now();
|
|
@@ -419,72 +464,98 @@ git add src/discipline-probe.ts
|
|
|
419
464
|
npm run --silent hone:check
|
|
420
465
|
```
|
|
421
466
|
|
|
422
|
-
It must exit `1` with
|
|
467
|
+
It must exit `1` with a line starting `date-used-directly#clock-sources walker src/discipline-probe.ts:1:0 const probeStartedAt = Date.now();` among its findings. Change the same file to `const probeStartedAt = 0;`, stage it, and run the check again: that finding must be gone. Then remove the probe with `git rm -f src/discipline-probe.ts`. A run that never showed the finding proves nothing: check that the file was staged and is not under an `exclude` entry. For another discipline, take a flag case from its `rules/<ID>/discipline.json`.
|
|
423
468
|
|
|
424
469
|
## 9. Apply the judgement rules
|
|
425
470
|
|
|
426
|
-
A judgement clause cannot be
|
|
471
|
+
A judgement clause cannot be listed in `hone.config.json`, and no check reports it. List the judgement rules the repository adopts in the Judgement rules section of `disciplines.assessment.md` (step 5a), so reviewers and agents know to apply them.
|
|
427
472
|
|
|
428
|
-
Each rule
|
|
473
|
+
Each rule item names its review lenses in its `lenses` fact, each a method under [methods/lenses/](methods/README.md) for reading code against that kind of rule. To review a change, by a human reviewer or a coding agent:
|
|
429
474
|
|
|
430
475
|
1. The reviewer is not the change's author. An agent reviewing a change reads files only; it does not edit them.
|
|
431
476
|
2. Pin the tree under review to a commit and review that.
|
|
432
|
-
3. Run each lens on its own, one concern at a time, without seeing the other lenses' findings. Follow the lens file: load the rule
|
|
477
|
+
3. Run each lens on its own, one concern at a time, without seeing the other lenses' findings. Follow the lens file: load the rule items that name it, inspect the change as it says, and report findings in its output shape, citing the clause address. A lens covers mechanical rules too, beyond what their checks flag.
|
|
433
478
|
4. Run [defended-on-intent](methods/lenses/defended-on-intent.md) last, over the rule text and the other lenses' findings, to catch changes that meet a rule's letter but defeat its intent.
|
|
434
479
|
5. Fix each finding. A deliberate departure from a judgement rule is recorded where the review decision is kept, with a `whyChain` in the same shape as step 7.
|
|
435
480
|
|
|
436
|
-
To use an agent, give it the lens file, the rule
|
|
481
|
+
To use an agent, give it the lens file, the rule items that name it, the change and the pinned commit, and ask it to follow the lens exactly. A single reviewer covering every concern at once misses what separate lenses catch.
|
|
437
482
|
|
|
438
483
|
## 10. Update and remove
|
|
439
484
|
|
|
440
|
-
To update, on a branch, read [the changelog](https://github.com/HailsTails/hone/blob/main/CHANGELOG.md) for each version since yours, then install the new version exactly as step 2 does, with `npm install --save-dev --save-exact @hailstails/hone@<version>` or `pnpm add -D --save-exact @hailstails/hone@<version>`. Compare the installed rule pages under `node_modules/@hailstails/hone/rules/` with the old ones, re-run `hone:project` if any
|
|
485
|
+
To update, on a branch, read [the changelog](https://github.com/HailsTails/hone/blob/main/CHANGELOG.md) for each version since yours, then install the new version exactly as step 2 does, with `npm install --save-dev --save-exact @hailstails/hone@<version>` or `pnpm add -D --save-exact @hailstails/hone@<version>`. Compare the installed rule pages under `node_modules/@hailstails/hone/rules/` with the old ones, re-run `hone:project` if any check is on `eslint`, run the check, and commit `package.json` and the lockfile with a message naming the new version. With a tarball, replace it with the newer one and install that instead. Rule text can change between versions, so read the changed pages. Version 2 reads different files from version 1: a repository on version 1 runs `hone upgrade` once after installing version 2, as [MIGRATING.md section 20](MIGRATING.md#20-moving-from-version-1-to-version-2) says, before it runs the check.
|
|
441
486
|
|
|
442
|
-
To remove, run `npm uninstall @hailstails/hone`, delete the two `hone:` scripts, any vendored tarball, `
|
|
487
|
+
To remove, run `npm uninstall @hailstails/hone`, delete the two `hone:` scripts, any vendored tarball, `hone.config.json`, `hone-records`, `disciplines.assessment.md` and, with `eslint` checks, `hone.eslint.mjs`, `hone.eslint.d.mts`, every package slice and their spread in the flat config, and take the check out of the validation script.
|
|
443
488
|
|
|
444
489
|
## Worked example
|
|
445
490
|
|
|
446
|
-
In the Hone source repository, `tests/test-fixtures/walkthrough/` is a small repository before and after its fix,
|
|
491
|
+
In the Hone source repository, `tests/test-fixtures/walkthrough/` is a small repository before and after its fix, and a test runs both through the shipped `hone check` and requires the reports below, and the two files shown, to be what it prints. It lists `claimed-type#unlisted-cast-site` and `claimed-type#cast-to-any`, `loop-keyword#loop-statement`, `date-used-directly#clock-sources` and `unit-without-a-running-test#companion-test-file` on the walker, with the ESLint-only `claimed-type#non-null-assertions` listed as `"not-run"`, because the repository has no ESLint, and a `generated/` folder excluded:
|
|
492
|
+
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"version": 2,
|
|
496
|
+
"ruleSets": {},
|
|
497
|
+
"checks": {
|
|
498
|
+
"claimed-type#cast-to-any": "walker",
|
|
499
|
+
"claimed-type#unlisted-cast-site": "walker",
|
|
500
|
+
"claimed-type#non-null-assertions": "not-run",
|
|
501
|
+
"loop-keyword#loop-statement": "walker",
|
|
502
|
+
"date-used-directly#clock-sources": "walker",
|
|
503
|
+
"unit-without-a-running-test#companion-test-file": "walker"
|
|
504
|
+
},
|
|
505
|
+
"exclude": ["generated"]
|
|
506
|
+
}
|
|
507
|
+
```
|
|
447
508
|
|
|
448
509
|
Before, `npm run --silent hone:check` prints, and exits `1`:
|
|
449
510
|
|
|
450
511
|
```text
|
|
451
512
|
excluded (1)
|
|
452
513
|
generated
|
|
453
|
-
|
|
454
|
-
|
|
514
|
+
not-run (1)
|
|
515
|
+
claimed-type#non-null-assertions adopted, engine not run: enforced by review
|
|
455
516
|
findings (5)
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
CD-23#export-test-sibling: read node_modules/@hailstails/hone/rules/CD-23/README.md#spirit
|
|
517
|
+
date-used-directly#clock-sources walker src/basket.ts:7:0 private openedAt = Date.now(); may indicate: ports-declared-inside, written-out-answers, doer-or-orchestrator
|
|
518
|
+
claimed-type#unlisted-cast-site walker src/basket.ts:10:20 entry as Line); } total(): string { let pence = 0; for (const line … may indicate: declared-not-asserted, straight-through-tests, handed-what-it-uses
|
|
519
|
+
loop-keyword#loop-statement walker src/basket.ts:15:0 for (const line of this.lines) { may indicate: no-hidden-effects, ports-declared-inside, doer-or-orchestrator
|
|
520
|
+
date-used-directly#clock-sources walker src/basket.ts:22:0 return Date.now() - this.openedAt; may indicate: ports-declared-inside, written-out-answers, doer-or-orchestrator
|
|
521
|
+
unit-without-a-running-test#companion-test-file walker src/utils/format.ts:1:0 missing co-located *.test.ts(x) sibling may indicate: tested-where-its-owned
|
|
522
|
+
symptoms (4)
|
|
523
|
+
date-used-directly: Date used directly. May indicate: needs the current time, a random value, a new id or an outside ordering → Ports declared inside, Written-out answers; does one job → Doer or orchestrator. The breach usually sits in the unit that should be passed the time, often a doer doing two jobs. Recipe: World values through a port. Correct use: a boundary record on the clock adapter. Known debt: debt. Read node_modules/@hailstails/hone/rules/typescript/symptoms.md#date-used-directly
|
|
524
|
+
claimed-type: Claimed type. May indicate: gives a value its type (declares it, or needs it narrower) → Declared, not asserted; checks a value that may be one of several outcomes → Straight-through tests; gives a value its type (declares it, or needs it narrower): in a test, a cast to build an input → Handed what it uses. The breach usually sits in the declaration: an input too wide, a generic not bounded, a missing parse. Recipes: Fix the declaration, not the value; Assert to narrow; One argument object. Correct use: an authorised location in the adapter whose outside contract forces it. Known debt: debt. Read node_modules/@hailstails/hone/rules/typescript/symptoms.md#claimed-type
|
|
525
|
+
loop-keyword: Loop keyword. May indicate: makes a new value from what it has → No hidden effects; causes an effect (writes, logs, sends, exits) → Ports declared inside; coordinates other units → Doer or orchestrator. The breach usually sits in the unit. Recipe: Functional iteration. Draining a stream: an authorised location in its source's adapter. Known debt: debt. Read node_modules/@hailstails/hone/rules/typescript/symptoms.md#loop-keyword
|
|
526
|
+
unit-without-a-running-test: Unit without a running test. May indicate: gives each unit its test → Tested where it's owned. The breach usually sits in the missing test. Recipe: Companion test file. Known debt: debt. Read node_modules/@hailstails/hone/rules/typescript/symptoms.md#unit-without-a-running-test
|
|
467
527
|
verdict: fail
|
|
468
528
|
```
|
|
469
529
|
|
|
470
|
-
The
|
|
530
|
+
The reports name the pages from an installed package, `node_modules/@hailstails/hone/rules/typescript/symptoms.md`; a run from the source repository names them from there.
|
|
531
|
+
|
|
532
|
+
The fix replaces the `Basket` class with functions over a readonly `Basket` value, sums with `reduce`, takes the time from an injected `Clock`, types the input instead of casting it, moves `src/utils/format.ts` to `src/format.ts` with a `src/format.test.ts` sibling, and records `src/clock.ts`, the one adapter that reads `Date.now()`, as a boundary record in `hone-records/boundary-records.json`:
|
|
533
|
+
|
|
534
|
+
```json
|
|
535
|
+
{
|
|
536
|
+
"version": 2,
|
|
537
|
+
"records": [
|
|
538
|
+
{ "module": "src/clock.ts", "outsideParty": "runtime:clock", "ports": ["Clock"] }
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
```
|
|
471
542
|
|
|
472
|
-
|
|
543
|
+
After, the same command prints, and exits `0`:
|
|
473
544
|
|
|
474
545
|
```text
|
|
475
546
|
excluded (1)
|
|
476
547
|
generated
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
548
|
+
not-run (1)
|
|
549
|
+
claimed-type#non-null-assertions adopted, engine not run: enforced by review
|
|
550
|
+
answered (1)
|
|
551
|
+
date-used-directly#clock-sources walker src/clock.ts:3:0 export const createSystemClock = (): Clock => ({ now: () => Date.now() }); answered by boundary-record runtime:clock
|
|
481
552
|
verdict: pass
|
|
482
553
|
```
|
|
483
554
|
|
|
484
555
|
## Known gaps
|
|
485
556
|
|
|
486
|
-
- The worked example uses only the
|
|
487
|
-
- Each check flags exactly what its
|
|
488
|
-
- A snippet is the text the check reports; some checks report a fixed-width window that runs across lines, as
|
|
557
|
+
- The worked example uses only the walker engine. The ESLint consumer in `tests/test-fixtures/consumer-proof/eslint/` is the tested ESLint setup.
|
|
558
|
+
- Each check flags exactly what its page says and no more. Where a rule asks for more than its check can see, the page says which part is left to review.
|
|
559
|
+
- A snippet is the text the check reports; some checks report a fixed-width window that runs across lines, as `claimed-type#unlisted-cast-site` does above. No snippet is longer than 200 characters: a longer one is cut and ends in `…`. An ESLint finding on a line longer than that, such as a bundled or minified file, shows the line from the finding's column.
|
|
489
560
|
- A broken nested `eslint.config.*` in a folder the root config ignores, such as fixtures under `ignores: ["fixtures/**"]`, does not stop the check: those files are reported as `ignore` native exceptions, as the team's own `eslint .` never loads that config. One pattern shape is taken for a folder ignore although it is not one: an ignore matching every entry directly inside the folder, such as `gen/*`, where the team's ESLint still enters `gen` and fails on its broken config.
|
|
490
561
|
- The disciplines' IDs and rule text come from one team's code-discipline set. Selecting a subset is supported; editing a shipped rule is not. Write your own rule set for different rules, following [docs/extending.md](docs/extending.md).
|