@hailstails/hone 2.0.0-pre.3 → 2.0.0-pre.5

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 (282) hide show
  1. package/ADOPTING.md +9 -20
  2. package/CHANGELOG.md +104 -0
  3. package/MIGRATING.md +18 -9
  4. package/README.md +15 -17
  5. package/chunks/chunk-3CWFUD5B.js +38 -0
  6. package/chunks/chunk-4AJQHZ7I.js +191 -0
  7. package/chunks/chunk-5AKHEW6V.js +15 -0
  8. package/chunks/{chunk-L7BGRC6D.js → chunk-6LTJRJOE.js} +1 -1
  9. package/chunks/chunk-75XWZYNN.js +64 -0
  10. package/chunks/{chunk-ASUN4AVC.js → chunk-BISP2JOL.js} +73 -9
  11. package/chunks/chunk-COQMPHWZ.js +37 -0
  12. package/chunks/chunk-D6645WPB.js +6 -0
  13. package/chunks/chunk-DJMF6JIM.js +42 -0
  14. package/chunks/chunk-EBX57Z3V.js +8 -0
  15. package/chunks/chunk-EFUWHLZK.js +426 -0
  16. package/chunks/chunk-FHVNKG5Q.js +19 -0
  17. package/chunks/{chunk-NRIQD3PI.js → chunk-FRE5IA3C.js} +3 -5
  18. package/chunks/{chunk-OKLYWD2Z.js → chunk-GMLT3MHO.js} +262 -257
  19. package/chunks/{chunk-QP5TLOBY.js → chunk-HVZVKZPW.js} +12 -9
  20. package/chunks/chunk-LEFM7OPS.js +41 -0
  21. package/chunks/chunk-LNMDMRGQ.js +51 -0
  22. package/chunks/chunk-M4VSJ27S.js +139 -0
  23. package/chunks/{chunk-RGSHTPLA.js → chunk-MBEDAFVC.js} +3 -11
  24. package/chunks/chunk-ND3EOGDK.js +2350 -0
  25. package/chunks/chunk-ONDBACCR.js +14332 -0
  26. package/chunks/chunk-OO5KV7KN.js +17 -0
  27. package/chunks/chunk-SKDQ3QJD.js +75 -0
  28. package/chunks/chunk-U6W65ZOF.js +86 -0
  29. package/chunks/chunk-W5OIAUDW.js +18 -0
  30. package/chunks/{chunk-GNOMK7CR.js → chunk-WPEOCLTP.js} +495 -52
  31. package/chunks/chunk-X73RZUPO.js +63 -0
  32. package/chunks/chunk-XE2KKWYH.js +45 -0
  33. package/chunks/chunk-XNIXPQQ5.js +179 -0
  34. package/chunks/chunk-YONPKP3C.js +15 -0
  35. package/docs/adding-a-discipline-or-mechanism.md +1 -1
  36. package/docs/extending.md +7 -388
  37. package/methods/lenses/function-first.md +2 -2
  38. package/package.json +7 -6
  39. package/rules/README.md +7 -5
  40. package/rules/SPIRIT.md +1 -1
  41. package/rules/numbers.md +4 -4
  42. package/rules/principles/no-leak-across-a-boundary.md +1 -1
  43. package/rules/principles.md +1 -1
  44. package/rules/record-kinds/authorised-location.md +1 -1
  45. package/rules/records.md +11 -19
  46. package/rules/rules.md +5 -5
  47. package/rules/sources.md +6 -7
  48. package/rules/typescript/checks.md +280 -394
  49. package/rules/typescript/recipes/adapter-per-outside-party.md +10 -5
  50. package/rules/typescript/recipes/assert-to-narrow.md +114 -4
  51. package/rules/typescript/recipes/closure-factory.md +5 -5
  52. package/rules/typescript/recipes/companion-test-file.md +5 -3
  53. package/rules/typescript/recipes/composed-orchestrator.md +6 -4
  54. package/rules/typescript/recipes/composition-root.md +5 -3
  55. package/rules/typescript/recipes/{bounded-context-generic.md → constrained-context-generic.md} +6 -4
  56. package/rules/typescript/recipes/copy-never-write-in.md +6 -4
  57. package/rules/typescript/recipes/declared-not-bundled.md +5 -3
  58. package/rules/typescript/recipes/dependency-record.md +5 -3
  59. package/rules/typescript/recipes/domain-vocabulary-list.md +5 -3
  60. package/rules/typescript/recipes/entity-module.md +8 -5
  61. package/rules/typescript/recipes/exact-pins-and-a-lock-file.md +5 -3
  62. package/rules/typescript/recipes/extension-outside-the-vendored-code.md +5 -3
  63. package/rules/typescript/recipes/failure-asserted-as-a-value.md +44 -4
  64. package/rules/typescript/recipes/failure-mapping-at-the-adapter.md +8 -5
  65. package/rules/typescript/recipes/fix-the-declaration-not-the-value.md +5 -3
  66. package/rules/typescript/recipes/functional-iteration.md +8 -3
  67. package/rules/typescript/recipes/guard-clauses.md +5 -3
  68. package/rules/typescript/recipes/integration-test-owns-its-scratch.md +5 -3
  69. package/rules/typescript/recipes/integration-test-suffix.md +5 -3
  70. package/rules/typescript/recipes/it-each-over-typed-rows.md +117 -0
  71. package/rules/typescript/recipes/map-out-at-the-adapter.md +36 -4
  72. package/rules/typescript/recipes/meaning-in-names-not-comments.md +5 -5
  73. package/rules/typescript/recipes/named-exported-type.md +5 -3
  74. package/rules/typescript/recipes/narrow-ports.md +5 -3
  75. package/rules/typescript/recipes/one-argument-object.md +8 -3
  76. package/rules/typescript/recipes/{port-in-the-domain.md → port-in-a-module-of-its-own.md} +7 -5
  77. package/rules/typescript/recipes/ports-in-the-argument.md +5 -3
  78. package/rules/typescript/recipes/repo-scripts-only.md +5 -3
  79. package/rules/typescript/recipes/result-union.md +5 -5
  80. package/rules/typescript/recipes/screaming-folders.md +5 -5
  81. package/rules/typescript/recipes/shared-strict-base-config.md +5 -5
  82. package/rules/typescript/recipes/stub-with-vi-fn.md +130 -0
  83. package/rules/typescript/recipes/tagged-union-and-exhaustive-switch.md +5 -3
  84. package/rules/typescript/recipes/whole-words.md +5 -3
  85. package/rules/typescript/recipes/whole-written-out-expectation.md +284 -4
  86. package/rules/typescript/recipes/world-values-through-a-port.md +5 -3
  87. package/rules/typescript/recipes/zod-at-the-producers-adapter.md +8 -3
  88. package/rules/typescript/recipes.md +567 -21
  89. package/rules/typescript/symptoms/ambient-randomness/random-call.md +10 -0
  90. package/rules/typescript/symptoms/ambient-randomness.md +1 -1
  91. package/rules/typescript/symptoms/answer-set-in-a-hook/hook-answer.md +10 -0
  92. package/rules/typescript/symptoms/answer-set-in-a-hook.md +1 -1
  93. package/rules/typescript/symptoms/assertion-outside-a-test-body/assertion-site.md +10 -0
  94. package/rules/typescript/symptoms/assertion-outside-a-test-body.md +25 -0
  95. package/rules/typescript/symptoms/branch-in-a-test/test-body.md +10 -184
  96. package/rules/typescript/symptoms/branch-in-a-test.md +11 -1
  97. package/rules/typescript/symptoms/built-unit-called-in-place/call-of-a-call.md +10 -0
  98. package/rules/typescript/symptoms/built-unit-called-in-place.md +25 -0
  99. package/rules/typescript/symptoms/claimed-type/non-null-assertions.md +1 -1
  100. package/rules/typescript/symptoms/code-or-prose-read-as-text-in-a-test/raw-read.md +10 -0
  101. package/rules/typescript/symptoms/code-or-prose-read-as-text-in-a-test.md +31 -0
  102. package/rules/typescript/symptoms/computed-value-in-a-test/test-body.md +26 -117
  103. package/rules/typescript/symptoms/computed-value-in-a-test.md +1 -1
  104. package/rules/typescript/symptoms/date-used-directly.md +1 -1
  105. package/rules/typescript/symptoms/default-for-a-required-value.md +1 -1
  106. package/rules/typescript/symptoms/double-with-a-body/logic-in-a-passed-function.md +2 -19
  107. package/rules/typescript/symptoms/double-with-a-body/stub-implementation.md +2 -2
  108. package/rules/typescript/symptoms/double-with-a-body.md +1 -1
  109. package/rules/typescript/symptoms/export-from-a-test/test-file-export.md +10 -0
  110. package/rules/typescript/symptoms/export-from-a-test.md +33 -0
  111. package/rules/typescript/symptoms/failure-shaped-as-success/empty-catch.md +10 -0
  112. package/rules/typescript/symptoms/failure-shaped-as-success.md +1 -1
  113. package/rules/typescript/symptoms/floating-version/version-selector.md +10 -0
  114. package/rules/typescript/symptoms/inherited-environment-in-a-subprocess/git-spawn-environment.md +2 -2
  115. package/rules/typescript/symptoms/inner-layer-imports-outer.md +1 -1
  116. package/rules/typescript/symptoms/library-class-built-in-place.md +1 -1
  117. package/rules/typescript/symptoms/loop-keyword/loop-statement.md +1 -1
  118. package/rules/typescript/symptoms/many-spellings-of-one-concept/test-call-aliases.md +10 -0
  119. package/rules/typescript/symptoms/many-spellings-of-one-concept.md +3 -2
  120. package/rules/typescript/symptoms/module-or-global-patched/module-mock-call.md +4 -4
  121. package/rules/typescript/symptoms/no-lock-file/committed-lock-file.md +12 -0
  122. package/rules/typescript/symptoms/outside-import-past-a-boundary/import-or-require.md +1 -0
  123. package/rules/typescript/symptoms/outside-import-past-a-boundary.md +5 -4
  124. package/rules/typescript/symptoms/outside-type-in-a-signature.md +2 -2
  125. package/rules/typescript/symptoms/{port-outside-the-domain.md → port-beside-its-adapter.md} +2 -2
  126. package/rules/typescript/symptoms/port-named-for-a-mechanism.md +1 -1
  127. package/rules/typescript/symptoms/process-global-used-in-place/debugger-statement.md +10 -0
  128. package/rules/typescript/symptoms/process-global-used-in-place/direct-global-use.md +14 -0
  129. package/rules/typescript/symptoms/process-global-used-in-place.md +2 -2
  130. package/rules/typescript/symptoms/prose-in-code/comment-prose.md +12 -0
  131. package/rules/typescript/symptoms/rebinding/test-body.md +1 -18
  132. package/rules/typescript/symptoms/rebinding.md +11 -1
  133. package/rules/typescript/symptoms/schema-past-its-adapter.md +2 -2
  134. package/rules/typescript/symptoms/test-switched-off/skipped-tests.md +3 -6
  135. package/rules/typescript/symptoms/test-switched-off.md +1 -1
  136. package/rules/typescript/symptoms/text-past-its-reader/test-body.md +2 -17
  137. package/rules/typescript/symptoms/text-past-its-reader.md +1 -1
  138. package/rules/typescript/symptoms/throw-between-our-units/throw-statement.md +10 -0
  139. package/rules/typescript/symptoms/throw-or-catch-in-a-test/throw-statement.md +1 -1
  140. package/rules/typescript/symptoms/throw-or-catch-in-a-test/try-block.md +1 -25
  141. package/rules/typescript/symptoms/tool-fetched-at-run-time/fetch-command.md +10 -0
  142. package/rules/typescript/symptoms/type-declared-in-a-test/test-type-declaration.md +10 -0
  143. package/rules/typescript/symptoms/type-declared-in-a-test.md +33 -0
  144. package/rules/typescript/symptoms/unasserted-call.md +1 -1
  145. package/rules/typescript/symptoms/unit-without-a-running-test/companion-test-file.md +2 -2
  146. package/rules/typescript/symptoms/wide-input/unread-parameter.md +10 -0
  147. package/rules/typescript/symptoms/wide-input.md +3 -2
  148. package/rules/typescript/symptoms.md +210 -148
  149. package/src/application/conformance/conformance-testing-types.d.ts +13 -16
  150. package/src/domain/language-layer/authored-item-types.d.ts +66 -0
  151. package/src/domain/language-layer/catalogue-name.d.ts +5 -0
  152. package/src/domain/language-layer/check-address-text.d.ts +12 -0
  153. package/src/domain/rule-set/authored-rule-set-types.d.ts +31 -32
  154. package/src/domain/rule-set/clause-address-types.d.ts +4 -3
  155. package/src/domain/rule-set/rule-set-name-of.d.ts +10 -0
  156. package/src/domain/runner/check-binding.d.ts +18 -0
  157. package/src/domain/runner/check-observations.d.ts +39 -0
  158. package/src/domain/runner/conformance-types.d.ts +8 -2
  159. package/src/domain/runner/runner-result-types.d.ts +1 -2
  160. package/src/domain/settings/test-files.d.ts +7 -0
  161. package/src/eslint-plugin.js +45 -39
  162. package/src/hone.js +16 -13716
  163. package/src/infrastructure/disciplines-file/version-one-names.json +4 -5
  164. package/src/infrastructure/engines/eslint/authored-class-or-this/static-members-only/piece.json +0 -6
  165. package/src/infrastructure/engines/eslint/long-function/function-length/piece.json +0 -6
  166. package/src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-types.d.ts +2 -0
  167. package/src/infrastructure/engines/eslint/runner/runner.js +1001 -1234
  168. package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/README.md +0 -3
  169. package/src/infrastructure/engines/eslint/test-switched-off/focused-tests/eslint-plugin.js +33 -21
  170. package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/piece.json +11 -4
  171. package/src/infrastructure/engines/eslint/test-switched-off/skipped-tests/skipped-tests.examples.json +28 -0
  172. package/src/infrastructure/engines/eslint/untyped-value/implicit-any-let/piece.json +0 -2
  173. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/eslint-plugin.js +94 -0
  174. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/piece.json +11 -0
  175. package/src/infrastructure/engines/eslint/wide-input/unread-parameter/unread-parameter.examples.json +48 -0
  176. package/src/infrastructure/engines/walker/ambient-randomness/random-call/ambient-randomness.js +109 -0
  177. package/src/infrastructure/engines/walker/ambient-randomness/random-call/piece.json +9 -0
  178. package/src/infrastructure/engines/walker/ambient-randomness/random-call/random-call.examples.json +48 -0
  179. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answer.examples.json +42 -0
  180. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/hook-answers.js +72 -0
  181. package/src/infrastructure/engines/walker/answer-set-in-a-hook/hook-answer/piece.json +9 -0
  182. package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.examples.json +30 -0
  183. package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/assertion-site.js +123 -0
  184. package/src/infrastructure/engines/walker/assertion-outside-a-test-body/assertion-site/piece.json +9 -0
  185. package/src/infrastructure/engines/walker/authored-class-or-this/class-keyword/class-syntax.js +3 -3
  186. package/src/infrastructure/engines/walker/boolean-in-a-signature/boolean-annotation/boolean-signatures.js +7 -5
  187. package/src/infrastructure/engines/walker/branch-in-a-test/test-body/test-body-logic.js +192 -147
  188. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.examples.json +24 -0
  189. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/call-of-a-call.js +34 -0
  190. package/src/infrastructure/engines/walker/built-unit-called-in-place/call-of-a-call/piece.json +9 -0
  191. package/src/infrastructure/engines/walker/claimed-type/cast-to-any/any-cast.js +6 -4
  192. package/src/infrastructure/engines/walker/claimed-type/unlisted-cast-site/cast-expressions.js +6 -4
  193. package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/piece.json +9 -0
  194. package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.examples.json +30 -0
  195. package/src/infrastructure/engines/walker/code-or-prose-read-as-text-in-a-test/raw-read/raw-read.js +166 -0
  196. package/src/infrastructure/engines/walker/computed-value-in-a-test/test-body/piece.json +0 -10
  197. package/src/infrastructure/engines/walker/date-used-directly/clock-sources/clock-sources.js +4 -4
  198. package/src/infrastructure/engines/walker/default-on-a-closed-union/default-arm/switch-defaults.js +8 -6
  199. package/src/infrastructure/engines/walker/double-with-a-body/logic-in-a-passed-function/piece.json +0 -10
  200. package/src/infrastructure/engines/walker/double-with-a-body/stub-implementation/dependency-isolation.js +9 -14
  201. package/src/infrastructure/engines/walker/drawer-path/drawer-names/categorical-paths.js +4 -4
  202. package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/piece.json +9 -0
  203. package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.examples.json +30 -0
  204. package/src/infrastructure/engines/walker/export-from-a-test/test-file-export/test-file-export.js +31 -0
  205. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.examples.json +18 -0
  206. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/empty-catch.js +32 -0
  207. package/src/infrastructure/engines/walker/failure-shaped-as-success/empty-catch/piece.json +9 -0
  208. package/src/infrastructure/engines/walker/floating-version/version-selector/piece.json +9 -0
  209. package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.examples.json +54 -0
  210. package/src/infrastructure/engines/walker/floating-version/version-selector/version-selector.js +75 -0
  211. package/src/infrastructure/engines/walker/inherited-environment-in-a-subprocess/git-spawn-environment/hermetic-git-spawns.js +8 -17
  212. package/src/infrastructure/engines/walker/loop-keyword/loop-statement/loops.js +8 -6
  213. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/piece.json +9 -0
  214. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.examples.json +36 -0
  215. package/src/infrastructure/engines/walker/many-spellings-of-one-concept/test-call-aliases/test-call-aliases.js +67 -0
  216. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mock-call.examples.json +34 -0
  217. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/module-mocking.js +64 -16
  218. package/src/infrastructure/engines/walker/module-or-global-patched/module-mock-call/piece.json +5 -1
  219. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.examples.json +24 -0
  220. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/committed-lock-file.js +41 -0
  221. package/src/infrastructure/engines/walker/no-lock-file/committed-lock-file/piece.json +9 -0
  222. package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/import-boundaries.js +18 -16
  223. package/src/infrastructure/engines/walker/outside-import-past-a-boundary/import-or-require/piece.json +1 -1
  224. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.examples.json +18 -0
  225. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/debugger-statement.js +17 -0
  226. package/src/infrastructure/engines/walker/process-global-used-in-place/debugger-statement/piece.json +9 -0
  227. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/direct-global-use.examples.json +63 -0
  228. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/piece.json +13 -0
  229. package/src/infrastructure/engines/walker/process-global-used-in-place/direct-global-use/process-global-used-in-place.js +126 -0
  230. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/comment-prose.examples.json +42 -0
  231. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/piece.json +16 -0
  232. package/src/infrastructure/engines/walker/prose-in-code/comment-prose/prose-in-code.js +90 -0
  233. package/src/infrastructure/engines/walker/rebinding/test-body/piece.json +0 -10
  234. package/src/infrastructure/engines/walker/runner/pieces/walker-piece.d.ts +7 -5
  235. package/src/infrastructure/engines/walker/runner/runner.js +268 -79
  236. package/src/infrastructure/engines/walker/runner/toolchain/typescript-parse.d.ts +3 -0
  237. package/src/infrastructure/engines/walker/shorthand-name/identifier-names/identifier-names.js +12 -7
  238. package/src/infrastructure/engines/walker/strictness-weakened/exact-optional-property-types/piece.json +0 -10
  239. package/src/infrastructure/engines/walker/strictness-weakened/no-fallthrough-cases-in-switch/piece.json +0 -10
  240. package/src/infrastructure/engines/walker/strictness-weakened/no-implicit-override/piece.json +0 -10
  241. package/src/infrastructure/engines/walker/strictness-weakened/no-property-access-from-index-signature/piece.json +0 -10
  242. package/src/infrastructure/engines/walker/strictness-weakened/no-unchecked-indexed-access/piece.json +0 -10
  243. package/src/infrastructure/engines/walker/strictness-weakened/strict/compiler-overrides.js +30 -52
  244. package/src/infrastructure/engines/walker/strictness-weakened/use-unknown-in-catch-variables/piece.json +0 -10
  245. package/src/infrastructure/engines/walker/text-past-its-reader/test-body/piece.json +0 -10
  246. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/piece.json +9 -0
  247. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throw-statement.examples.json +36 -0
  248. package/src/infrastructure/engines/walker/throw-between-our-units/throw-statement/throws-in-production.js +12 -0
  249. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throw-statement.examples.json +6 -6
  250. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/throw-statement/throws-in-tests.js +5 -44
  251. package/src/infrastructure/engines/walker/throw-or-catch-in-a-test/try-block/piece.json +0 -10
  252. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.examples.json +42 -0
  253. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/fetch-command.js +152 -0
  254. package/src/infrastructure/engines/walker/tool-fetched-at-run-time/fetch-command/piece.json +9 -0
  255. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/piece.json +9 -0
  256. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.examples.json +36 -0
  257. package/src/infrastructure/engines/walker/type-declared-in-a-test/test-type-declaration/test-type-declaration.js +141 -0
  258. package/src/infrastructure/engines/walker/type-derived-from-code/factory-return-types/factory-return-types.js +8 -6
  259. package/src/infrastructure/engines/walker/unit-without-a-running-test/companion-test-file/export-test-sibling.js +16 -10
  260. package/src/infrastructure/engines/walker/untracked-escape/directive-pointers/comments-directives.js +18 -64
  261. package/src/infrastructure/engines/walker/write-into-a-parameter/parameter-mutation/parameter-mutation.js +7 -5
  262. package/src/measure-engines.process.js +80 -0
  263. package/src/rule-set.d.ts +2 -1
  264. package/src/testing.d.ts +2 -4
  265. package/src/testing.js +173 -314
  266. package/src/{audit.d.ts → walker.d.ts} +13 -8
  267. package/src/walker.js +28 -0
  268. package/chunks/chunk-5HRMJ4O2.js +0 -608
  269. package/chunks/chunk-IX2VZTBO.js +0 -887
  270. package/chunks/chunk-K2W3D3NB.js +0 -17
  271. package/chunks/chunk-M6SOGWT7.js +0 -82
  272. package/chunks/chunk-Q62Y25WS.js +0 -843
  273. package/chunks/chunk-R75QELTA.js +0 -481
  274. package/chunks/chunk-RANAKCTW.js +0 -31
  275. package/chunks/chunk-TNY2PASL.js +0 -38
  276. package/chunks/chunk-UJONWHA4.js +0 -22
  277. package/docs/output-contract.md +0 -1155
  278. package/rules/record-kinds/boundary-record.md +0 -9
  279. package/rules/typescript/recipes/iteach-over-typed-rows.md +0 -18
  280. package/rules/typescript/recipes/stub-with-vifn.md +0 -20
  281. package/src/audit.js +0 -18
  282. package/src/domain/runner/runner-module-types.d.ts +0 -15
@@ -1,247 +1,40 @@
1
1
  import {
2
- checkAddressTextOf,
3
- checkNamesOf,
4
- everyOk,
2
+ createDefaultPackageLocationPort
3
+ } from "./chunk-6LTJRJOE.js";
4
+ import {
5
+ everyOk
6
+ } from "./chunk-U6W65ZOF.js";
7
+ import {
5
8
  namedPiecePathOf,
6
9
  readNamedPiece
7
- } from "./chunk-R75QELTA.js";
8
- import {
9
- createDefaultPackageLocationPort
10
- } from "./chunk-L7BGRC6D.js";
10
+ } from "./chunk-4AJQHZ7I.js";
11
11
  import {
12
+ TOOL_IDENTITY,
13
+ checkAddressTextOf,
14
+ checkNamesOf,
15
+ editionSchema,
12
16
  gatheredPeerFailure,
13
17
  installedPeer,
14
18
  isRepoPathText,
15
19
  loadedPeer,
16
20
  moduleFileForm
17
- } from "./chunk-GNOMK7CR.js";
21
+ } from "./chunk-WPEOCLTP.js";
18
22
  import {
19
- TOOL_IDENTITY,
20
23
  gatheredOutcomes,
21
24
  listedOutcome
22
- } from "./chunk-M6SOGWT7.js";
25
+ } from "./chunk-YONPKP3C.js";
26
+ import {
27
+ editionReaches
28
+ } from "./chunk-RANIXNWY.js";
23
29
  import {
24
30
  __glob
25
31
  } from "./chunk-DGOLOS5A.js";
26
32
 
27
- // src/infrastructure/engines/eslint/runner/hone-plugin/hone-plugin.ts
33
+ // src/infrastructure/engines/eslint/runner/toolchain/eslint-toolchain.ts
28
34
  import { z as z4 } from "zod";
29
35
 
30
- // src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-schema.ts
31
- import { z } from "zod";
32
- var pieceModulePathSchema = z.string().superRefine((text, context) => {
33
- if (isRepoPathText({ text }) === "not-repo-path" || moduleFileForm({ text }) === "not-module-file") {
34
- context.addIssue({
35
- code: "custom",
36
- message: "not a path inside the piece folder ending in .ts, or .js in a built install"
37
- });
38
- }
39
- });
40
- var pluginNamespaceSchema = z.string().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);
41
- var eslintPieceSettingsSchema = z.strictObject({
42
- pluginNamespace: pluginNamespaceSchema,
43
- pluginModule: pieceModulePathSchema,
44
- rule: z.string(),
45
- options: z.array(z.json()).readonly().optional()
46
- }).readonly();
47
- var ruleOptionsOf = (request) => request.settings.options ?? [];
48
-
49
- // src/infrastructure/engines/eslint/runner/hone-plugin/check-rule-id.ts
50
- var CHECKS_PLUGIN_NAMESPACE = TOOL_IDENTITY.ownRuleSet;
51
- var ESLINT_MECHANISM = "eslint";
52
- var RULE_ID_PREFIX = `${CHECKS_PLUGIN_NAMESPACE}/`;
53
- var checkRuleNameOf = (request) => checkAddressTextOf(request);
54
- var checkRuleIdOf = (request) => `${RULE_ID_PREFIX}${checkRuleNameOf(request)}`;
55
- var runsOnEslint = (request) => request.check.engines.some((engine) => engine.name === ESLINT_MECHANISM) ? "eslint" : "elsewhere";
56
- var checkOfRuleId = (request) => {
57
- const check = request.checks.find(
58
- (candidate) => runsOnEslint({ check: candidate }) === "eslint" && checkRuleIdOf({ check: candidate }) === request.ruleId
59
- );
60
- return check === void 0 ? { found: "none" } : { found: "check", check };
61
- };
62
- var eslintRuleIdsOf = (request) => request.checks.filter((check) => runsOnEslint({ check }) === "eslint").map((check) => checkRuleIdOf({ check }));
63
-
64
- // src/infrastructure/engines/eslint/runner/hone-plugin/checks-plugin.ts
65
- import { z as z3 } from "zod";
66
-
67
- // src/infrastructure/engines/eslint/runner/pieces/eslint-plugin-schema.ts
68
- import { z as z2 } from "zod";
69
- var ruleVisitorSchema = z2.record(
70
- z2.string(),
71
- z2.function({ input: z2.array(z2.unknown()), output: z2.unknown() })
72
- );
73
- var ruleSchema = z2.looseObject({
74
- meta: z2.looseObject({
75
- type: z2.enum(["problem", "suggestion", "layout"]),
76
- messages: z2.record(z2.string(), z2.string()).optional()
77
- }),
78
- create: z2.function({ input: [z2.unknown()], output: ruleVisitorSchema })
79
- });
80
- var eslintPluginModuleSchema = z2.object({
81
- default: z2.looseObject({ rules: z2.record(z2.string(), ruleSchema) })
82
- });
83
- var inlineConfigNodesSchema = z2.array(
84
- z2.looseObject({ type: z2.enum(["Line", "Block"]), value: z2.string() })
85
- );
86
-
87
- // src/infrastructure/engines/eslint/runner/hone-plugin/checks-plugin.ts
88
- var PLUGIN_META = { name: `${TOOL_IDENTITY.packageName}/eslint-plugin`, version: "0.0.0-local" };
89
- var NUMBERED_LEAD = /^CD-\d+: /;
90
- var inSymptomWords = (request) => `${request.title}: ${request.message.replace(NUMBERED_LEAD, "")}`;
91
- var unnumbered = (request) => typeof request.text === "string" ? request.text.replace(NUMBERED_LEAD, "") : request.text;
92
- var reportInSymptomWords = (request) => {
93
- const reportData = request.boundary.reportDataOf({ descriptor: request.descriptor });
94
- return reportData === void 0 ? request.descriptor : {
95
- ...request.descriptor,
96
- data: Object.fromEntries(
97
- Object.entries(reportData).map(([key, text]) => [key, unnumbered({ text })])
98
- )
99
- };
100
- };
101
- var contextInSymptomWords = (request) => Object.create(request.context, {
102
- report: {
103
- value: (descriptor) => request.context.report(reportInSymptomWords({ descriptor, boundary: request.boundary }))
104
- }
105
- });
106
- var messagesInSymptomWords = (request) => request.messages === void 0 ? void 0 : Object.fromEntries(
107
- Object.entries(request.messages).map(([messageId, message]) => [
108
- messageId,
109
- inSymptomWords({ message, title: request.title })
110
- ])
111
- );
112
- var checkRuleOf = (request) => ({
113
- meta: {
114
- ...request.rule.meta,
115
- messages: messagesInSymptomWords({
116
- messages: request.rule.meta.messages,
117
- title: request.title
118
- })
119
- },
120
- create: (context) => request.rule.create(contextInSymptomWords({ context, boundary: request.boundary }))
121
- });
122
- var namedRuleOf = (request) => {
123
- const { check, pieceFile, pluginModule, ruleName } = request.source;
124
- const plugin = eslintPluginModuleSchema.safeParse({ default: request.source.plugin });
125
- if (!plugin.success) {
126
- return {
127
- outcome: "failed",
128
- error: {
129
- kind: "plugin-invalid",
130
- pieceFile,
131
- pluginModule,
132
- detail: z3.prettifyError(plugin.error)
133
- }
134
- };
135
- }
136
- const { rules } = plugin.data.default;
137
- const rule = Object.hasOwn(rules, ruleName) ? rules[ruleName] : void 0;
138
- return rule === void 0 ? { outcome: "failed", error: { kind: "piece-rule-missing", pieceFile, rule: ruleName } } : {
139
- outcome: "ok",
140
- value: [
141
- checkRuleNameOf({ check }),
142
- checkRuleOf({ rule, title: check.symptom.title, boundary: request.boundary })
143
- ]
144
- };
145
- };
146
- var checksPluginOf = (request) => {
147
- const rules = everyOk({
148
- entries: request.sources,
149
- resolve: (source) => namedRuleOf({ source, boundary: request.boundary })
150
- });
151
- return rules.outcome === "failed" ? rules : { outcome: "ok", value: { meta: PLUGIN_META, rules: Object.fromEntries(rules.value) } };
152
- };
153
-
154
- // src/infrastructure/engines/eslint/runner/hone-plugin/hone-plugin.ts
155
- var moduleExportsSchema = z4.looseObject({ default: z4.unknown() });
156
- var pieceSourceOf = async (request) => {
157
- const { check, installRoot } = request;
158
- const names = checkNamesOf({ text: checkRuleNameOf({ check }) });
159
- if (names === void 0) {
160
- return {
161
- outcome: "failed",
162
- error: { kind: "check-rule-missing", ruleId: checkRuleIdOf({ check }) }
163
- };
164
- }
165
- const location = { ...request, ...names, mechanism: ESLINT_MECHANISM, ruleSetRoot: installRoot };
166
- const pieceFile = namedPiecePathOf(location);
167
- const piece = readNamedPiece(location);
168
- if (piece.outcome === "failed") {
169
- const { error } = piece;
170
- return error.kind === "file-malformed" || error.kind === "file-unreadable" ? {
171
- outcome: "failed",
172
- error: {
173
- kind: error.kind === "file-malformed" ? "piece-source-invalid" : "piece-unreadable",
174
- pieceFile,
175
- detail: error.detail
176
- }
177
- } : {
178
- outcome: "failed",
179
- error: { kind: "check-rule-missing", ruleId: checkRuleIdOf({ check }) }
180
- };
181
- }
182
- const settings = eslintPieceSettingsSchema.safeParse(piece.value.settings);
183
- if (!settings.success) {
184
- return {
185
- outcome: "failed",
186
- error: { kind: "piece-source-invalid", pieceFile, detail: z4.prettifyError(settings.error) }
187
- };
188
- }
189
- const { pluginModule, rule: ruleName } = settings.data;
190
- const path = request.path.join({ segments: [piece.value.pieceRoot, pluginModule] });
191
- const loaded = await request.modules.load({ path });
192
- if (loaded.outcome === "failed") {
193
- return {
194
- outcome: "failed",
195
- error: { kind: "plugin-unloadable", path: loaded.error.path, detail: loaded.error.detail }
196
- };
197
- }
198
- const exported = moduleExportsSchema.safeParse(loaded.value);
199
- return exported.success ? {
200
- outcome: "ok",
201
- value: { check, pieceFile, pluginModule, ruleName, plugin: exported.data.default }
202
- } : {
203
- outcome: "failed",
204
- error: {
205
- kind: "plugin-invalid",
206
- pieceFile,
207
- pluginModule,
208
- detail: z4.prettifyError(exported.error)
209
- }
210
- };
211
- };
212
- var honePluginAt = async (request) => {
213
- const eslint = request.checks.filter(
214
- (check) => runsOnEslint({ check }) === "eslint" && check.clause.ruleSet === TOOL_IDENTITY.ownRuleSet
215
- );
216
- const sources = gatheredOutcomes({
217
- outcomes: await Promise.all(
218
- eslint.map(
219
- async (check) => listedOutcome({ outcome: await pieceSourceOf({ ...request, check }) })
220
- )
221
- )
222
- });
223
- return sources.outcome === "failed" ? sources : checksPluginOf({ sources: sources.value, boundary: request.boundary });
224
- };
225
- var honePluginFailureText = (request) => {
226
- const failure = request.failure;
227
- switch (failure.kind) {
228
- case "piece-unreadable":
229
- return `the piece ${failure.pieceFile} cannot be read: ${failure.detail}`;
230
- case "piece-source-invalid":
231
- return `the piece ${failure.pieceFile} is not an ESLint piece: ${failure.detail}`;
232
- case "plugin-unloadable":
233
- return `the plugin module ${failure.path} cannot be loaded: ${failure.detail}`;
234
- case "plugin-invalid":
235
- return `the plugin module ${failure.pluginModule} of the piece ${failure.pieceFile} is not an ESLint plugin: ${failure.detail}`;
236
- case "piece-rule-missing":
237
- return `the piece ${failure.pieceFile} runs the rule ${failure.rule}, which its plugin module does not hold`;
238
- case "check-rule-missing":
239
- return `the check ${failure.ruleId} runs on ESLint, but no piece of this install holds its rule`;
240
- }
241
- };
242
-
243
36
  // src/infrastructure/engines/eslint/runner/toolchain/eslint-instance.ts
244
- import { z as z6 } from "zod";
37
+ import { z as z3 } from "zod";
245
38
 
246
39
  // src/infrastructure/engines/eslint/runner/native-exceptions/inline-config-parser.ts
247
40
  import { ConfigCommentParser } from "@eslint/plugin-kit";
@@ -284,19 +77,39 @@ var parseInlineConfigComment = (request) => {
284
77
  }
285
78
  };
286
79
 
80
+ // src/infrastructure/engines/eslint/runner/pieces/eslint-plugin-schema.ts
81
+ import { z } from "zod";
82
+ var ruleVisitorSchema = z.record(
83
+ z.string(),
84
+ z.function({ input: z.array(z.unknown()), output: z.unknown() })
85
+ );
86
+ var ruleSchema = z.looseObject({
87
+ meta: z.looseObject({
88
+ type: z.enum(["problem", "suggestion", "layout"]),
89
+ messages: z.record(z.string(), z.string()).optional()
90
+ }),
91
+ create: z.function({ input: [z.unknown()], output: ruleVisitorSchema })
92
+ });
93
+ var eslintPluginModuleSchema = z.object({
94
+ default: z.looseObject({ rules: z.record(z.string(), ruleSchema) })
95
+ });
96
+ var inlineConfigNodesSchema = z.array(
97
+ z.looseObject({ type: z.enum(["Line", "Block"]), value: z.string() })
98
+ );
99
+
287
100
  // src/infrastructure/engines/eslint/runner/toolchain/eslint-config-schema.ts
288
- import { z as z5 } from "zod";
289
- var resolvedConfigSchema = z5.union([
290
- z5.undefined(),
291
- z5.looseObject({
292
- rules: z5.record(
293
- z5.string(),
294
- z5.tuple([z5.union([z5.literal(0), z5.literal(1), z5.literal(2)])], z5.unknown())
101
+ import { z as z2 } from "zod";
102
+ var resolvedConfigSchema = z2.union([
103
+ z2.undefined(),
104
+ z2.looseObject({
105
+ rules: z2.record(
106
+ z2.string(),
107
+ z2.tuple([z2.union([z2.literal(0), z2.literal(1), z2.literal(2)])], z2.unknown())
295
108
  ).optional(),
296
- plugins: z5.record(z5.string(), z5.unknown()).optional(),
297
- language: z5.unknown().optional(),
298
- processor: z5.unknown().optional(),
299
- languageOptions: z5.looseObject({ parser: z5.unknown().optional() }).optional()
109
+ plugins: z2.record(z2.string(), z2.unknown()).optional(),
110
+ language: z2.unknown().optional(),
111
+ processor: z2.unknown().optional(),
112
+ languageOptions: z2.looseObject({ parser: z2.unknown().optional() }).optional()
300
113
  })
301
114
  ]);
302
115
  var ruleStateOf = (request) => {
@@ -462,7 +275,7 @@ var resolvedRuleState = (request) => {
462
275
  if (!parsed.success) {
463
276
  return {
464
277
  outcome: "failed",
465
- error: { kind: "runner-invalid-output", detail: z6.prettifyError(parsed.error) }
278
+ error: { kind: "runner-invalid-output", detail: z3.prettifyError(parsed.error) }
466
279
  };
467
280
  }
468
281
  return { outcome: "ok", value: ruleStateOf({ resolved: parsed.data, ruleId: request.ruleId }) };
@@ -652,9 +465,6 @@ var createEslintOn = (request) => (create) => {
652
465
  };
653
466
  };
654
467
 
655
- // src/infrastructure/engines/eslint/runner/toolchain/eslint-toolchain.ts
656
- import { z as z7 } from "zod";
657
-
658
468
  // import("./**/*/eslint-*-boundary.ts") in src/infrastructure/engines/eslint/runner/toolchain/eslint-toolchain.ts
659
469
  var globImport_eslint_boundary_ts = __glob({
660
470
  "./eslint-10/eslint-10-boundary.ts": () => import("./eslint-10-boundary-A4JIQ734.js"),
@@ -685,11 +495,11 @@ var defaultEslintToolchainModules = {
685
495
  typescriptParser: () => import("@typescript-eslint/parser"),
686
496
  typescriptEslintPlugin: () => import("@typescript-eslint/eslint-plugin")
687
497
  };
688
- var boundaryModuleSchema = z7.object({
689
- eslintBoundary: z7.object({
690
- nearestLookup: z7.object({ flags: z7.array(z7.string()) }),
691
- declarationText: z7.string(),
692
- reportDataOf: z7.custom(
498
+ var boundaryModuleSchema = z4.object({
499
+ eslintBoundary: z4.object({
500
+ nearestLookup: z4.object({ flags: z4.array(z4.string()) }),
501
+ declarationText: z4.string(),
502
+ reportDataOf: z4.custom(
693
503
  (candidate) => typeof candidate === "function"
694
504
  )
695
505
  })
@@ -705,7 +515,7 @@ var eslintBoundaryFor = async (request) => {
705
515
  const boundary = boundaryModuleSchema.safeParse(loaded);
706
516
  return boundary.success ? { outcome: "ok", value: boundary.data.eslintBoundary } : {
707
517
  outcome: "failed",
708
- error: `the ESLint ${major} boundary is malformed: ${z7.prettifyError(boundary.error)}`
518
+ error: `the ESLint ${major} boundary is malformed: ${z4.prettifyError(boundary.error)}`
709
519
  };
710
520
  };
711
521
  var installedEslintBoundary = () => defaultEslintToolchainModules.eslint().then((installed) => eslintBoundaryFor({ version: installed.ESLint.version }));
@@ -800,24 +610,219 @@ var loadEslintToolchain = (request) => {
800
610
  );
801
611
  };
802
612
 
613
+ // src/infrastructure/engines/eslint/runner/hone-plugin/hone-plugin.ts
614
+ import { z as z7 } from "zod";
615
+
616
+ // src/infrastructure/engines/eslint/runner/pieces/eslint-piece-settings-schema.ts
617
+ import { z as z5 } from "zod";
618
+ var pieceModulePathSchema = z5.string().superRefine((text, context) => {
619
+ if (isRepoPathText({ text }) === "not-repo-path" || moduleFileForm({ text }) === "not-module-file") {
620
+ context.addIssue({
621
+ code: "custom",
622
+ message: "not a path inside the piece folder ending in .ts, or .js in a built install"
623
+ });
624
+ }
625
+ });
626
+ var pluginNamespaceSchema = z5.string().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/);
627
+ var ruleOptionsSchema = z5.array(z5.json()).readonly();
628
+ var optionsByEditionSchema = z5.record(z5.string(), ruleOptionsSchema).transform((options) => new Map(Object.entries(options))).pipe(z5.map(editionSchema, ruleOptionsSchema)).readonly();
629
+ var eslintPieceSettingsSchema = z5.strictObject({
630
+ pluginNamespace: pluginNamespaceSchema,
631
+ pluginModule: pieceModulePathSchema,
632
+ rule: z5.string(),
633
+ options: ruleOptionsSchema.optional(),
634
+ optionsByEdition: optionsByEditionSchema.optional()
635
+ }).readonly();
636
+ var ruleOptionsOf = (request) => {
637
+ const { settings, edition } = request;
638
+ const reached = [...settings.optionsByEdition ?? []].filter(([introducedIn]) => editionReaches({ edition, introducedIn }) === "reached").reduce((latest, candidate) => {
639
+ if (latest === void 0) return candidate;
640
+ return editionReaches({ edition: candidate[0], introducedIn: latest[0] }) === "reached" ? candidate : latest;
641
+ }, void 0);
642
+ return reached?.[1] ?? settings.options ?? [];
643
+ };
644
+
645
+ // src/infrastructure/engines/eslint/runner/hone-plugin/check-rule-id.ts
646
+ var CHECKS_PLUGIN_NAMESPACE = TOOL_IDENTITY.ownRuleSet;
647
+ var ESLINT_MECHANISM = "eslint";
648
+ var RULE_ID_PREFIX = `${CHECKS_PLUGIN_NAMESPACE}/`;
649
+ var checkRuleNameOf = (request) => checkAddressTextOf(request);
650
+ var checkRuleIdOf = (request) => `${RULE_ID_PREFIX}${checkRuleNameOf(request)}`;
651
+ var runsOnEslint = (request) => request.check.engines.some((engine) => engine.name === ESLINT_MECHANISM) ? "eslint" : "elsewhere";
652
+ var eslintRuleIdsOf = (request) => request.checks.filter((check) => runsOnEslint({ check }) === "eslint").map((check) => checkRuleIdOf({ check }));
653
+
654
+ // src/infrastructure/engines/eslint/runner/hone-plugin/checks-plugin.ts
655
+ import { z as z6 } from "zod";
656
+ var PLUGIN_META = { name: `${TOOL_IDENTITY.packageName}/eslint-plugin`, version: "0.0.0-local" };
657
+ var NUMBERED_LEAD = /^CD-\d+: /;
658
+ var inSymptomWords = (request) => `${request.title}: ${request.message.replace(NUMBERED_LEAD, "")}`;
659
+ var unnumbered = (request) => typeof request.text === "string" ? request.text.replace(NUMBERED_LEAD, "") : request.text;
660
+ var reportInSymptomWords = (request) => {
661
+ const reportData = request.boundary.reportDataOf({ descriptor: request.descriptor });
662
+ return reportData === void 0 ? request.descriptor : {
663
+ ...request.descriptor,
664
+ data: Object.fromEntries(
665
+ Object.entries(reportData).map(([key, text]) => [key, unnumbered({ text })])
666
+ )
667
+ };
668
+ };
669
+ var contextInSymptomWords = (request) => Object.create(request.context, {
670
+ report: {
671
+ value: (descriptor) => request.context.report(reportInSymptomWords({ descriptor, boundary: request.boundary }))
672
+ }
673
+ });
674
+ var messagesInSymptomWords = (request) => request.messages === void 0 ? void 0 : Object.fromEntries(
675
+ Object.entries(request.messages).map(([messageId, message]) => [
676
+ messageId,
677
+ inSymptomWords({ message, title: request.title })
678
+ ])
679
+ );
680
+ var checkRuleOf = (request) => ({
681
+ meta: {
682
+ ...request.rule.meta,
683
+ messages: messagesInSymptomWords({
684
+ messages: request.rule.meta.messages,
685
+ title: request.title
686
+ })
687
+ },
688
+ create: (context) => request.rule.create(contextInSymptomWords({ context, boundary: request.boundary }))
689
+ });
690
+ var namedRuleOf = (request) => {
691
+ const { check, pieceFile, pluginModule, ruleName } = request.source;
692
+ const plugin = eslintPluginModuleSchema.safeParse({ default: request.source.plugin });
693
+ if (!plugin.success) {
694
+ return {
695
+ outcome: "failed",
696
+ error: {
697
+ kind: "plugin-invalid",
698
+ pieceFile,
699
+ pluginModule,
700
+ detail: z6.prettifyError(plugin.error)
701
+ }
702
+ };
703
+ }
704
+ const { rules } = plugin.data.default;
705
+ const rule = Object.hasOwn(rules, ruleName) ? rules[ruleName] : void 0;
706
+ return rule === void 0 ? { outcome: "failed", error: { kind: "piece-rule-missing", pieceFile, rule: ruleName } } : {
707
+ outcome: "ok",
708
+ value: [
709
+ checkRuleNameOf({ check }),
710
+ checkRuleOf({ rule, title: check.symptom.title, boundary: request.boundary })
711
+ ]
712
+ };
713
+ };
714
+ var checksPluginOf = (request) => {
715
+ const rules = everyOk({
716
+ entries: request.sources,
717
+ resolve: (source) => namedRuleOf({ source, boundary: request.boundary })
718
+ });
719
+ return rules.outcome === "failed" ? rules : { outcome: "ok", value: { meta: PLUGIN_META, rules: Object.fromEntries(rules.value) } };
720
+ };
721
+
722
+ // src/infrastructure/engines/eslint/runner/hone-plugin/hone-plugin.ts
723
+ var moduleExportsSchema = z7.looseObject({ default: z7.unknown() });
724
+ var pieceSourceOf = async (request) => {
725
+ const { check, installRoot } = request;
726
+ const names = checkNamesOf({ text: checkRuleNameOf({ check }) });
727
+ if (names === void 0) {
728
+ return {
729
+ outcome: "failed",
730
+ error: { kind: "check-rule-missing", ruleId: checkRuleIdOf({ check }) }
731
+ };
732
+ }
733
+ const location = { ...request, ...names, mechanism: ESLINT_MECHANISM, ruleSetRoot: installRoot };
734
+ const pieceFile = namedPiecePathOf(location);
735
+ const piece = readNamedPiece(location);
736
+ if (piece.outcome === "failed") {
737
+ const { error } = piece;
738
+ return error.kind === "file-malformed" || error.kind === "file-unreadable" ? {
739
+ outcome: "failed",
740
+ error: {
741
+ kind: error.kind === "file-malformed" ? "piece-source-invalid" : "piece-unreadable",
742
+ pieceFile,
743
+ detail: error.detail
744
+ }
745
+ } : {
746
+ outcome: "failed",
747
+ error: { kind: "check-rule-missing", ruleId: checkRuleIdOf({ check }) }
748
+ };
749
+ }
750
+ const settings = eslintPieceSettingsSchema.safeParse(piece.value.settings);
751
+ if (!settings.success) {
752
+ return {
753
+ outcome: "failed",
754
+ error: { kind: "piece-source-invalid", pieceFile, detail: z7.prettifyError(settings.error) }
755
+ };
756
+ }
757
+ const { pluginModule, rule: ruleName } = settings.data;
758
+ const path = request.path.join({ segments: [piece.value.pieceRoot, pluginModule] });
759
+ const loaded = await request.modules.load({ path });
760
+ if (loaded.outcome === "failed") {
761
+ return {
762
+ outcome: "failed",
763
+ error: { kind: "plugin-unloadable", path: loaded.error.path, detail: loaded.error.detail }
764
+ };
765
+ }
766
+ const exported = moduleExportsSchema.safeParse(loaded.value);
767
+ return exported.success ? {
768
+ outcome: "ok",
769
+ value: { check, pieceFile, pluginModule, ruleName, plugin: exported.data.default }
770
+ } : {
771
+ outcome: "failed",
772
+ error: {
773
+ kind: "plugin-invalid",
774
+ pieceFile,
775
+ pluginModule,
776
+ detail: z7.prettifyError(exported.error)
777
+ }
778
+ };
779
+ };
780
+ var honePluginAt = async (request) => {
781
+ const eslint = request.checks.filter((check) => runsOnEslint({ check }) === "eslint");
782
+ const sources = gatheredOutcomes({
783
+ outcomes: await Promise.all(
784
+ eslint.map(
785
+ async (check) => listedOutcome({ outcome: await pieceSourceOf({ ...request, check }) })
786
+ )
787
+ )
788
+ });
789
+ return sources.outcome === "failed" ? sources : checksPluginOf({ sources: sources.value, boundary: request.boundary });
790
+ };
791
+ var honePluginFailureText = (request) => {
792
+ const failure = request.failure;
793
+ switch (failure.kind) {
794
+ case "piece-unreadable":
795
+ return `the piece ${failure.pieceFile} cannot be read: ${failure.detail}`;
796
+ case "piece-source-invalid":
797
+ return `the piece ${failure.pieceFile} is not an ESLint piece: ${failure.detail}`;
798
+ case "plugin-unloadable":
799
+ return `the plugin module ${failure.path} cannot be loaded: ${failure.detail}`;
800
+ case "plugin-invalid":
801
+ return `the plugin module ${failure.pluginModule} of the piece ${failure.pieceFile} is not an ESLint plugin: ${failure.detail}`;
802
+ case "piece-rule-missing":
803
+ return `the piece ${failure.pieceFile} runs the rule ${failure.rule}, which its plugin module does not hold`;
804
+ case "check-rule-missing":
805
+ return `the check ${failure.ruleId} runs on ESLint, but no piece of this install holds its rule`;
806
+ }
807
+ };
808
+
803
809
  export {
810
+ parseInlineConfigComment,
811
+ eslintPluginModuleSchema,
812
+ reservedNamespace,
813
+ INLINE_CONFIG_RULE_ID,
814
+ enabledRuleEntry,
815
+ createEslintPort,
816
+ installedEslintBoundary,
817
+ defaultEslintToolchainPeers,
818
+ loadEslintToolchain,
804
819
  eslintPieceSettingsSchema,
805
820
  ruleOptionsOf,
806
821
  CHECKS_PLUGIN_NAMESPACE,
807
822
  ESLINT_MECHANISM,
808
823
  checkRuleIdOf,
809
824
  runsOnEslint,
810
- checkOfRuleId,
811
825
  eslintRuleIdsOf,
812
- eslintPluginModuleSchema,
813
826
  honePluginAt,
814
- honePluginFailureText,
815
- parseInlineConfigComment,
816
- reservedNamespace,
817
- INLINE_CONFIG_RULE_ID,
818
- enabledRuleEntry,
819
- createEslintPort,
820
- installedEslintBoundary,
821
- defaultEslintToolchainPeers,
822
- loadEslintToolchain
827
+ honePluginFailureText
823
828
  };
@@ -1,9 +1,12 @@
1
+ import {
2
+ withoutParentheses
3
+ } from "./chunk-EBX57Z3V.js";
4
+ import {
5
+ sourceSnippetAt
6
+ } from "./chunk-5AKHEW6V.js";
7
+
1
8
  // src/infrastructure/engines/walker/runner/pieces/cast-shape.ts
2
- var SNIPPET_MAX_LENGTH = 80;
3
- var castSnippetAt = (request) => {
4
- const snippet = request.sourceFile.text.slice(request.position, request.position + SNIPPET_MAX_LENGTH).replace(/\n/g, " ");
5
- return snippet.length === SNIPPET_MAX_LENGTH ? `${snippet}\u2026` : snippet;
6
- };
9
+ var castSnippetAt = (request) => sourceSnippetAt({ source: request.sourceFile.text, position: request.position });
7
10
  var assertionOf = (request) => {
8
11
  const { node, syntaxApi } = request;
9
12
  if (syntaxApi.isAsExpression(node))
@@ -25,13 +28,13 @@ var satisfiesOperand = (request) => {
25
28
  };
26
29
  var wrappedOperand = (request) => {
27
30
  const { node, syntaxApi } = request;
28
- if (syntaxApi.isParenthesizedExpression(node) || syntaxApi.isNonNullExpression(node))
29
- return node.expression;
31
+ if (syntaxApi.isNonNullExpression(node)) return node.expression;
30
32
  return satisfiesOperand({ node, syntaxApi });
31
33
  };
32
34
  var unwrappedExpression = (request) => {
33
- const operand = wrappedOperand(request);
34
- return operand === void 0 ? request.node : unwrappedExpression({ node: operand, syntaxApi: request.syntaxApi });
35
+ const node = withoutParentheses(request);
36
+ const operand = wrappedOperand({ ...request, node });
37
+ return operand === void 0 ? node : unwrappedExpression({ node: operand, syntaxApi: request.syntaxApi });
35
38
  };
36
39
  var unknownTypeOf = (request) => request.typeNode.kind === request.syntaxApi.SyntaxKind.UnknownKeyword ? "unknown" : "other";
37
40
  var constTypeOf = (request) => {
@@ -0,0 +1,41 @@
1
+ import {
2
+ sourceSnippetOf
3
+ } from "./chunk-5AKHEW6V.js";
4
+
5
+ // src/infrastructure/engines/walker/runner/pieces/syntax-node-check.ts
6
+ var syntaxNodeCheck = (request) => ({
7
+ prepare: ({ bindings, repository, syntaxApi }) => ({
8
+ outcome: "ok",
9
+ value: {
10
+ prepareFile: ({ file }) => request.eligibility({ file, testFiles: repository.testFiles }) === "skipped" || bindings.length === 0 ? { outcome: "ok", value: { kind: "skipped" } } : {
11
+ outcome: "ok",
12
+ value: {
13
+ kind: "syntax",
14
+ begin: ({ sourceFile, anchorAt }) => {
15
+ const hits = [];
16
+ return {
17
+ enter: ({ node }) => {
18
+ const sight = request.found({ syntaxApi, node, sourceFile });
19
+ if (sight === void 0) return;
20
+ const anchor = anchorAt({ position: sight.at.getStart(sourceFile) });
21
+ hits.push(
22
+ ...bindings.map(({ address }) => ({
23
+ check: address,
24
+ anchor,
25
+ snippet: sourceSnippetOf(sight.snippet)
26
+ }))
27
+ );
28
+ },
29
+ finish: () => hits
30
+ };
31
+ }
32
+ }
33
+ },
34
+ finish: () => ({ outcome: "ok", value: [] })
35
+ }
36
+ })
37
+ });
38
+
39
+ export {
40
+ syntaxNodeCheck
41
+ };