@hailstails/hone 2.0.0-pre.2 → 2.0.0-pre.4

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.
Files changed (201) hide show
  1. package/ADOPTING.md +7 -7
  2. package/CHANGELOG.md +76 -0
  3. package/MIGRATING.md +15 -6
  4. package/README.md +12 -13
  5. package/chunks/chunk-3CWFUD5B.js +38 -0
  6. package/chunks/chunk-5AKHEW6V.js +15 -0
  7. package/chunks/chunk-75XWZYNN.js +64 -0
  8. package/chunks/chunk-7FVSZ2VL.js +1304 -0
  9. package/chunks/chunk-A3RL4O5V.js +146 -0
  10. package/chunks/chunk-BIDD2YWP.js +398 -0
  11. package/chunks/{chunk-GNOMK7CR.js → chunk-BKQ3K766.js} +489 -52
  12. package/chunks/{chunk-NRIQD3PI.js → chunk-BRANVR7K.js} +3 -5
  13. package/chunks/chunk-COQMPHWZ.js +37 -0
  14. package/chunks/{chunk-L7BGRC6D.js → chunk-CXM5KBZX.js} +1 -1
  15. package/chunks/chunk-D6645WPB.js +6 -0
  16. package/chunks/chunk-DJMF6JIM.js +42 -0
  17. package/chunks/{chunk-OKLYWD2Z.js → chunk-E4D5WDRX.js} +27 -20
  18. package/chunks/chunk-EBX57Z3V.js +8 -0
  19. package/chunks/chunk-FHVNKG5Q.js +19 -0
  20. package/chunks/chunk-FPIP7JEC.js +191 -0
  21. package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
  22. package/chunks/chunk-LD766VWU.js +57 -0
  23. package/chunks/chunk-LEFM7OPS.js +41 -0
  24. package/chunks/chunk-LNMDMRGQ.js +51 -0
  25. package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
  26. package/chunks/chunk-OO5KV7KN.js +17 -0
  27. package/chunks/{chunk-ASUN4AVC.js → chunk-PVSC4SE3.js} +71 -5
  28. package/chunks/chunk-SKDQ3QJD.js +75 -0
  29. package/chunks/chunk-W5OIAUDW.js +18 -0
  30. package/chunks/chunk-X73RZUPO.js +63 -0
  31. package/chunks/chunk-XE2KKWYH.js +45 -0
  32. package/chunks/chunk-YGMO5Z6U.js +432 -0
  33. package/chunks/chunk-YONPKP3C.js +15 -0
  34. package/docs/adding-a-discipline-or-mechanism.md +1 -1
  35. package/docs/extending.md +7 -388
  36. package/package.json +7 -6
  37. package/rules/README.md +2 -2
  38. package/rules/typescript/checks.md +236 -18
  39. package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
  40. package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
  41. package/rules/typescript/symptoms/assertion-outside-a-test/assertion-site.md +10 -0
  42. package/rules/typescript/symptoms/assertion-outside-a-test.md +25 -0
  43. package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
  44. package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
  45. package/rules/typescript/symptoms/code-or-prose-read-as-text/raw-read.md +10 -0
  46. package/rules/typescript/symptoms/code-or-prose-read-as-text.md +31 -0
  47. package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +1 -1
  48. package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +1 -1
  49. package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
  50. package/rules/typescript/symptoms/export-from-a-test-file/test-file-export.md +10 -0
  51. package/rules/typescript/symptoms/export-from-a-test-file.md +33 -0
  52. package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
  53. package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
  54. package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +1 -1
  55. package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
  56. package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
  57. package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
  58. package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
  59. package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
  60. package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
  61. package/rules/typescript/symptoms/process-global-used-in-place.md +1 -1
  62. package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
  63. package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
  64. package/rules/typescript/symptoms/test-switched-off.md +1 -1
  65. package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
  66. package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
  67. package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
  68. package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
  69. package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
  70. package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
  71. package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
  72. package/rules/typescript/symptoms/wide-input.md +3 -2
  73. package/rules/typescript/symptoms.md +183 -121
  74. package/src/application/conformance/conformance-testing-types.d.ts +13 -16
  75. package/src/domain/language-layer/authored-item-types.d.ts +50 -0
  76. package/src/domain/language-layer/catalogue-name.d.ts +5 -0
  77. package/src/domain/language-layer/check-address-text.d.ts +12 -0
  78. package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
  79. package/src/domain/rule-set/clause-address-types.d.ts +4 -3
  80. package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
  81. package/src/domain/runner/check-binding.d.ts +18 -0
  82. package/src/domain/runner/check-observations.d.ts +39 -0
  83. package/src/domain/runner/conformance-types.d.ts +8 -2
  84. package/src/domain/settings/test-files.d.ts +7 -0
  85. package/src/eslint-plugin.js +16 -12
  86. package/src/hone.js +10493 -10410
  87. package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
  88. package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
  89. package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
  90. package/src/infrastructure/engines/eslint/runner/runner.js +953 -1189
  91. package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
  92. package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
  93. package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
  94. package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
  95. package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
  96. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
  97. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
  98. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
  99. package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
  100. package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
  101. package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
  102. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
  103. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
  104. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
  105. package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.examples.json +30 -0
  106. package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/assertion-site.js +123 -0
  107. package/src/infrastructure/engines/walker/assertion-outside-a-test/assertion-site/piece.json +9 -0
  108. package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
  109. package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
  110. package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +213 -126
  111. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
  112. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
  113. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
  114. package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
  115. package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
  116. package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/piece.json +9 -0
  117. package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.examples.json +30 -0
  118. package/src/infrastructure/engines/walker/code-or-prose-read-as-text/raw-read/raw-read.js +166 -0
  119. package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
  120. package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
  121. package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
  122. package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
  123. package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
  124. package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
  125. package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/piece.json +9 -0
  126. package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.examples.json +30 -0
  127. package/src/infrastructure/engines/walker/export-from-a-test-file/test-file-export/test-file-export.js +31 -0
  128. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
  129. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
  130. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
  131. package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
  132. package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
  133. package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
  134. package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
  135. package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
  136. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
  137. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
  138. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
  139. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
  140. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
  141. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
  142. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
  143. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
  144. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
  145. package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
  146. package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
  147. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
  148. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
  149. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
  150. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
  151. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
  152. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
  153. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
  154. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
  155. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
  156. package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
  157. package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
  158. package/src/infrastructure/engines/walker/runner/runner.js +266 -77
  159. package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
  160. package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
  161. package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
  162. package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
  163. package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
  164. package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
  165. package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
  166. package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
  167. package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
  168. package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
  169. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
  170. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
  171. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
  172. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
  173. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
  174. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
  175. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
  176. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
  177. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
  178. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
  179. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +24 -0
  180. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +27 -0
  181. package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
  182. package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
  183. package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
  184. package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
  185. package/src/rule-set.d.ts +2 -1
  186. package/src/testing.d.ts +2 -4
  187. package/src/testing.js +104 -317
  188. package/src/{audit.d.ts → walker.d.ts} +13 -8
  189. package/src/walker.js +28 -0
  190. package/chunks/chunk-5HRMJ4O2.js +0 -608
  191. package/chunks/chunk-IX2VZTBO.js +0 -887
  192. package/chunks/chunk-K2W3D3NB.js +0 -17
  193. package/chunks/chunk-M6SOGWT7.js +0 -82
  194. package/chunks/chunk-MWLBA4B3.js +0 -849
  195. package/chunks/chunk-R75QELTA.js +0 -481
  196. package/chunks/chunk-RANAKCTW.js +0 -31
  197. package/chunks/chunk-TNY2PASL.js +0 -38
  198. package/chunks/chunk-UJONWHA4.js +0 -22
  199. package/docs/output-contract.md +0 -1155
  200. package/src/audit.js +0 -18
  201. package/src/domain/runner/runner-module-types.d.ts +0 -15
package/docs/extending.md CHANGED
@@ -1,393 +1,12 @@
1
1
  # Extending Hone with your own rule set
2
2
 
3
- A team can add its own disciplines beside the ones Hone ships, without forking Hone. They live in the team's repository as a **rule set**: a folder of discipline files and the pieces that check them. `hone check` loads them from the repository, runs them, reports them and applies exceptions to them the same way as Hone's own; the differences are listed under [What is stable](#what-is-stable).
3
+ A team rule set holds a team's own symptoms and checks in the team's repository. `hone check` runs them beside Hone's own, and records answer them the same way. Write one when your team wants a check Hone does not ship, rather than forking Hone or editing a shipped rule.
4
4
 
5
- This guide follows one tested example. `install-proof` installs the packed package into a small repository, stored in Hone's source repository under `tests/test-fixtures/consumer-proof/team/`, type-checks its rule set and runs `hone project` and `hone check` against it. Its rule set is `acme`, with two disciplines: `ACME-1` checked by ESLint and `ACME-2` checked by the audit mechanism. Every file sample below is a file of that repository, apart from the rule pages, the per-package ESLint config, the settings samples and the exception record, which are described rather than tested there.
5
+ The `acme` rule set Hone's install proof runs is a working example: [delivery/install-proof/consumer-proof/team/tools/disciplines/acme](https://github.com/HailsTails/hone/tree/main/delivery/install-proof/consumer-proof/team/tools/disciplines/acme).
6
6
 
7
- Read [ADOPTING.md](../ADOPTING.md) first: this guide assumes Hone is installed and `disciplines.json` exists.
7
+ ## Start one
8
8
 
9
- ## Which mechanism
10
-
11
- - **ESLint** for anything about code syntax. The piece is an ordinary ESLint plugin, typed with ESLint's own types, and the team's editor and lint run report it too.
12
- - **Audit** for what ESLint cannot see: which files exist, file names, and files that are not TypeScript. An audit piece is offered every tracked file in the repository, Markdown and JSON included.
13
-
14
- ## Where the files go
15
-
16
- ```text
17
- disciplines.json
18
- eslint.config.mjs
19
- disciplines.eslint.mjs
20
- tools/disciplines/acme/
21
- package.json
22
- tsconfig.pieces.json
23
- rules/ACME-1/discipline.json
24
- rules/ACME-1/README.md
25
- rules/ACME-2/discipline.json
26
- rules/ACME-2/README.md
27
- mechanisms/eslint/ACME-1/piece.json
28
- mechanisms/eslint/ACME-1/acme.eslint-plugin.ts
29
- mechanisms/eslint/ACME-1/piece-settings.ts
30
- mechanisms/audit/ACME-2/piece.json
31
- mechanisms/audit/ACME-2/scratch-files.ts
32
- ```
33
-
34
- The rule set may sit anywhere inside the repository. Hone reads `rules/<ID>/discipline.json` and `mechanisms/<mechanism>/<ID>/piece.json` under it, and loads the modules the pieces name. Everything else in the folder is yours.
35
-
36
- ## Declare the rule set
37
-
38
- Name the folder in `disciplines.json` under `ruleSets`, then select its clauses with the rule set's name in front:
39
-
40
- ```json
41
- {
42
- "version": 1,
43
- "ruleSets": { "acme": "tools/disciplines/acme" },
44
- "clauses": {
45
- "acme/ACME-1#console-calls": "eslint",
46
- "acme/ACME-2#scratch-files": "audit"
47
- }
48
- }
49
- ```
50
-
51
- - The path is relative to the repository root and must stay inside it.
52
- - `hone` is Hone's own rule set, and its clauses can be selected beside the team's. `hone/CD-15#loops` (`loop-keyword#loop-statement`) and `CD-15#loops` are the same clause, and the report prints the short form. `loop-keyword#loop-statement` is the check's name, given for reading: today's tool neither accepts nor prints a check's name, so write and expect the clause address; check names become typeable in 2.0.
53
- - A rule set may not be called `hone` or start with `hone-`, and no declared name may be another declared name plus `-<suffix>`.
54
- - Discipline IDs only need to be unique inside one rule set: a team rule set may reuse an ID Hone's own rule set has, and `acme/<DisciplineId>` and `<DisciplineId>` stay two disciplines.
55
-
56
- The report names team clauses with their rule set:
57
-
58
- ```text
59
- findings (2)
60
- acme/ACME-1#console-calls eslint src/start-banner.ts:1:0 console.log("web started");
61
- acme/ACME-2#scratch-files audit notes.scratch.md:1:0 notes.scratch.md
62
- verdict: fail
63
- ```
64
-
65
- ## Write the discipline
66
-
67
- `rules/ACME-1/discipline.json`:
68
-
69
- ```json
70
- {
71
- "version": 1,
72
- "id": "ACME-1",
73
- "clauses": [
74
- {
75
- "kind": "mechanical",
76
- "id": "console-calls",
77
- "summary": "no direct console output in source",
78
- "mechanisms": ["eslint"],
79
- "anchor": { "kind": "keyword", "keyword": "console" },
80
- "cases": {
81
- "flag": [
82
- { "name": "console.log", "fileName": "src/a.ts", "source": "console.log(1);\n", "expectedLines": [1] }
83
- ],
84
- "allow": [
85
- { "name": "no console", "fileName": "src/b.ts", "source": "export const b = 1;\n", "expectedLines": [] }
86
- ]
87
- }
88
- }
89
- ]
90
- }
91
- ```
92
-
93
- - `id` matches the folder name. IDs are two to four capital letters, a dash and a number, with an optional lower-case letter after it.
94
- - Each clause lists the mechanisms that can check it. Selecting one clause adopts the whole discipline, so its other mechanical clauses must be selected too.
95
- - `anchor` is `{ "kind": "keyword", "keyword": "..." }` or `{ "kind": "file" }`.
96
- - `cases` say what the clause must flag and what it must leave alone. They are the clause's contract. `hone check` does not run them against a team's pieces; the team runs them in its own tests: see [Test a piece](#test-a-piece).
97
- - A clause with `"kind": "judgement"`, a `summary` and `"enforcedBy": "review"` is applied in review and cannot be selected.
98
- - `"exceptions": "refused"` on a clause stops any exception record from exempting it.
99
-
100
- `rules/ACME-1/README.md` is the rule's page: why the rule exists, one example that honours it and one that breaks it. Write it for the people and agents who apply the rule, not about how the check matches. It is optional today and will be required. Hone's own rule pages follow a fixed shape, a Rule and its Spirit on `README.md` with the mechanics in a sibling `CHECKS.md`; [adding a discipline](adding-a-discipline-or-mechanism.md#1a-the-rule-pages) describes it.
101
-
102
- ## An ESLint piece
103
-
104
- `mechanisms/eslint/ACME-1/piece.json`:
105
-
106
- ```json
107
- {
108
- "version": 1,
109
- "discipline": "ACME-1",
110
- "mechanism": "eslint",
111
- "clauses": [
112
- {
113
- "clause": "console-calls",
114
- "settings": { "pluginNamespace": "acme", "pluginModule": "acme.eslint-plugin.ts", "rule": "no-console-calls" }
115
- }
116
- ]
117
- }
118
- ```
119
-
120
- `mechanisms/eslint/ACME-1/acme.eslint-plugin.ts`:
121
-
122
- ```ts
123
- import type { ESLint, Rule } from "eslint";
124
-
125
- export const noConsoleCalls: Rule.RuleModule = {
126
- meta: {
127
- type: "problem",
128
- schema: [],
129
- messages: { console: "Write through the logger port, not console." },
130
- },
131
- create: (context) => ({
132
- "MemberExpression[object.name='console']": (node: Rule.Node) => {
133
- context.report({ node, messageId: "console" });
134
- },
135
- }),
136
- };
137
-
138
- const plugin: ESLint.Plugin = { rules: { "no-console-calls": noConsoleCalls } };
139
-
140
- export default plugin;
141
- ```
142
-
143
- - `pluginModule` is a path inside the piece folder. Its default export is the plugin, and `rule` is a key of its `rules`.
144
- - `pluginNamespace` must be the rule set's name or start with it and a dash: `acme` or `acme-console`. `hone`, `hone-*` and `hone-core` belong to Hone.
145
- - `options`, optional, is the rule's options array, passed to ESLint as written.
146
-
147
- Then run `hone project`. It writes `disciplines.eslint.mjs`, which imports the plugin by a path relative to the repository root:
148
-
149
- ```js
150
- import piece0 from "./tools/disciplines/acme/mechanisms/eslint/ACME-1/acme.eslint-plugin.ts";
151
-
152
- export default [
153
- {
154
- name: "hone-core/piece/acme",
155
- files: ["**/*.{ts,tsx,mts,cts}"],
156
- plugins: { "acme": piece0 },
157
- rules: { "acme/no-console-calls": "error" },
158
- },
159
- ];
160
- ```
161
-
162
- Every `eslint.config.*` that applies to checked files spreads the projection last. The projection sets rules only, so the config also sets the typescript-eslint parser, as [ADOPTING.md](../ADOPTING.md#4a-set-up-eslint-for-eslint-checks) step 4a explains. The example's `eslint.config.mjs`:
163
-
164
- ```js
165
- import typescriptParser from "@typescript-eslint/parser";
166
- import projection from "./disciplines.eslint.mjs";
167
-
168
- export default [
169
- { files: ["**/*.{ts,tsx,mts,cts}"], languageOptions: { parser: typescriptParser } },
170
- ...projection,
171
- ];
172
- ```
173
-
174
- In a monorepo each package's own config does the same, importing the projection by its relative path, such as `../../disciplines.eslint.mjs`. A package config that leaves the projection out fails the check, listing each of its files under `unrecorded` as `acme/ACME-1#console-calls eslint config-override <file>`. [ADOPTING.md](../ADOPTING.md#4a-set-up-eslint-for-eslint-checks) step 4a says which config ESLint applies to a file and how to state it in `disciplines.json` when detection cannot tell.
175
-
176
- ## An audit piece
177
-
178
- `mechanisms/audit/ACME-2/piece.json`:
179
-
180
- ```json
181
- {
182
- "version": 1,
183
- "discipline": "ACME-2",
184
- "mechanism": "audit",
185
- "clauses": [
186
- {
187
- "clause": "scratch-files",
188
- "settings": { "module": "scratch-files.ts" },
189
- "editions": ["1", "2"]
190
- }
191
- ]
192
- }
193
- ```
194
-
195
- `mechanisms/audit/ACME-2/scratch-files.ts`:
196
-
197
- ```ts
198
- import { editionReaches, isEdition, type PieceHit, type RunnerClause, type WalkerPiece } from "@hailstails/hone/audit";
199
-
200
- const SCRATCH_MARKER = ".scratch.";
201
- const DRAFT_MARKER = ".draft.";
202
- const DRAFT_EDITION = "2";
203
-
204
- const markersOf = (request: { readonly clause: RunnerClause }): readonly string[] =>
205
- isEdition(DRAFT_EDITION) && editionReaches({ edition: request.clause.edition, introducedIn: DRAFT_EDITION }) === "reached"
206
- ? [SCRATCH_MARKER, DRAFT_MARKER]
207
- : [SCRATCH_MARKER];
208
-
209
- const scratchHits = (request: { readonly clauses: readonly RunnerClause[]; readonly file: string }): readonly PieceHit[] =>
210
- request.clauses
211
- .filter((clause) => markersOf({ clause }).some((marker) => request.file.includes(marker)))
212
- .map((clause) => ({ clause: clause.address, anchor: { line: 1, column: 0 }, snippet: request.file }));
213
-
214
- export const check: WalkerPiece = {
215
- prepare: ({ clauses }) => ({
216
- outcome: "ok",
217
- value: {
218
- prepareFile: ({ file }) => ({ outcome: "ok", value: { kind: "complete", hits: scratchHits({ clauses, file }) } }),
219
- finish: () => ({ outcome: "ok", value: [] }),
220
- },
221
- }),
222
- };
223
- ```
224
-
225
- - `module` is a path inside the piece folder, and the module exports `check`.
226
- - `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. The repository also carries a `disk`, a required field: its `root`, the kind of entry at an absolute path (`kindAt`) and a file's text (`textAt`), for a piece that must read files beyond the one it is given, untracked ones included. In a conformance case the disk holds only the case's file. A piece's own tests that build a `WalkerRepository` by hand must now give it a `disk` (the type is `WalkerDisk` from `@hailstails/hone/audit`), as the example's proof does. Such tests written before the field was added no longer type-check until they give it one. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
227
- - `prepareFile` answers `skipped` for a file the piece does not judge. Any other answer, `complete` with no hits included, says the piece's clauses were measured on that file: the runner reports each as a `measured` pair, and `hone prune-debt` removes a stale or forfeited `file-carve-out` on that clause and file. The example answers `complete` for every file because it judges every file by its name; a piece that judges only TypeScript sources answers `skipped` for a `.md` or `.js` file.
228
- - A hit passes back the clause's `address` unchanged, a 1-based line and 0-based column, and a short snippet.
229
- - A hit may also give a `remedy` (the type is `Remedy` from `@hailstails/hone/audit`): a `fix` naming what to write instead of the form it flagged, the `page` that shows it as a path inside the rule's folder (`rules/<ID>/`), such as `CHECKS.md` or `README.md`, and the `section` of that page, as lowercase letters, digits and hyphens. Core resolves the page to the path a reader opens, as it does for the rule page under `readFirst`, and the finding then ends with ` fix: <fix> (<fix page>#<section>)`; see [the output contract](output-contract.md#report-lines).
230
- - When the piece cannot run, for example on settings it does not accept, return a failed result whose error is a `PieceFailure`: `kind` `piece-invalid`, the clause's `pieceRoot` and a `detail`. `hone check` then stops with a load failure naming the piece folder.
231
- - When the piece cannot parse a file, return a failed result whose error is `kind` `file-unparseable`, the `file` and a `detail`. `hone check` then stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
232
- - To read JSON with comments, such as a `tsconfig.json`, call TypeScript's own parser on the syntax API: `syntaxApi.parseConfigFileTextToJson(file, text)` returns the parsed value as `config` and sets `error` when it cannot parse the text. A piece does not import a JSON parser of its own; see [What is stable](#what-is-stable).
233
-
234
- ### Settings a repository can change
235
-
236
- The example's marker is fixed. To let a repository change it, a clause entry in `piece.json` declares `clauseSettings`: each key with its `default`, and optionally `choices`, a list of the values allowed. For a `marker` setting with default `".scratch."`, the clause entry would read:
237
-
238
- ```json
239
- {
240
- "clause": "scratch-files",
241
- "settings": { "module": "scratch-files.ts" },
242
- "clauseSettings": { "marker": { "default": ".scratch." } }
243
- }
244
- ```
245
-
246
- A repository that selects the clause can then override it in `disciplines.json`, keyed by the clause's address:
247
-
248
- ```json
249
- "clauseSettings": {
250
- "acme/ACME-2#scratch-files": { "marker": ".scratch.md" }
251
- }
252
- ```
253
-
254
- Hone refuses a value under an undeclared key, of another JSON kind than the default, or outside the `choices`, before any piece runs. The piece reads the value, the override or else the default, from `clause.clauseSettings` on each `RunnerClause`, in place of the fixed `SCRATCH_MARKER`. The value is typed as any JSON value, so the piece narrows it, for example with `typeof marker === "string"`, and returns a `piece-invalid` failure when it is not what it accepts. Name the settings on the discipline's page under a Settings heading. This section is described, not run by the example: Hone's unit tests cover reading, refusing and overriding settings.
255
-
256
- ### Editions of a check
257
-
258
- When a clause's check becomes stricter, ship the stricter check as a new edition instead of changing what the clause flags. A clause entry in `piece.json` lists its `editions` in ascending order: the first is the default, and the last is the latest. The example's piece lists `["1", "2"]`: edition 2 also flags files named with `.draft.`. An entry without `editions` has the single edition `"1"`. The setting key `edition` is reserved for the edition a repository pins, so a piece cannot declare it under `clauseSettings`.
259
-
260
- The piece reads the edition that runs from `clause.edition` on each `RunnerClause`. `@hailstails/hone/audit` exports two helpers. `isEdition` narrows a text such as `"2"` to an `Edition` without a cast. `editionReaches({ edition: clause.edition, introducedIn })` says whether the running edition covers something introduced in a given edition. The example piece uses both, and a piece's tests use `isEdition` the same way to build a `RunnerClause` for each edition.
261
-
262
- A case in `discipline.json` names the edition it runs under with `"edition": "2"`. A case without one runs under the piece's default edition. A case naming an edition the piece does not declare makes the rule set invalid. Conformance runs each edition's cases under that edition, and `clauseUnderTestOf` gives each case its `edition`. The example's `rules/ACME-2/discipline.json` flags `src/notes.draft.ts` under edition 2 and allows it under edition 1:
263
-
264
- ```json
265
- { "name": "draft file", "fileName": "src/notes.draft.ts", "source": "export const notes = 1;\n", "expectedLines": [1], "edition": "2" }
266
- ```
267
-
268
- A repository that selects the clause runs edition 1 until it sets `"checkEditions": "latest"` or pins the clause with `"edition": "2"` in its `clauseSettings`. Its report lists the edition that ran under `editions`, such as `acme/ACME-2#scratch-files audit edition 1 of 2`.
269
-
270
- ## TypeScript pieces under Node
271
-
272
- Hone loads piece modules with Node, which strips the types from a `.ts` file as it loads it. Node 22.18 or later does this without flags.
273
-
274
- - A piece module ends in `.ts` or `.js`. `.mts` and `.mjs` are refused.
275
- - Node decides whether a `.ts` file is an ES module from the nearest `package.json`:
276
- - `"type": "module"`: it loads, silently.
277
- - No `"type"` field: it still loads, because Node sees the `export` syntax, but every run prints a `[MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///… is not specified` block per piece module before the report.
278
- - `"type": "commonjs"`: it fails to load, with the `Failed to load the ES module` warning and load failure shown under [Common refusals](#common-refusals).
279
-
280
- The example repository says `"type": "commonjs"` at its root, the hard case, so its rule set has its own `package.json`:
281
-
282
- ```json
283
- {
284
- "private": true,
285
- "type": "module"
286
- }
287
- ```
288
-
289
- These three behaviours were checked by hand on Node 22.22.2; `install-proof` checks the first on every Node it runs.
290
- - Use only syntax Node can erase, spell the `.ts` extension in relative imports, and use `import type` for types. [ADOPTING.md](../ADOPTING.md#1-check-the-prerequisites) step 1 lists the limits.
291
- - Node does not strip types under `node_modules`. A rule set kept in an installed package is named by its repository path, for example `"acme": "node_modules/@acme/disciplines"`, and must ship `.js` piece modules; a `.ts` one fails with `Stripping types is currently unsupported for files under node_modules`.
292
-
293
- ## Type-check the rule set
294
-
295
- `@hailstails/hone/rule-set` holds types only. `@hailstails/hone/audit` holds the walker piece types and three values: `folderScope`, `isEdition` and `editionReaches`. Import types with `import type`. A `tsconfig` for the rule set that matches how Node runs it, `tools/disciplines/acme/tsconfig.pieces.json`:
296
-
297
- ```json
298
- {
299
- "compilerOptions": {
300
- "target": "es2022",
301
- "module": "nodenext",
302
- "moduleResolution": "nodenext",
303
- "strict": true,
304
- "noEmit": true,
305
- "allowImportingTsExtensions": true,
306
- "erasableSyntaxOnly": true,
307
- "verbatimModuleSyntax": true,
308
- "resolveJsonModule": true,
309
- "skipLibCheck": false,
310
- "types": []
311
- },
312
- "include": ["**/*.ts"]
313
- }
314
- ```
315
-
316
- Run it with the repository's own compiler, for example `tsc --noEmit -p tools/disciplines/acme/tsconfig.pieces.json`. `erasableSyntaxOnly` needs TypeScript 5.8 or later; leave it out on older versions.
317
-
318
- The ESLint piece's `settings` can be checked against `EslintPieceSettings` from the JSON file itself. `mechanisms/eslint/ACME-1/piece-settings.ts`:
319
-
320
- ```ts
321
- import type { EslintPieceSettings } from "@hailstails/hone/rule-set";
322
- import piece from "./piece.json" with { type: "json" };
323
-
324
- type Settled<Settings extends EslintPieceSettings> = Settings;
325
-
326
- export type PieceSettings = Settled<(typeof piece)["clauses"][number]["settings"]>;
327
- ```
328
-
329
- A wrong field then fails the type check, for example `Type 'number' is not assignable to type 'string'` for a numeric `rule`; `install-proof` checks this on TypeScript 4.8.4 and 6.0.3 with the same `Settled` type over settings typed as a JSON file types them. TypeScript reads string values in a JSON file as `string`, so this works for `settings` but not for `discipline.json` or the rest of `piece.json`, whose types name exact values such as `"mechanical"`. Hone checks those files when it reads them.
330
-
331
- ## Test a piece
332
-
333
- Test an ESLint rule with ESLint's own `RuleTester`, importing the rule the plugin exports, such as `noConsoleCalls`, and giving it the clause's `flag` cases as `invalid` and its `allow` cases as `valid`. Run on its own with `node`, `RuleTester` prints nothing when the cases hold and throws on the first that does not; under a test runner that defines `describe` and `it`, it reports each case as a test.
334
-
335
- Test an audit piece with `@hailstails/hone/testing`. `clauseConformanceOf` loads the installed audit runner, binds the clause from the rule set as `hone check` binds it, and runs every `flag` and `allow` case through the piece:
336
-
337
- ```ts
338
- import { clauseConformanceOf } from "@hailstails/hone/testing";
339
-
340
- const conformance = await clauseConformanceOf({ ruleSetRoot: "tools/disciplines/acme", clause: "acme/ACME-2#scratch-files" });
341
- ```
342
-
343
- A relative `ruleSetRoot` is read from the working directory. `{ outcome: "ok", value: [] }` means the piece met every case. Each entry in a longer list names a case, the lines it expects and the lines the piece flagged. `{ outcome: "failed", error: { kind, detail } }` means the cases could not run, for example `rule-set-unloadable` for a clause the audit mechanism may not check.
344
-
345
- Checks of your own call the piece directly. `clauseUnderTestOf` returns the same bound clause and each case's `name`, `file`, `source` and `edition`, ready for `check.prepare` and `prepareFile`; `repoPathOf` makes the `RepoPath` for any other file, such as one whose `readText` fails with `file-unreadable`. `folderScope` from `@hailstails/hone/audit` tells a piece whether a file sits in a generated folder. Hone does not run these tests; the team runs them with its own test runner.
346
-
347
- ## Exceptions
348
-
349
- Exception records in `discipline-exceptions.json` name team clauses by their full address and work exactly as for Hone's own clauses. This entry records the console calls already in `src/start-banner.ts` as debt: it moves the finding to `exempted` and, after `hone project`, turns the rule off for that file in the team's own ESLint run, until the file is next touched and the record is forfeited:
350
-
351
- ```json
352
- {
353
- "kind": "file-carve-out",
354
- "clause": "acme/ACME-1#console-calls",
355
- "file": "src/start-banner.ts"
356
- }
357
- ```
358
-
359
- A `file-carve-out` is debt and needs no `whyChain` and no `reason`. Where the clause does not apply to a file at all, record an `authorised-location` instead: it is never forfeited, so it needs a `reason` and a `whyChain` that follows the [why-chain contract](why-chain-contract.md), and without the chain it is refused as `evidence-refused`. [README.md](../README.md#hone-records) describes the record kinds and what each needs.
360
-
361
- ## What is stable
362
-
363
- Two requirements are decided and not yet built. Each will make some rule sets that pass today fail:
364
-
365
- - **A rule page is required.** A selected team discipline without `rules/<ID>/README.md` will fail to load.
366
- - **Pieces keep to import boundaries.** A team piece will be refused if it imports from anywhere but its own piece folder, its discipline's `rules/<ID>` folder, `@hailstails/hone/rule-set`, `@hailstails/hone/audit` and its mechanism's toolchain package (`eslint` or `typescript`), with values only from its own piece folder and `folderScope`, `isEdition` and `editionReaches` from `@hailstails/hone/audit`. The rule is about a piece's run-time code: a piece's own tests may also import `@hailstails/hone/testing`.
367
-
368
- To be ready now: write each discipline's `README.md`, and import nothing from Hone in a piece but types from `@hailstails/hone/rule-set` and `@hailstails/hone/audit`, and `folderScope`, `isEdition` and `editionReaches`.
369
-
370
- | Part | Status |
371
- | --- | --- |
372
- | `ruleSets`, the address `[<ruleSet>/]<ID>#<clause>`, `hone` reserved | Stable |
373
- | The folder layout `rules/<ID>/` and `mechanisms/<mechanism>/<ID>/` | Stable, with `rules/<ID>/README.md` becoming required |
374
- | `discipline.json` and `piece.json` version 1, and the ESLint piece `settings` with the namespace rule | Stable file formats |
375
- | `@hailstails/hone/rule-set` | Stable |
376
- | Exception records for team clauses | Stable |
377
- | `@hailstails/hone/audit` and the walker piece contract | Experimental: may change in a minor release |
378
- | `@hailstails/hone/testing` | Experimental: may change in a minor release |
379
- | A rule set named by a package name, such as `"acme": "@acme/disciplines"` | Not supported: name its repository path instead, as under [TypeScript pieces under Node](#typescript-pieces-under-node) |
380
- | A new mechanism from outside Hone | Not supported |
381
-
382
- ## Common refusals
383
-
384
- | Output | Cause |
385
- | --- | --- |
386
- | `load failure: reserved-rule-set-name hone` | A rule set is declared as `hone`. Pick the team's own name. |
387
- | `load failure: unknown-rule-set beta` | A clause names a rule set that `ruleSets` does not declare. |
388
- | `load failure: runner-failed eslint piece-invalid <piece folder> the plugin namespace hone belongs to Hone; the rule set acme must use acme or acme-<name>` | The ESLint piece uses one of Hone's namespaces. |
389
- | `load failure: runner-failed eslint piece-invalid <piece folder> the plugin namespace lint is not owned by the rule set acme; use acme or acme-<name>` | The namespace does not start with the rule set's name. |
390
- | `load failure: runner-failed eslint piece-invalid <piece folder> ✖ not a path inside the piece folder ending in .ts, or .js in a built install\n → at pluginModule` | The ESLint piece's `pluginModule` is outside the piece folder or ends in neither `.ts` nor `.js`. The `\n` is printed as written, not as a line break. |
391
- | `load failure: runner-failed audit piece-invalid <piece folder> [\n {\n "code": "custom",\n "path": [\n "module"\n ],\n "message": "the module is not a path inside the piece folder ending .ts, or .js in a built install"\n }\n]` | The audit piece's `module` is outside the piece folder or ends in neither `.ts` nor `.js`. The whole message is one line, each `\n` printed as written. |
392
- | `(node:<pid>) Warning: Failed to load the ES module: <piece module>. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension.` and ``(Use `node --trace-warnings ...` to show where the warning was created)``, then `load failure: runner-failed eslint piece-invalid <piece folder> Unexpected token 'export'` | The nearest `package.json` says `"type": "commonjs"`, so Node read the `.ts` piece as CommonJS. Node prints its warning for each `.ts` piece module it tried; the load failure names one mechanism whose piece failed. Give the rule set a `package.json` with `"type": "module"`. |
393
- | `<clause> eslint config-override <file>` under `unrecorded` | An `eslint.config.*` that applies to the file does not spread the projection. |
9
+ 1. Pick a folder, name it under `ruleSets` in `hone.config.json`, and select its checks as `<rule set>/<symptom>#<check>`.
10
+ 2. Write each symptom and check as an item under the folder's `rules/`, laid out as Hone's own [rules](../rules/README.md). `@hailstails/hone/rule-set` types each item's facts.
11
+ 3. Write each check's piece under `engines/<engine>/<symptom>/<check>/`, with its examples beside it. Use ESLint for what a lint rule can see, and the walker (`@hailstails/hone/walker`) for files and names ESLint never reads.
12
+ 4. Test each piece against its examples with `checkConformanceOf` from `@hailstails/hone/testing`, naming the rule set and its root. An empty list means the piece meets every example.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailstails/hone",
3
- "version": "2.0.0-pre.2",
3
+ "version": "2.0.0-pre.4",
4
4
  "description": "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
5
5
  "keywords": [
6
6
  "code-quality",
@@ -28,10 +28,6 @@
28
28
  },
29
29
  "exports": {
30
30
  "./package.json": "./package.json",
31
- "./audit": {
32
- "types": "./src/audit.d.ts",
33
- "default": "./src/audit.js"
34
- },
35
31
  "./eslint-plugin": {
36
32
  "types": "./src/eslint-plugin.d.ts",
37
33
  "default": "./src/eslint-plugin.js"
@@ -44,16 +40,21 @@
44
40
  "types": "./src/testing.d.ts",
45
41
  "default": "./src/testing.js"
46
42
  },
43
+ "./walker": {
44
+ "types": "./src/walker.d.ts",
45
+ "default": "./src/walker.js"
46
+ },
47
47
  "./src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/eslint-plugin.js": "./src/infrastructure/engines/eslint/authored-class-or-this/class-keyword/eslint-plugin.js",
48
48
  "./src/infrastructure/engines/eslint/claimed-type/non-null-assertions/eslint-plugin.js": "./src/infrastructure/engines/eslint/claimed-type/non-null-assertions/eslint-plugin.js",
49
- "./src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/eslint-plugin.js": "./src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/eslint-plugin.js",
50
49
  "./src/infrastructure/engines/eslint/name-off-its-casing/filename-case/eslint-plugin.js": "./src/infrastructure/engines/eslint/name-off-its-casing/filename-case/eslint-plugin.js",
51
50
  "./src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/eslint-plugin.js": "./src/infrastructure/engines/eslint/name-off-its-casing/naming-convention/eslint-plugin.js",
52
51
  "./src/infrastructure/engines/eslint/positional-parameters/parameter-count/eslint-plugin.js": "./src/infrastructure/engines/eslint/positional-parameters/parameter-count/eslint-plugin.js",
53
52
  "./src/infrastructure/engines/eslint/rebinding/parameter-reassignment/eslint-plugin.js": "./src/infrastructure/engines/eslint/rebinding/parameter-reassignment/eslint-plugin.js",
53
+ "./src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/eslint-plugin.js": "./src/infrastructure/engines/eslint/tangled-function/cognitive-complexity/eslint-plugin.js",
54
54
  "./src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js": "./src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js",
55
55
  "./src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/eslint-plugin.js": "./src/infrastructure/engines/eslint/thrown-non-error/throw-only-error/eslint-plugin.js",
56
56
  "./src/infrastructure/engines/eslint/untyped-value/explicit-any/eslint-plugin.js": "./src/infrastructure/engines/eslint/untyped-value/explicit-any/eslint-plugin.js",
57
+ "./src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js": "./src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js",
57
58
  "./src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/eslint-plugin.js": "./src/infrastructure/engines/eslint/work-inside-a-condition/else-after-an-exit/eslint-plugin.js"
58
59
  },
59
60
  "files": [
package/rules/README.md CHANGED
@@ -263,7 +263,7 @@ Until a check can name the breach, a finding names the rules the symptom points
263
263
 
264
264
  Six checks run together on `CD-27#test-body-logic`: [branch-in-a-test#test-body](typescript/symptoms/branch-in-a-test/test-body.md), [throw-or-catch-in-a-test#try-block](typescript/symptoms/throw-or-catch-in-a-test/try-block.md), [rebinding#test-body](typescript/symptoms/rebinding/test-body.md), [computed-value-in-a-test#test-body](typescript/symptoms/computed-value-in-a-test/test-body.md), [text-past-its-reader#test-body](typescript/symptoms/text-past-its-reader/test-body.md) and [double-with-a-body#logic-in-a-passed-function](typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md). Each check's page lists what it flags.
265
265
 
266
- - They read test files only: `*.test.ts` and `*.test.tsx`. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped. Helper files that tests import are not checked.
266
+ - They read test files only: `.ts` and `.tsx` files that `testFiles` in `hone.config.json` names. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped. Helper files that tests import are not checked.
267
267
  - None flags loops, which [loop-statement](typescript/symptoms/loop-keyword/loop-statement.md) covers, or `throw`, which [throw-statement](typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md) covers.
268
268
  - None flags element access such as `calls[0]`, calls to free functions, a method called through a computed key, such as `rows["map"]`, or text built with a template literal.
269
269
 
@@ -305,7 +305,7 @@ A default that quietly narrows a rule, which no codebase chose, still fails.
305
305
  | Edition defaults | "Edition defaults would be for backwards compatability since we went npm." An existing adopter keeps the behaviour it installed. |
306
306
  | `confinedPackages` empty by default | "packages is empty because we can't define the universe and if we just said imports at all we would catch internal packages." Seeing every outside dependency needs a way to tell it from an internal package; until then the list is the adopter's to fill. |
307
307
  | `__tests__` skipped by default | "probably because of noise level and the fact I don't adopt that folder practice deliberately at all." |
308
- | `.spec.ts` not treated as a test file by most checks | "Spec is also just not a naming practice I use." Then: "It honestly should be config for user to declare file naming structure so we can match their conventions." Hone has no such config yet; the Companion test file and Integration test suffix recipes are the convention it reads. |
308
+ | Which files are test files | "Spec is also just not a naming practice I use." Then: "It honestly should be config for user to declare file naming structure so we can match their conventions." `testFiles` in `hone.config.json` declares it. |
309
309
  | Generated folders skipped (`node_modules`, `dist` and the like) | not code of ours |
310
310
  | Reading `.test.js` and `.test.mjs` in the subprocess-environment check | it widens one check, not narrows a rule |
311
311
  | Suite-body exemption | "A test suite's body is a list of cases, not a coordinator." |