@shivaedev/quality 0.76.0 → 0.77.0

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 (613) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +65 -59
  3. package/dist/adapters/biome/pluginContract.d.ts +1 -1
  4. package/dist/adapters/biome/pluginContract.d.ts.map +1 -1
  5. package/dist/adapters/biome/pluginContract.js +2 -5
  6. package/dist/adapters/biome/pluginContract.js.map +1 -1
  7. package/dist/adapters/biome/run.d.ts.map +1 -1
  8. package/dist/adapters/biome/run.js +2 -0
  9. package/dist/adapters/biome/run.js.map +1 -1
  10. package/dist/adapters/biome/withExceptionConfig.d.ts.map +1 -1
  11. package/dist/adapters/biome/withExceptionConfig.js +21 -4
  12. package/dist/adapters/biome/withExceptionConfig.js.map +1 -1
  13. package/dist/adapters/changeKeyCheck.d.ts +10 -0
  14. package/dist/adapters/changeKeyCheck.d.ts.map +1 -0
  15. package/dist/adapters/{changeKeyFindings.js → changeKeyCheck.js} +8 -22
  16. package/dist/adapters/changeKeyCheck.js.map +1 -0
  17. package/dist/adapters/commandLine.d.ts +2 -0
  18. package/dist/adapters/commandLine.d.ts.map +1 -1
  19. package/dist/adapters/contextCaptureCheck.d.ts +9 -0
  20. package/dist/adapters/contextCaptureCheck.d.ts.map +1 -0
  21. package/dist/adapters/contextCaptureCheck.js +91 -0
  22. package/dist/adapters/contextCaptureCheck.js.map +1 -0
  23. package/dist/adapters/databaseUrlFindings.d.ts +1 -1
  24. package/dist/adapters/databaseUrlFindings.d.ts.map +1 -1
  25. package/dist/adapters/declaration-files/initialize.d.ts +6 -0
  26. package/dist/adapters/declaration-files/initialize.d.ts.map +1 -0
  27. package/dist/adapters/declaration-files/initialize.js +4 -0
  28. package/dist/adapters/declaration-files/initialize.js.map +1 -0
  29. package/dist/adapters/declaration-files/parse.d.ts +5 -0
  30. package/dist/adapters/declaration-files/parse.d.ts.map +1 -0
  31. package/dist/adapters/declaration-files/parse.js +6 -0
  32. package/dist/adapters/declaration-files/parse.js.map +1 -0
  33. package/dist/adapters/declaration-files/reader.d.ts +5 -0
  34. package/dist/adapters/declaration-files/reader.d.ts.map +1 -0
  35. package/dist/adapters/declaration-files/reader.js +23 -0
  36. package/dist/adapters/declaration-files/reader.js.map +1 -0
  37. package/dist/adapters/declaration-files/service.d.ts +9 -0
  38. package/dist/adapters/declaration-files/service.d.ts.map +1 -0
  39. package/dist/adapters/declaration-files/service.js +14 -0
  40. package/dist/adapters/declaration-files/service.js.map +1 -0
  41. package/dist/adapters/foreignResources.d.ts.map +1 -1
  42. package/dist/adapters/foreignResources.js +0 -4
  43. package/dist/adapters/foreignResources.js.map +1 -1
  44. package/dist/adapters/import-compiler/graph.d.ts +8 -2
  45. package/dist/adapters/import-compiler/graph.d.ts.map +1 -1
  46. package/dist/adapters/import-compiler/graph.js +4 -1
  47. package/dist/adapters/import-compiler/graph.js.map +1 -1
  48. package/dist/adapters/import-compiler/service.d.ts +7 -1
  49. package/dist/adapters/import-compiler/service.d.ts.map +1 -1
  50. package/dist/adapters/imports/graph.d.ts +6 -3
  51. package/dist/adapters/imports/graph.d.ts.map +1 -1
  52. package/dist/adapters/imports/graph.js +31 -18
  53. package/dist/adapters/imports/graph.js.map +1 -1
  54. package/dist/adapters/knip/configuration.d.ts +1 -1
  55. package/dist/adapters/knip/configuration.d.ts.map +1 -1
  56. package/dist/adapters/knip/configuration.js +6 -4
  57. package/dist/adapters/knip/configuration.js.map +1 -1
  58. package/dist/adapters/knip/entryPointFindings.d.ts +1 -1
  59. package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
  60. package/dist/adapters/knip/run.d.ts.map +1 -1
  61. package/dist/adapters/knip/run.js +4 -1
  62. package/dist/adapters/knip/run.js.map +1 -1
  63. package/dist/adapters/outsideImportFindings.d.ts +4 -2
  64. package/dist/adapters/outsideImportFindings.d.ts.map +1 -1
  65. package/dist/adapters/outsideImportFindings.js +12 -52
  66. package/dist/adapters/outsideImportFindings.js.map +1 -1
  67. package/dist/adapters/queueReadoutFindings.d.ts +1 -1
  68. package/dist/adapters/queueReadoutFindings.d.ts.map +1 -1
  69. package/dist/adapters/rule.d.ts +9 -1
  70. package/dist/adapters/rule.d.ts.map +1 -1
  71. package/dist/adapters/rule.js +21 -6
  72. package/dist/adapters/rule.js.map +1 -1
  73. package/dist/adapters/runMain.d.ts +3 -4
  74. package/dist/adapters/runMain.d.ts.map +1 -1
  75. package/dist/adapters/runMain.js +2 -1
  76. package/dist/adapters/runMain.js.map +1 -1
  77. package/dist/adapters/serviceModelCheck.d.ts +9 -0
  78. package/dist/adapters/serviceModelCheck.d.ts.map +1 -0
  79. package/dist/adapters/{serviceModelFindings.js → serviceModelCheck.js} +9 -23
  80. package/dist/adapters/serviceModelCheck.js.map +1 -0
  81. package/dist/adapters/sharedErrorCatalog.d.ts +13 -0
  82. package/dist/adapters/sharedErrorCatalog.d.ts.map +1 -0
  83. package/dist/adapters/sharedErrorCatalog.js +28 -0
  84. package/dist/adapters/sharedErrorCatalog.js.map +1 -0
  85. package/dist/adapters/sharedErrorModules.d.ts +1 -1
  86. package/dist/adapters/sharedErrorModules.d.ts.map +1 -1
  87. package/dist/adapters/sharedErrorModules.js.map +1 -1
  88. package/dist/adapters/specReaderSources.d.ts +3 -2
  89. package/dist/adapters/specReaderSources.d.ts.map +1 -1
  90. package/dist/adapters/specReaderSources.js +6 -3
  91. package/dist/adapters/specReaderSources.js.map +1 -1
  92. package/dist/adapters/storyProgram.d.ts +2 -0
  93. package/dist/adapters/storyProgram.d.ts.map +1 -1
  94. package/dist/adapters/storyProgram.js +13 -3
  95. package/dist/adapters/storyProgram.js.map +1 -1
  96. package/dist/adapters/typeScriptProgram.d.ts +5 -0
  97. package/dist/adapters/typeScriptProgram.d.ts.map +1 -0
  98. package/dist/adapters/typeScriptProgram.js +43 -0
  99. package/dist/adapters/typeScriptProgram.js.map +1 -0
  100. package/dist/baseline/compare.d.ts +2 -0
  101. package/dist/baseline/compare.d.ts.map +1 -1
  102. package/dist/baseline/compare.js +43 -17
  103. package/dist/baseline/compare.js.map +1 -1
  104. package/dist/baseline/format.d.ts +1 -0
  105. package/dist/baseline/format.d.ts.map +1 -1
  106. package/dist/baseline/format.js +6 -2
  107. package/dist/baseline/format.js.map +1 -1
  108. package/dist/baseline/merge.d.ts.map +1 -1
  109. package/dist/baseline/merge.js +14 -1
  110. package/dist/baseline/merge.js.map +1 -1
  111. package/dist/baseline/rewrite.d.ts.map +1 -1
  112. package/dist/baseline/rewrite.js +3 -1
  113. package/dist/baseline/rewrite.js.map +1 -1
  114. package/dist/baseline/update.d.ts +7 -0
  115. package/dist/baseline/update.d.ts.map +1 -1
  116. package/dist/baseline/update.js +29 -8
  117. package/dist/baseline/update.js.map +1 -1
  118. package/dist/biome/exceptionConfig.d.ts +3 -0
  119. package/dist/biome/exceptionConfig.d.ts.map +1 -1
  120. package/dist/biome/exceptionConfig.js +15 -1
  121. package/dist/biome/exceptionConfig.js.map +1 -1
  122. package/dist/biome/scannerRules.d.ts +3 -0
  123. package/dist/biome/scannerRules.d.ts.map +1 -0
  124. package/dist/biome/scannerRules.js +42 -0
  125. package/dist/biome/scannerRules.js.map +1 -0
  126. package/dist/cli/args.d.ts +2 -0
  127. package/dist/cli/args.d.ts.map +1 -1
  128. package/dist/cli/args.js +10 -1
  129. package/dist/cli/args.js.map +1 -1
  130. package/dist/cli/baseline.d.ts.map +1 -1
  131. package/dist/cli/baseline.js +5 -1
  132. package/dist/cli/baseline.js.map +1 -1
  133. package/dist/cli/lint.d.ts +3 -2
  134. package/dist/cli/lint.d.ts.map +1 -1
  135. package/dist/cli/lint.js +13 -5
  136. package/dist/cli/lint.js.map +1 -1
  137. package/dist/cli/misplaced.d.ts +6 -0
  138. package/dist/cli/misplaced.d.ts.map +1 -1
  139. package/dist/cli/misplaced.js +4 -2
  140. package/dist/cli/misplaced.js.map +1 -1
  141. package/dist/cli/program.js +1 -1
  142. package/dist/cli/program.js.map +1 -1
  143. package/dist/cli/runSet.d.ts +5 -0
  144. package/dist/cli/runSet.d.ts.map +1 -0
  145. package/dist/cli/runSet.js +15 -0
  146. package/dist/cli/runSet.js.map +1 -0
  147. package/dist/cli/shrink.d.ts +4 -4
  148. package/dist/cli/shrink.d.ts.map +1 -1
  149. package/dist/cli/shrink.js.map +1 -1
  150. package/dist/cli/usage.d.ts +1 -1
  151. package/dist/cli/usage.d.ts.map +1 -1
  152. package/dist/cli/usage.js +7 -2
  153. package/dist/cli/usage.js.map +1 -1
  154. package/dist/config/decode.d.ts +1 -0
  155. package/dist/config/decode.d.ts.map +1 -1
  156. package/dist/config/decode.js +1 -0
  157. package/dist/config/decode.js.map +1 -1
  158. package/dist/config/load.d.ts +2 -0
  159. package/dist/config/load.d.ts.map +1 -1
  160. package/dist/config/load.js +1 -0
  161. package/dist/config/load.js.map +1 -1
  162. package/dist/config/resolve.d.ts +2 -1
  163. package/dist/config/resolve.d.ts.map +1 -1
  164. package/dist/config/resolve.js +9 -4
  165. package/dist/config/resolve.js.map +1 -1
  166. package/dist/config.d.ts +2 -0
  167. package/dist/config.d.ts.map +1 -1
  168. package/dist/config.js.map +1 -1
  169. package/dist/engine/childStarted.d.ts +4 -0
  170. package/dist/engine/childStarted.d.ts.map +1 -0
  171. package/dist/engine/childStarted.js +7 -0
  172. package/dist/engine/childStarted.js.map +1 -0
  173. package/dist/engine/evaluate.d.ts +1 -0
  174. package/dist/engine/evaluate.d.ts.map +1 -1
  175. package/dist/engine/evaluate.js +2 -1
  176. package/dist/engine/evaluate.js.map +1 -1
  177. package/dist/engine/runRule.d.ts +21 -0
  178. package/dist/engine/runRule.d.ts.map +1 -0
  179. package/dist/engine/runRule.js +70 -0
  180. package/dist/engine/runRule.js.map +1 -0
  181. package/dist/engine/runRules.d.ts +5 -12
  182. package/dist/engine/runRules.d.ts.map +1 -1
  183. package/dist/engine/runRules.js +49 -65
  184. package/dist/engine/runRules.js.map +1 -1
  185. package/dist/engine/session.d.ts +2 -1
  186. package/dist/engine/session.d.ts.map +1 -1
  187. package/dist/engine/session.js +20 -6
  188. package/dist/engine/session.js.map +1 -1
  189. package/dist/engine/violation.d.ts +7 -0
  190. package/dist/engine/violation.d.ts.map +1 -1
  191. package/dist/engine/violation.js +9 -0
  192. package/dist/engine/violation.js.map +1 -1
  193. package/dist/exceptions/biomeFindings.d.ts +5 -1
  194. package/dist/exceptions/biomeFindings.d.ts.map +1 -1
  195. package/dist/exceptions/biomeFindings.js +17 -18
  196. package/dist/exceptions/biomeFindings.js.map +1 -1
  197. package/dist/exceptions/registry.d.ts.map +1 -1
  198. package/dist/exceptions/registry.js +2 -2
  199. package/dist/exceptions/registry.js.map +1 -1
  200. package/dist/hooks/preCommit.d.ts +1 -2
  201. package/dist/hooks/preCommit.d.ts.map +1 -1
  202. package/dist/hooks/preCommit.js +11 -1
  203. package/dist/hooks/preCommit.js.map +1 -1
  204. package/dist/hooks/stagedCheck.d.ts +5 -0
  205. package/dist/hooks/stagedCheck.d.ts.map +1 -0
  206. package/dist/hooks/stagedCheck.js +43 -0
  207. package/dist/hooks/stagedCheck.js.map +1 -0
  208. package/dist/hooks/withStagedContent.d.ts +5 -0
  209. package/dist/hooks/withStagedContent.d.ts.map +1 -0
  210. package/dist/hooks/withStagedContent.js +84 -0
  211. package/dist/hooks/withStagedContent.js.map +1 -0
  212. package/dist/imports/browserGlobals.d.ts +1 -1
  213. package/dist/imports/browserGlobals.d.ts.map +1 -1
  214. package/dist/imports/browserNames.d.ts +1 -1
  215. package/dist/imports/browserNames.d.ts.map +1 -1
  216. package/dist/imports/browserNames.js +5 -3
  217. package/dist/imports/browserNames.js.map +1 -1
  218. package/dist/imports/fences/check.d.ts +1 -1
  219. package/dist/imports/fences/check.d.ts.map +1 -1
  220. package/dist/imports/fences/compilePolicy.js +1 -1
  221. package/dist/imports/fences/compilePolicy.js.map +1 -1
  222. package/dist/imports/fences/evaluate.d.ts +1 -1
  223. package/dist/imports/fences/evaluate.d.ts.map +1 -1
  224. package/dist/imports/fences/evaluate.js +1 -1
  225. package/dist/imports/fences/evaluate.js.map +1 -1
  226. package/dist/imports/graph.d.ts +6 -1
  227. package/dist/imports/graph.d.ts.map +1 -1
  228. package/dist/imports/graph.js +30 -2
  229. package/dist/imports/graph.js.map +1 -1
  230. package/dist/imports/withoutGenerated.js +1 -1
  231. package/dist/imports/withoutGenerated.js.map +1 -1
  232. package/dist/inventory/programmaticBuilds.d.ts +1 -1
  233. package/dist/inventory/programmaticBuilds.d.ts.map +1 -1
  234. package/dist/inventory/trackedPaths.d.ts +1 -0
  235. package/dist/inventory/trackedPaths.d.ts.map +1 -1
  236. package/dist/inventory/trackedPaths.js +9 -3
  237. package/dist/inventory/trackedPaths.js.map +1 -1
  238. package/dist/naming/testCode.d.ts +1 -1
  239. package/dist/naming/testCode.d.ts.map +1 -1
  240. package/dist/report/render.d.ts +1 -0
  241. package/dist/report/render.d.ts.map +1 -1
  242. package/dist/report/render.js +10 -3
  243. package/dist/report/render.js.map +1 -1
  244. package/dist/report/runSetLine.d.ts +3 -0
  245. package/dist/report/runSetLine.d.ts.map +1 -0
  246. package/dist/report/runSetLine.js +13 -0
  247. package/dist/report/runSetLine.js.map +1 -0
  248. package/dist/report/staleSections.d.ts.map +1 -1
  249. package/dist/report/staleSections.js +13 -0
  250. package/dist/report/staleSections.js.map +1 -1
  251. package/dist/rule.d.ts +30 -4
  252. package/dist/rule.d.ts.map +1 -1
  253. package/dist/rule.js +4 -2
  254. package/dist/rule.js.map +1 -1
  255. package/dist/rules/biome.d.ts +18 -1
  256. package/dist/rules/biome.d.ts.map +1 -1
  257. package/dist/rules/biome.js +32 -7
  258. package/dist/rules/biome.js.map +1 -1
  259. package/dist/rules/builtIn.d.ts +8 -8
  260. package/dist/rules/builtIn.d.ts.map +1 -1
  261. package/dist/rules/builtIn.js +0 -2
  262. package/dist/rules/builtIn.js.map +1 -1
  263. package/dist/rules/effect/adapterImports.d.ts +1 -1
  264. package/dist/rules/effect/adapterImports.d.ts.map +1 -1
  265. package/dist/rules/effect/adapterImports.js +1 -1
  266. package/dist/rules/effect/adapterImports.js.map +1 -1
  267. package/dist/rules/effect/boundary.d.ts +1 -1
  268. package/dist/rules/effect/boundary.d.ts.map +1 -1
  269. package/dist/rules/effect/boundary.js +60 -75
  270. package/dist/rules/effect/boundary.js.map +1 -1
  271. package/dist/rules/effect/boundaryFindings.d.ts +4 -0
  272. package/dist/rules/effect/boundaryFindings.d.ts.map +1 -0
  273. package/dist/rules/effect/boundaryFindings.js +63 -0
  274. package/dist/rules/effect/boundaryFindings.js.map +1 -0
  275. package/dist/rules/effect/boundaryReference.d.ts +4 -0
  276. package/dist/rules/effect/boundaryReference.d.ts.map +1 -1
  277. package/dist/rules/effect/boundaryReference.js +6 -3
  278. package/dist/rules/effect/boundaryReference.js.map +1 -1
  279. package/dist/rules/effect/contextCapture.d.ts.map +1 -1
  280. package/dist/rules/effect/contextCapture.js +3 -2
  281. package/dist/rules/effect/contextCapture.js.map +1 -1
  282. package/dist/rules/effect/errorTags.d.ts +10 -0
  283. package/dist/rules/effect/errorTags.d.ts.map +1 -0
  284. package/dist/rules/effect/errorTags.js +57 -0
  285. package/dist/rules/effect/errorTags.js.map +1 -0
  286. package/dist/rules/effect/failureHonesty.d.ts +1 -1
  287. package/dist/rules/effect/failureHonesty.d.ts.map +1 -1
  288. package/dist/rules/effect/failureHonesty.js +6 -5
  289. package/dist/rules/effect/failureHonesty.js.map +1 -1
  290. package/dist/rules/effect/policy.d.ts +1 -1
  291. package/dist/rules/effect/policy.d.ts.map +1 -1
  292. package/dist/rules/effect/policy.js +0 -2
  293. package/dist/rules/effect/policy.js.map +1 -1
  294. package/dist/rules/effect/promiseBridge.d.ts +3 -0
  295. package/dist/rules/effect/promiseBridge.d.ts.map +1 -0
  296. package/dist/rules/effect/promiseBridge.js +60 -0
  297. package/dist/rules/effect/promiseBridge.js.map +1 -0
  298. package/dist/rules/effect/rpcBoundary.d.ts.map +1 -1
  299. package/dist/rules/effect/rpcBoundary.js +92 -3
  300. package/dist/rules/effect/rpcBoundary.js.map +1 -1
  301. package/dist/rules/effect/serviceModel.d.ts.map +1 -1
  302. package/dist/rules/effect/serviceModel.js +3 -2
  303. package/dist/rules/effect/serviceModel.js.map +1 -1
  304. package/dist/rules/effect/serviceParameterCheck.d.ts +7 -0
  305. package/dist/rules/effect/serviceParameterCheck.d.ts.map +1 -0
  306. package/dist/rules/effect/serviceParameterCheck.js +15 -0
  307. package/dist/rules/effect/serviceParameterCheck.js.map +1 -0
  308. package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
  309. package/dist/rules/effect/serviceParameters.js +4 -36
  310. package/dist/rules/effect/serviceParameters.js.map +1 -1
  311. package/dist/rules/effect/sharedErrorClasses.d.ts.map +1 -1
  312. package/dist/rules/effect/sharedErrorClasses.js +31 -2
  313. package/dist/rules/effect/sharedErrorClasses.js.map +1 -1
  314. package/dist/rules/effect/workspaceProgram.d.ts +5 -0
  315. package/dist/rules/effect/workspaceProgram.d.ts.map +1 -0
  316. package/dist/rules/effect/workspaceProgram.js +32 -0
  317. package/dist/rules/effect/workspaceProgram.js.map +1 -0
  318. package/dist/rules/imports/adminPaths.d.ts +1 -1
  319. package/dist/rules/imports/adminPaths.d.ts.map +1 -1
  320. package/dist/rules/imports/cycles.d.ts +1 -1
  321. package/dist/rules/imports/cycles.d.ts.map +1 -1
  322. package/dist/rules/imports/fences.d.ts +1 -1
  323. package/dist/rules/imports/fences.d.ts.map +1 -1
  324. package/dist/rules/imports/manifest.d.ts +1 -1
  325. package/dist/rules/imports/manifest.d.ts.map +1 -1
  326. package/dist/rules/imports/noTestCode.d.ts +1 -1
  327. package/dist/rules/imports/noTestCode.d.ts.map +1 -1
  328. package/dist/rules/imports/runtime.d.ts +1 -1
  329. package/dist/rules/imports/runtime.d.ts.map +1 -1
  330. package/dist/rules/imports/runtime.js +32 -5
  331. package/dist/rules/imports/runtime.js.map +1 -1
  332. package/dist/rules/manifestsNoTestKits.js +1 -1
  333. package/dist/rules/manifestsNoTestKits.js.map +1 -1
  334. package/dist/rules/maxLines.d.ts +1 -1
  335. package/dist/rules/maxLines.d.ts.map +1 -1
  336. package/dist/rules/packageFindings.d.ts +31 -0
  337. package/dist/rules/packageFindings.d.ts.map +1 -0
  338. package/dist/rules/packageFindings.js +65 -0
  339. package/dist/rules/packageFindings.js.map +1 -0
  340. package/dist/rules/parse.d.ts +4 -1
  341. package/dist/rules/parse.d.ts.map +1 -1
  342. package/dist/rules/parse.js +35 -2
  343. package/dist/rules/parse.js.map +1 -1
  344. package/dist/rules/rootedFindings.d.ts +5 -0
  345. package/dist/rules/rootedFindings.d.ts.map +1 -0
  346. package/dist/rules/rootedFindings.js +16 -0
  347. package/dist/rules/rootedFindings.js.map +1 -0
  348. package/dist/rules/stories/adapterOnlyFakes.d.ts +1 -1
  349. package/dist/rules/stories/adapterOnlyFakes.d.ts.map +1 -1
  350. package/dist/rules/stories/adapterOnlyFakes.js +1 -0
  351. package/dist/rules/stories/adapterOnlyFakes.js.map +1 -1
  352. package/dist/rules/stories/databaseUrl.d.ts +1 -1
  353. package/dist/rules/stories/databaseUrl.d.ts.map +1 -1
  354. package/dist/rules/stories/databaseUrl.js +1 -0
  355. package/dist/rules/stories/databaseUrl.js.map +1 -1
  356. package/dist/rules/stories/domainOutcomes.d.ts +1 -1
  357. package/dist/rules/stories/domainOutcomes.d.ts.map +1 -1
  358. package/dist/rules/stories/domainOutcomes.js +1 -0
  359. package/dist/rules/stories/domainOutcomes.js.map +1 -1
  360. package/dist/rules/stories/engine.d.ts +1 -1
  361. package/dist/rules/stories/engine.d.ts.map +1 -1
  362. package/dist/rules/stories/engine.js +1 -0
  363. package/dist/rules/stories/engine.js.map +1 -1
  364. package/dist/rules/stories/globalRetries.d.ts +1 -1
  365. package/dist/rules/stories/globalRetries.d.ts.map +1 -1
  366. package/dist/rules/stories/globalRetries.js +1 -0
  367. package/dist/rules/stories/globalRetries.js.map +1 -1
  368. package/dist/rules/stories/groupedOutcomes.d.ts +1 -1
  369. package/dist/rules/stories/groupedOutcomes.d.ts.map +1 -1
  370. package/dist/rules/stories/groupedOutcomes.js +1 -0
  371. package/dist/rules/stories/groupedOutcomes.js.map +1 -1
  372. package/dist/rules/stories/importedChangeKeys.js +2 -2
  373. package/dist/rules/stories/importedChangeKeys.js.map +1 -1
  374. package/dist/rules/stories/namedValues.d.ts +1 -1
  375. package/dist/rules/stories/namedValues.d.ts.map +1 -1
  376. package/dist/rules/stories/namedValues.js +1 -0
  377. package/dist/rules/stories/namedValues.js.map +1 -1
  378. package/dist/rules/stories/noExpect.d.ts +1 -1
  379. package/dist/rules/stories/noExpect.d.ts.map +1 -1
  380. package/dist/rules/stories/noLimitImports.d.ts +1 -1
  381. package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
  382. package/dist/rules/stories/noLimitImports.js +1 -0
  383. package/dist/rules/stories/noLimitImports.js.map +1 -1
  384. package/dist/rules/stories/positiveRefusals.d.ts +1 -1
  385. package/dist/rules/stories/positiveRefusals.d.ts.map +1 -1
  386. package/dist/rules/stories/positiveRefusals.js +1 -0
  387. package/dist/rules/stories/positiveRefusals.js.map +1 -1
  388. package/dist/rules/stories/queueReadouts.d.ts +1 -1
  389. package/dist/rules/stories/queueReadouts.d.ts.map +1 -1
  390. package/dist/rules/stories/queueReadouts.js +1 -0
  391. package/dist/rules/stories/queueReadouts.js.map +1 -1
  392. package/dist/rules/stories/sources.d.ts +2 -2
  393. package/dist/rules/stories/sources.d.ts.map +1 -1
  394. package/dist/rules/stories/specHelpers.d.ts +1 -1
  395. package/dist/rules/stories/specHelpers.d.ts.map +1 -1
  396. package/dist/rules/stories/specHelpers.js +3 -2
  397. package/dist/rules/stories/specHelpers.js.map +1 -1
  398. package/dist/rules/stories/specs.d.ts +1 -1
  399. package/dist/rules/stories/specs.d.ts.map +1 -1
  400. package/dist/rules/stories/specs.js +1 -0
  401. package/dist/rules/stories/specs.js.map +1 -1
  402. package/dist/rules/stories/waitOnEvents.d.ts +1 -1
  403. package/dist/rules/stories/waitOnEvents.d.ts.map +1 -1
  404. package/dist/rules/stories/waitOnEvents.js +3 -3
  405. package/dist/rules/stories/waitOnEvents.js.map +1 -1
  406. package/dist/rules/suppressions/noDoubleCast.d.ts.map +1 -1
  407. package/dist/rules/suppressions/noDoubleCast.js +4 -49
  408. package/dist/rules/suppressions/noDoubleCast.js.map +1 -1
  409. package/dist/rules/suppressions/typedCastCheck.d.ts +10 -0
  410. package/dist/rules/suppressions/typedCastCheck.d.ts.map +1 -0
  411. package/dist/rules/suppressions/typedCastCheck.js +48 -0
  412. package/dist/rules/suppressions/typedCastCheck.js.map +1 -0
  413. package/dist/rules/unusedCode.d.ts.map +1 -1
  414. package/dist/rules/unusedCode.js +1 -0
  415. package/dist/rules/unusedCode.js.map +1 -1
  416. package/dist/testing/adapters/cli.d.ts +1 -0
  417. package/dist/testing/adapters/cli.d.ts.map +1 -1
  418. package/dist/testing/adapters/cli.js +10 -8
  419. package/dist/testing/adapters/cli.js.map +1 -1
  420. package/dist/testing/adapters/git.d.ts +1 -16
  421. package/dist/testing/adapters/git.d.ts.map +1 -1
  422. package/dist/testing/adapters/git.js +5 -10
  423. package/dist/testing/adapters/git.js.map +1 -1
  424. package/dist/testing/adapters/hookRepository.d.ts +3 -2
  425. package/dist/testing/adapters/hookRepository.d.ts.map +1 -1
  426. package/dist/testing/adapters/hookRepository.js +11 -8
  427. package/dist/testing/adapters/hookRepository.js.map +1 -1
  428. package/dist/testing/adapters/imports.d.ts.map +1 -1
  429. package/dist/testing/adapters/imports.js +4 -1
  430. package/dist/testing/adapters/imports.js.map +1 -1
  431. package/dist/testing/ruleStory.d.ts +1 -1
  432. package/dist/testing/ruleStory.js +2 -2
  433. package/dist/testing/ruleStory.js.map +1 -1
  434. package/docs/debt-and-hooks.md +5 -3
  435. package/package.json +19 -19
  436. package/src/adapters/biome/pluginContract.ts +2 -5
  437. package/src/adapters/biome/run.ts +2 -0
  438. package/src/adapters/biome/withExceptionConfig.ts +26 -5
  439. package/src/adapters/{changeKeyFindings.ts → changeKeyCheck.ts} +8 -24
  440. package/src/adapters/contextCaptureCheck.ts +106 -0
  441. package/src/adapters/declaration-files/initialize.ts +4 -0
  442. package/src/adapters/declaration-files/parse.ts +9 -0
  443. package/src/adapters/declaration-files/reader.ts +28 -0
  444. package/src/adapters/declaration-files/service.ts +16 -0
  445. package/src/adapters/foreignResources.ts +0 -4
  446. package/src/adapters/import-compiler/graph.ts +7 -2
  447. package/src/adapters/imports/graph.ts +43 -18
  448. package/src/adapters/knip/configuration.ts +6 -4
  449. package/src/adapters/knip/run.ts +4 -1
  450. package/src/adapters/outsideImportFindings.ts +21 -65
  451. package/src/adapters/rule.ts +29 -6
  452. package/src/adapters/runMain.ts +7 -6
  453. package/src/adapters/{serviceModelFindings.ts → serviceModelCheck.ts} +10 -25
  454. package/src/adapters/sharedErrorCatalog.ts +43 -0
  455. package/src/adapters/sharedErrorModules.ts +1 -1
  456. package/src/adapters/specReaderSources.ts +6 -3
  457. package/src/adapters/storyProgram.ts +20 -3
  458. package/src/adapters/typeScriptProgram.ts +57 -0
  459. package/src/baseline/compare.ts +59 -19
  460. package/src/baseline/format.ts +7 -2
  461. package/src/baseline/merge.ts +15 -1
  462. package/src/baseline/rewrite.ts +3 -1
  463. package/src/baseline/update.ts +38 -8
  464. package/src/biome/exceptionConfig.ts +24 -3
  465. package/src/biome/scannerRules.ts +42 -0
  466. package/src/cli/args.ts +13 -2
  467. package/src/cli/baseline.ts +7 -1
  468. package/src/cli/lint.ts +14 -6
  469. package/src/cli/misplaced.ts +4 -2
  470. package/src/cli/program.ts +1 -1
  471. package/src/cli/runSet.ts +17 -0
  472. package/src/cli/shrink.ts +4 -11
  473. package/src/cli/usage.ts +7 -2
  474. package/src/config/decode.ts +1 -0
  475. package/src/config/load.ts +3 -0
  476. package/src/config/resolve.ts +11 -6
  477. package/src/config.ts +3 -0
  478. package/src/engine/childStarted.ts +8 -0
  479. package/src/engine/evaluate.ts +3 -1
  480. package/src/engine/runRule.ts +103 -0
  481. package/src/engine/runRules.ts +64 -86
  482. package/src/engine/session.ts +23 -5
  483. package/src/engine/violation.ts +16 -0
  484. package/src/exceptions/biomeFindings.ts +24 -21
  485. package/src/exceptions/registry.ts +2 -2
  486. package/src/hooks/preCommit.ts +15 -1
  487. package/src/hooks/stagedCheck.ts +54 -0
  488. package/src/hooks/withStagedContent.ts +111 -0
  489. package/src/imports/browserNames.ts +7 -5
  490. package/src/imports/fences/compilePolicy.ts +1 -1
  491. package/src/imports/fences/evaluate.ts +2 -2
  492. package/src/imports/graph.ts +47 -3
  493. package/src/imports/withoutGenerated.ts +1 -1
  494. package/src/inventory/trackedPaths.ts +10 -3
  495. package/src/report/render.ts +12 -3
  496. package/src/report/runSetLine.ts +14 -0
  497. package/src/report/staleSections.ts +14 -0
  498. package/src/rule.ts +38 -7
  499. package/src/rules/biome.ts +53 -7
  500. package/src/rules/builtIn.ts +0 -2
  501. package/src/rules/effect/adapterImports.ts +1 -1
  502. package/src/rules/effect/boundary.ts +82 -83
  503. package/src/rules/effect/boundaryFindings.ts +71 -0
  504. package/src/rules/effect/boundaryReference.ts +7 -3
  505. package/src/rules/effect/contextCapture.ts +3 -2
  506. package/src/rules/effect/errorTags.ts +72 -0
  507. package/src/rules/effect/failureHonesty.ts +9 -5
  508. package/src/rules/effect/policy.ts +0 -2
  509. package/src/rules/effect/promiseBridge.ts +65 -0
  510. package/src/rules/effect/rpcBoundary.ts +111 -4
  511. package/src/rules/effect/serviceModel.ts +3 -2
  512. package/src/rules/effect/serviceParameterCheck.ts +22 -0
  513. package/src/rules/effect/serviceParameters.ts +5 -37
  514. package/src/rules/effect/sharedErrorClasses.ts +41 -3
  515. package/src/rules/effect/workspaceProgram.ts +34 -0
  516. package/src/rules/imports/runtime.ts +43 -6
  517. package/src/rules/manifestsNoTestKits.ts +1 -1
  518. package/src/rules/packageFindings.ts +103 -0
  519. package/src/rules/parse.ts +54 -3
  520. package/src/rules/rootedFindings.ts +19 -0
  521. package/src/rules/stories/adapterOnlyFakes.ts +1 -0
  522. package/src/rules/stories/databaseUrl.ts +1 -0
  523. package/src/rules/stories/domainOutcomes.ts +1 -0
  524. package/src/rules/stories/engine.ts +1 -0
  525. package/src/rules/stories/globalRetries.ts +1 -0
  526. package/src/rules/stories/groupedOutcomes.ts +1 -0
  527. package/src/rules/stories/importedChangeKeys.ts +2 -2
  528. package/src/rules/stories/namedValues.ts +1 -0
  529. package/src/rules/stories/noLimitImports.ts +1 -0
  530. package/src/rules/stories/positiveRefusals.ts +1 -0
  531. package/src/rules/stories/queueReadouts.ts +1 -0
  532. package/src/rules/stories/specHelpers.ts +8 -5
  533. package/src/rules/stories/specs.ts +1 -0
  534. package/src/rules/stories/waitOnEvents.ts +6 -3
  535. package/src/rules/suppressions/noDoubleCast.ts +5 -55
  536. package/src/rules/suppressions/typedCastCheck.ts +55 -0
  537. package/src/rules/unusedCode.ts +1 -0
  538. package/src/testing/adapters/cli.ts +13 -9
  539. package/src/testing/adapters/git.ts +6 -11
  540. package/src/testing/adapters/hookRepository.ts +12 -7
  541. package/src/testing/adapters/imports.ts +4 -1
  542. package/src/testing/ruleStory.ts +2 -2
  543. package/dist/adapters/biome/presetConfig.d.ts +0 -21
  544. package/dist/adapters/biome/presetConfig.d.ts.map +0 -1
  545. package/dist/adapters/biome/presetConfig.js +0 -32
  546. package/dist/adapters/biome/presetConfig.js.map +0 -1
  547. package/dist/adapters/changeKeyFindings.d.ts +0 -4
  548. package/dist/adapters/changeKeyFindings.d.ts.map +0 -1
  549. package/dist/adapters/changeKeyFindings.js.map +0 -1
  550. package/dist/adapters/contextCaptureFindings.d.ts +0 -4
  551. package/dist/adapters/contextCaptureFindings.d.ts.map +0 -1
  552. package/dist/adapters/contextCaptureFindings.js +0 -51
  553. package/dist/adapters/contextCaptureFindings.js.map +0 -1
  554. package/dist/adapters/nativeTransactionFindings.d.ts +0 -4
  555. package/dist/adapters/nativeTransactionFindings.d.ts.map +0 -1
  556. package/dist/adapters/nativeTransactionFindings.js +0 -98
  557. package/dist/adapters/nativeTransactionFindings.js.map +0 -1
  558. package/dist/adapters/rpcBoundaryFindings.d.ts +0 -4
  559. package/dist/adapters/rpcBoundaryFindings.d.ts.map +0 -1
  560. package/dist/adapters/rpcBoundaryFindings.js +0 -90
  561. package/dist/adapters/rpcBoundaryFindings.js.map +0 -1
  562. package/dist/adapters/serviceModelFindings.d.ts +0 -4
  563. package/dist/adapters/serviceModelFindings.d.ts.map +0 -1
  564. package/dist/adapters/serviceModelFindings.js.map +0 -1
  565. package/dist/adapters/sharedErrorFindings.d.ts +0 -4
  566. package/dist/adapters/sharedErrorFindings.d.ts.map +0 -1
  567. package/dist/adapters/sharedErrorFindings.js +0 -71
  568. package/dist/adapters/sharedErrorFindings.js.map +0 -1
  569. package/dist/adapters/transactionChanges.d.ts +0 -3
  570. package/dist/adapters/transactionChanges.d.ts.map +0 -1
  571. package/dist/adapters/transactionChanges.js +0 -81
  572. package/dist/adapters/transactionChanges.js.map +0 -1
  573. package/dist/adapters/vitePort.d.ts +0 -2
  574. package/dist/adapters/vitePort.d.ts.map +0 -1
  575. package/dist/adapters/vitePort.js +0 -5
  576. package/dist/adapters/vitePort.js.map +0 -1
  577. package/dist/appTestConfig.d.ts +0 -4
  578. package/dist/appTestConfig.d.ts.map +0 -1
  579. package/dist/appTestConfig.js +0 -9
  580. package/dist/appTestConfig.js.map +0 -1
  581. package/dist/appViteConfig.d.ts +0 -23
  582. package/dist/appViteConfig.d.ts.map +0 -1
  583. package/dist/appViteConfig.js +0 -17
  584. package/dist/appViteConfig.js.map +0 -1
  585. package/dist/biome/recommendedRules.d.ts +0 -3
  586. package/dist/biome/recommendedRules.d.ts.map +0 -1
  587. package/dist/biome/recommendedRules.js +0 -20
  588. package/dist/biome/recommendedRules.js.map +0 -1
  589. package/dist/rules/effect/program.d.ts +0 -8
  590. package/dist/rules/effect/program.d.ts.map +0 -1
  591. package/dist/rules/effect/program.js +0 -53
  592. package/dist/rules/effect/program.js.map +0 -1
  593. package/dist/rules/effect/sqlTransact.d.ts +0 -2
  594. package/dist/rules/effect/sqlTransact.d.ts.map +0 -1
  595. package/dist/rules/effect/sqlTransact.js +0 -9
  596. package/dist/rules/effect/sqlTransact.js.map +0 -1
  597. package/dist/rules/suppressions/biomeRecommended.d.ts +0 -7
  598. package/dist/rules/suppressions/biomeRecommended.d.ts.map +0 -1
  599. package/dist/rules/suppressions/biomeRecommended.js +0 -47
  600. package/dist/rules/suppressions/biomeRecommended.js.map +0 -1
  601. package/src/adapters/biome/presetConfig.ts +0 -34
  602. package/src/adapters/contextCaptureFindings.ts +0 -60
  603. package/src/adapters/nativeTransactionFindings.ts +0 -108
  604. package/src/adapters/rpcBoundaryFindings.ts +0 -98
  605. package/src/adapters/sharedErrorFindings.ts +0 -84
  606. package/src/adapters/transactionChanges.ts +0 -85
  607. package/src/adapters/vitePort.ts +0 -5
  608. package/src/appTestConfig.ts +0 -10
  609. package/src/appViteConfig.ts +0 -24
  610. package/src/biome/recommendedRules.ts +0 -27
  611. package/src/rules/effect/program.ts +0 -57
  612. package/src/rules/effect/sqlTransact.ts +0 -10
  613. package/src/rules/suppressions/biomeRecommended.ts +0 -60
@@ -1,99 +1,78 @@
1
- import { basename, isAbsolute, relative } from "node:path";
2
- import { Effect } from "effect";
3
- import { ManifestFailure } from "#adapters/manifestInventory.ts";
4
- import { inNonEffectFolder } from "#config/nonEffectFolders.ts";
5
- import type { ActiveLevel, Violation } from "#engine/violation.ts";
6
- import { SetupFailure } from "#failure.ts";
7
- import { FilesystemFailure } from "#inventory/filesystem.ts";
8
- import { posix } from "#inventory/ignoreScope.ts";
9
- import type { Finding, RuleCheck, RuleInputs, RuleServices } from "#rule.ts";
1
+ import { Deferred, Effect, Fiber } from "effect";
2
+ import { withStoryProgram } from "#adapters/storyProgram.ts";
3
+ import { ChildStarted } from "#engine/childStarted.ts";
4
+ import { type ActiveRule, runRule } from "#engine/runRule.ts";
5
+ import type { Violation } from "#engine/violation.ts";
6
+ import type { SetupFailure } from "#failure.ts";
7
+ import type { RuleInputs, RuleServices } from "#rule.ts";
8
+ import { PACKAGE_CHECKS, withPackageWalk } from "#rules/packageFindings.ts";
9
+ import { withSharedTrees } from "#rules/parse.ts";
10
10
 
11
- export interface ActiveRule {
12
- readonly check: RuleCheck;
13
- readonly description: string;
14
- readonly family: boolean;
15
- readonly id: string;
16
- readonly level: ActiveLevel;
17
- readonly registrable?: boolean;
18
- }
11
+ type RuleRun = Effect.Effect<readonly Violation[], SetupFailure, RuleServices>;
19
12
 
20
- function messageOf(cause: unknown): string {
21
- return cause instanceof Error ? cause.message : String(cause);
13
+ function spawnsChild(rule: ActiveRule): boolean {
14
+ return rule.needs === "child-process";
22
15
  }
23
16
 
24
- // Registry and baseline entries match on the path, so every finding names its file the same way.
25
- function repositoryPath(root: string, file: string): string {
26
- return posix(isAbsolute(file) ? relative(root, file) : file).replace(/^(?:\.\/)+/u, "");
27
- }
17
+ const launched = Effect.fn("Engine.launched")(function* (child: RuleRun) {
18
+ const running = yield* Deferred.make<void>();
19
+ const fiber = yield* Effect.forkChild(Effect.provideService(child, ChildStarted, Deferred.succeed(running, undefined).pipe(Effect.asVoid)));
20
+ return { fiber, started: Effect.raceFirst(Deferred.await(running), Fiber.await(fiber)) };
21
+ });
28
22
 
29
- function exceptionHint(rule: ActiveRule, finding: Finding, file: string, config: string): string {
30
- const id = rule.family && finding.subject !== undefined ? `${rule.id}/${finding.subject}` : rule.id;
31
- const biome = /^biome\/(?:lint|assist)\/[a-zA-Z]+\/[a-zA-Z]+$/u.test(id);
32
- if (!biome && rule.registrable === false) {
33
- return "";
34
- }
35
- const shape = JSON.stringify({
36
- files: [file],
37
- reason: "Explain why this exception is permanent.",
38
- rules: [id],
39
- ...(!rule.family && finding.subject !== undefined ? { subject: finding.subject } : {}),
40
- });
41
- return ` For a permanent exception, add to exceptions in ${config}: ${shape}.`;
23
+ function readsStories(rule: ActiveRule): boolean {
24
+ return rule.needs === "story-program";
42
25
  }
43
26
 
44
- function violationOf(rule: ActiveRule, root: string, finding: Finding, exceptionFile: string): Violation {
45
- return {
46
- ...finding,
47
- file: repositoryPath(root, finding.file),
48
- level: rule.level,
49
- message: finding.message + exceptionHint(rule, finding, repositoryPath(root, finding.file), exceptionFile),
50
- rule: rule.family && finding.subject !== undefined ? `${rule.id}/${finding.subject}` : rule.id,
51
- };
27
+ // A full run checks a rule's deep half as a run of its own in the deep tier; only that half reads the package walk.
28
+ function runsOf(rule: ActiveRule, skippedHalves: ReadonlySet<string>): readonly ActiveRule[] {
29
+ const { deepHalf, ...whole } = rule;
30
+ return deepHalf === undefined || skippedHalves.has(rule.id) ? [rule] : [rule, { ...whole, check: deepHalf.check, depth: "deep", half: "deep" }];
52
31
  }
53
32
 
54
- function expectedFailure(rule: ActiveRule, root: string, cause: unknown): readonly Violation[] | undefined {
55
- if (cause instanceof ManifestFailure || cause instanceof FilesystemFailure) {
56
- const manifest = cause instanceof ManifestFailure || basename(cause.path) === "package.json";
57
- return [
58
- {
59
- file: repositoryPath(root, cause.path),
60
- level: rule.level,
61
- message: cause.message,
62
- rule: manifest ? "manifests/valid" : rule.id,
63
- },
64
- ];
65
- }
66
- return undefined;
33
+ function walks(rule: ActiveRule): boolean {
34
+ return PACKAGE_CHECKS.has(rule.id) && rule.deepHalf === undefined;
67
35
  }
68
36
 
69
- function runRule(rule: ActiveRule, inputs: RuleInputs, exceptionFile: string): Effect.Effect<readonly Violation[], SetupFailure, RuleServices> {
70
- return Effect.suspend(() => rule.check(inputs)).pipe(
71
- Effect.map((findings) =>
72
- findings
73
- .filter(
74
- (finding) =>
75
- !(rule.id.startsWith("effect/") && inNonEffectFolder(repositoryPath(inputs.root, finding.file), inputs.nonEffectFolders ?? [])),
76
- )
77
- .map((finding) => violationOf(rule, inputs.root, finding, exceptionFile)),
37
+ // Rules share one Node thread, so only the Biome and Knip child processes run beside the other rules, started first because synchronous rules would starve their preparation; a check that never reports its child as started finishes first. Each type-checker program, the package walk's included, is built alone.
38
+ // The rules that read the story program, which spans every source, run one after another so the run drops it after the last of them; they and the program share one tree per source, which goes with the program because keeping the trees for every rule raised the peak.
39
+ function runTiers(rules: readonly ActiveRule[], inputs: RuleInputs): RuleRun {
40
+ function run(rule: ActiveRule): RuleRun {
41
+ return runRule(rule, inputs, inputs.configFile ?? "quality.config.ts");
42
+ }
43
+ const walked = rules.filter(walks);
44
+ const inThread = rules.filter((rule) => !(walks(rule) || spawnsChild(rule) || readsStories(rule)));
45
+ const stories = rules.filter(readsStories).map(run);
46
+ const told =
47
+ stories.length === 0 ? [] : [Effect.map(withSharedTrees(inputs, withStoryProgram(inputs, Effect.all(stories))), (found) => found.flat())];
48
+ const fast = [...inThread.filter((rule) => rule.depth === "fast").map(run), ...told];
49
+ const deep = inThread.filter((rule) => rule.depth === "deep").map(run);
50
+ function lanes(thread: readonly RuleRun[]): RuleRun {
51
+ return Effect.gen(function* () {
52
+ const children = yield* Effect.forEach(rules.filter(spawnsChild).map(run), launched);
53
+ yield* Effect.forEach(children, ({ started }) => started, { concurrency: "unbounded" });
54
+ const inOrder = yield* Effect.all(thread);
55
+ return [...(yield* Effect.forEach(children, ({ fiber }) => Fiber.join(fiber))).flat(), ...inOrder.flat()];
56
+ });
57
+ }
58
+ if (walked.length === 0) {
59
+ return lanes([...fast, ...deep]);
60
+ }
61
+ return withPackageWalk(inputs, new Set(walked.map((rule) => rule.id)), (walk) =>
62
+ Effect.map(
63
+ Effect.all([lanes([Effect.as(walk, []), ...fast, ...deep]), Effect.all(walked.map(run), { concurrency: "unbounded" })], {
64
+ concurrency: "unbounded",
65
+ }),
66
+ ([laned, waited]) => [...laned, ...waited.flat()],
78
67
  ),
79
- Effect.catch((cause) => {
80
- const findings = expectedFailure(rule, inputs.root, cause);
81
- if (findings !== undefined) {
82
- return Effect.succeed(findings);
83
- }
84
- if (cause instanceof SetupFailure) {
85
- return Effect.fail(new SetupFailure({ cause, message: `rule ${rule.id} failed: ${cause.message}` }));
86
- }
87
- return Effect.die(cause);
88
- }),
89
- Effect.catchDefect((cause) => {
90
- const findings = expectedFailure(rule, inputs.root, cause);
91
- return findings === undefined ? Effect.die(new Error(`rule ${rule.id} failed: ${messageOf(cause)}`, { cause })) : Effect.succeed(findings);
92
- }),
93
68
  );
94
69
  }
95
70
 
96
- export const runRules = Effect.fn("Engine.runRules")(function* (rules: readonly ActiveRule[], inputs: RuleInputs) {
71
+ export const runRules = Effect.fn("Engine.runRules")(function* (
72
+ rules: readonly ActiveRule[],
73
+ inputs: RuleInputs,
74
+ skippedHalves: ReadonlySet<string> = new Set(),
75
+ ) {
97
76
  const validation = rules.find((rule) => rule.id === "manifests/valid");
98
77
  if (validation !== undefined) {
99
78
  const failures = yield* runRule(validation, inputs, inputs.configFile ?? "quality.config.ts");
@@ -101,13 +80,12 @@ export const runRules = Effect.fn("Engine.runRules")(function* (rules: readonly
101
80
  return failures;
102
81
  }
103
82
  }
104
- const results = yield* Effect.forEach(
105
- rules.filter((rule) => rule !== validation),
106
- (rule) => runRule(rule, inputs, inputs.configFile ?? "quality.config.ts"),
107
- { concurrency: 2 },
83
+ const results = yield* runTiers(
84
+ rules.filter((rule) => rule !== validation).flatMap((rule) => runsOf(rule, skippedHalves)),
85
+ inputs,
108
86
  );
109
87
  const seen = new Set<string>();
110
- return results.flat().filter((finding) => {
88
+ return results.filter((finding) => {
111
89
  if (finding.rule !== "manifests/valid") {
112
90
  return true;
113
91
  }
@@ -2,11 +2,12 @@ import * as NodePath from "@effect/platform-node/NodePath";
2
2
  import { Effect, Path } from "effect";
3
3
  import { setManifestFiles } from "#adapters/manifestInventory.ts";
4
4
  import { manifestReader } from "#adapters/manifestReader.ts";
5
+ import { typeScriptProgram } from "#adapters/typeScriptProgram.ts";
5
6
  import { loadConfig, type ResolvedConfig } from "#config/load.ts";
6
7
  import { type BaselineFile, readBaseline, readInput } from "#engine/baselineFile.ts";
7
8
  import { runRules } from "#engine/runRules.ts";
8
9
  import type { Violation } from "#engine/violation.ts";
9
- import { staleBiomeExceptions } from "#exceptions/biomeFindings.ts";
10
+ import { biomeExceptions } from "#exceptions/biomeFindings.ts";
10
11
  import type { RegistryEntry, StaleRegistryEntry } from "#exceptions/registry.ts";
11
12
  import { registryEntries } from "#exceptions/registryEntries.ts";
12
13
  import { SetupFailure } from "#failure.ts";
@@ -45,17 +46,34 @@ export const scan = Effect.fn("Engine.scan")(function* (
45
46
  readText,
46
47
  root: config.root,
47
48
  sources: inventory.sources,
49
+ typeScript: yield* typeScriptProgram(config.root, inventory.sources),
48
50
  };
49
- const violations = yield* runRules(config.active, inputs);
50
- const staleRegistry = yield* setup(staleBiomeExceptions(inputs));
51
- return { inventory, staleRegistry, violations };
51
+ const { kept, stale } = yield* setup(biomeExceptions(yield* runRules(config.active, inputs, config.skippedHalves), inputs, config.skippedHalves));
52
+ return { inventory, staleRegistry: stale, violations: kept };
52
53
  });
53
54
 
55
+ export type RunSet = "fast" | "full";
56
+
57
+ // A fast run leaves deep rules and deep halves out and sets aside the baseline entries and exceptions it cannot judge.
58
+ function selected(config: ResolvedConfig, set: RunSet): ResolvedConfig {
59
+ if (set === "full") {
60
+ return config;
61
+ }
62
+ const active = config.active.filter((rule) => rule.depth === "fast");
63
+ return {
64
+ ...config,
65
+ active,
66
+ skipped: new Set(config.active.filter((rule) => rule.depth === "deep").map((rule) => rule.id)),
67
+ skippedHalves: new Set(active.filter((rule) => rule.deepHalf !== undefined).map((rule) => rule.id)),
68
+ };
69
+ }
70
+
54
71
  export const openSession = Effect.fn("Engine.openSession")(function* (
55
72
  cwd: string,
56
73
  configPath: string | undefined,
74
+ set: RunSet = "full",
57
75
  ): Effect.fn.Return<Session, SetupFailure, RuleServices> {
58
- const config = yield* loadConfig(cwd, configPath);
76
+ const config = selected(yield* loadConfig(cwd, configPath), set);
59
77
  const selection = configPath === undefined ? "" : ` --config ${configPath}`;
60
78
  for (const path of new Set([config.registry, "quality/registry.json"])) {
61
79
  if ((yield* readInput(config.root, path)) !== undefined) {
@@ -4,6 +4,7 @@ import type { Finding } from "#rule.ts";
4
4
  export type ActiveLevel = "error";
5
5
 
6
6
  export interface Violation extends Finding {
7
+ readonly deep?: true;
7
8
  readonly level: ActiveLevel;
8
9
  readonly rule: string;
9
10
  }
@@ -32,6 +33,9 @@ export function groupBy<TItem>(items: readonly TItem[], key: (item: TItem) => st
32
33
  export interface RuleIndex {
33
34
  readonly families: ReadonlySet<string>;
34
35
  readonly levels: ReadonlyMap<string, Level>;
36
+ readonly skipped: ReadonlySet<string>;
37
+ readonly skippedHalves: ReadonlySet<string>;
38
+ readonly split: ReadonlySet<string>;
35
39
  readonly unregistrable: ReadonlySet<string>;
36
40
  }
37
41
 
@@ -47,6 +51,18 @@ export function levelOf(index: RuleIndex, rule: string): Level | undefined {
47
51
  return index.levels.get(ownerOf(index, rule));
48
52
  }
49
53
 
54
+ export function skipped(index: RuleIndex, rule: string): boolean {
55
+ return index.skipped.has(ownerOf(index, rule));
56
+ }
57
+
58
+ export function halfSkipped(index: RuleIndex, rule: string): boolean {
59
+ return index.skippedHalves.has(ownerOf(index, rule));
60
+ }
61
+
62
+ export function isSplit(index: RuleIndex, rule: string): boolean {
63
+ return index.split.has(ownerOf(index, rule));
64
+ }
65
+
50
66
  export function registrable(index: RuleIndex, rule: string): boolean {
51
67
  return !index.unregistrable.has(ownerOf(index, rule));
52
68
  }
@@ -1,33 +1,36 @@
1
1
  import { Effect } from "effect";
2
- import { biomeReport } from "#biome/report.ts";
3
- import { withoutEntryPointImports } from "#biome/withoutEntryPointImports.ts";
2
+ import { needsScanner } from "#biome/scannerRules.ts";
3
+ import { keyOf, type Violation } from "#engine/violation.ts";
4
4
  import type { StaleRegistryEntry } from "#exceptions/registry.ts";
5
5
  import type { FilesystemFailure } from "#inventory/filesystem.ts";
6
6
  import type { Finding, RuleInputs } from "#rule.ts";
7
7
 
8
- export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")(function* (inputs: RuleInputs) {
9
- const declarations = inputs.exceptions ?? [];
10
- const declared = declarations.flatMap(({ files, reason, rules }) =>
8
+ // The biome rule reports excepted diagnostics at any severity; the session drops them and names each exception that none matched.
9
+ export const biomeExceptions = Effect.fn("Exceptions.biomeExceptions")(function* (
10
+ violations: readonly Violation[],
11
+ inputs: Pick<RuleInputs, "configFile" | "exceptions" | "readText">,
12
+ skippedHalves: ReadonlySet<string>,
13
+ ) {
14
+ const declared = (inputs.exceptions ?? []).flatMap(({ files, reason, rules }) =>
11
15
  rules.filter((rule) => /^biome\/(?:lint|assist)\//u.test(rule)).flatMap((rule) => files.map((file) => ({ file, reason, rule }))),
12
16
  );
17
+ const excepted = new Set(declared.map(({ file, rule }) => keyOf(rule, file)));
18
+ const reported = new Set(violations.map((violation) => keyOf(violation.rule, violation.file)));
13
19
  const texts = yield* Effect.forEach(declared, ({ file }) => inputs.readText(file), { concurrency: "unbounded" });
14
- const entries = declared.filter((_, index) => texts[index] !== undefined);
15
- if (entries.length === 0) {
16
- return [];
17
- }
18
- const exclusions = declarations.flatMap((entry) =>
19
- entry.rules.includes("biome/files/includes") ? [{ ...entry, rules: ["biome/files/includes"] as const }] : [],
20
+ const judged = declared.filter(
21
+ (entry, index) => texts[index] !== undefined && !(skippedHalves.has("biome") && needsScanner(entry.rule.slice("biome/".length))),
20
22
  );
21
- const report = yield* biomeReport(inputs.root, ["check", "--no-errors-on-unmatched"], exclusions, [...new Set(entries.map(({ file }) => file))]);
22
- const diagnostics = yield* withoutEntryPointImports(inputs, report.diagnostics);
23
- return entries
24
- .filter(({ file, rule }) => !diagnostics.some((diagnostic) => diagnostic.location.path === file && `biome/${diagnostic.category}` === rule))
25
- .map(
26
- (entry): StaleRegistryEntry => ({
27
- entry,
28
- problem: `matches no finding. Remove this file/rule pair from exceptions in ${inputs.configFile ?? "quality.config.ts"}`,
29
- }),
30
- );
23
+ return {
24
+ kept: violations.filter((violation) => !excepted.has(keyOf(violation.rule, violation.file))),
25
+ stale: judged
26
+ .filter(({ file, rule }) => !reported.has(keyOf(rule, file)))
27
+ .map(
28
+ (entry): StaleRegistryEntry => ({
29
+ entry,
30
+ problem: `matches no finding. Remove this file/rule pair from exceptions in ${inputs.configFile ?? "quality.config.ts"}`,
31
+ }),
32
+ ),
33
+ };
31
34
  });
32
35
 
33
36
  const missingBiomeFile = Effect.fn("Exceptions.missingBiomeFile")(function* (
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { type Decoded, decodeWith } from "#decoded.ts";
3
- import { type RuleIndex, registrable, unusedEntryProblem, type Violation } from "#engine/violation.ts";
3
+ import { halfSkipped, type RuleIndex, registrable, skipped, unusedEntryProblem, type Violation } from "#engine/violation.ts";
4
4
 
5
5
  const RegistryEntry = Schema.Struct({
6
6
  file: Schema.NonEmptyString,
@@ -50,7 +50,7 @@ export function applyRegistry(violations: readonly Violation[], entries: readonl
50
50
  return entry === undefined;
51
51
  });
52
52
  const stale = entries
53
- .filter((entry) => !used.has(entry))
53
+ .filter((entry) => !(used.has(entry) || (registrable(rules, entry.rule) && (skipped(rules, entry.rule) || halfSkipped(rules, entry.rule)))))
54
54
  .map((entry) => ({
55
55
  entry,
56
56
  problem: registrable(rules, entry.rule) ? unusedEntryProblem(rules, entry.rule, "matches no violation") : UNREGISTRABLE,
@@ -1,5 +1,5 @@
1
1
  import * as NodePath from "@effect/platform-node/NodePath";
2
- import { Console, Effect, Path } from "effect";
2
+ import { Config, Console, Effect, Path } from "effect";
3
3
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
4
4
  import { readPackageManifest } from "#adapters/manifestInventory.ts";
5
5
  import { manifestReader } from "#adapters/manifestReader.ts";
@@ -7,6 +7,7 @@ import { reportLint } from "#cli/lint.ts";
7
7
  import { loadConfig } from "#config/load.ts";
8
8
  import { passes } from "#engine/evaluate.ts";
9
9
  import { GateFailed, SetupFailure } from "#failure.ts";
10
+ import { stagedCheck } from "#hooks/stagedCheck.ts";
10
11
  import { recap } from "#report/recap.ts";
11
12
 
12
13
  const COMMIT_AGAIN =
@@ -43,8 +44,21 @@ const runScript = Effect.fnUntraced(
43
44
  Effect.mapError((error) => new SetupFailure({ cause: error, message: `cannot run a pre-commit script: ${error.message}` })),
44
45
  );
45
46
 
47
+ const inCloudSession = Config.String("CLAUDE_CODE_REMOTE").pipe(
48
+ Config.withDefault(""),
49
+ Config.map((value) => value === "true"),
50
+ );
51
+
46
52
  export const preCommitHook = Effect.fn("Hooks.preCommitHook")(function* (cwd: string, path: string | undefined) {
47
53
  const config = yield* loadConfig(cwd, path);
54
+ const cloud = yield* inCloudSession.pipe(Effect.mapError((cause) => new SetupFailure({ cause, message: "cannot read CLAUDE_CODE_REMOTE." })));
55
+ if (config.preCommit === "staged" && !cloud) {
56
+ if (!(yield* stagedCheck(config))) {
57
+ yield* Console.error(`quality: pre-commit failed: Biome on the staged files.\n${COMMIT_AGAIN}`);
58
+ return yield* new GateFailed();
59
+ }
60
+ return;
61
+ }
48
62
  const { manager, scripts } = yield* commitScripts(config.root);
49
63
  const { context, outcome } = yield* reportLint(cwd, path, true);
50
64
  const linted = passes(outcome);
@@ -0,0 +1,54 @@
1
+ import * as NodePath from "@effect/platform-node/NodePath";
2
+ import { Console, Effect, Path } from "effect";
3
+ import { manifestReader } from "#adapters/manifestReader.ts";
4
+ import { biomeReport } from "#biome/report.ts";
5
+ import type { ResolvedConfig } from "#config/load.ts";
6
+ import { readBaseline } from "#engine/baselineFile.ts";
7
+ import { evaluate, type Outcome, passes } from "#engine/evaluate.ts";
8
+ import type { Violation } from "#engine/violation.ts";
9
+ import { registryEntries } from "#exceptions/registryEntries.ts";
10
+ import { SetupFailure } from "#failure.ts";
11
+ import { gitOrFail } from "#git/command.ts";
12
+ import { withStagedContent } from "#hooks/withStagedContent.ts";
13
+ import { type ReportContext, renderFindings } from "#report/render.ts";
14
+ import { failingFindings } from "#rules/biome.ts";
15
+
16
+ const BIOME = ["check", "--files-ignore-unknown=true", "--no-errors-on-unmatched"];
17
+
18
+ function pathsOf(output: string): readonly string[] {
19
+ return output.split("\0").filter((path) => path !== "");
20
+ }
21
+
22
+ function failed(error: { readonly message: string }): SetupFailure {
23
+ return new SetupFailure({ cause: error, message: error.message });
24
+ }
25
+
26
+ export const stagedCheck = Effect.fn("Hooks.stagedCheck")(function* (config: ResolvedConfig) {
27
+ const { relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
28
+
29
+ const staged = pathsOf(yield* gitOrFail(config.root, ["diff", "--cached", "--name-only", "--relative", "--diff-filter=d", "-z"]));
30
+ const unstaged = new Set(pathsOf(yield* gitOrFail(config.root, ["diff", "--name-only", "--relative", "-z"])));
31
+ const edited = staged.filter((path) => unstaged.has(path));
32
+ yield* Console.log(
33
+ `quality: checking ${staged.length === 1 ? "the staged file" : `the ${staged.length} staged files`} with Biome only, as preCommit is "staged".`,
34
+ );
35
+ const report =
36
+ staged.length === 0
37
+ ? { diagnostics: [] }
38
+ : yield* withStagedContent(config.root, edited, biomeReport(config.root, BIOME, config.exceptions, staged, config.nonEffectFolders)).pipe(
39
+ Effect.mapError(failed),
40
+ );
41
+ const findings = yield* failingFindings({ readText: yield* manifestReader(config.root) }, report.diagnostics).pipe(Effect.mapError(failed));
42
+ const violations = findings.map((finding): Violation => ({ ...finding, level: "error", rule: `biome/${finding.subject ?? "internal"}` }));
43
+ const baseline = yield* readBaseline(config);
44
+ const evaluated = evaluate(violations, registryEntries(config.exceptions), baseline.entries, config);
45
+ const outcome: Outcome = { ...evaluated, looseBaseline: [], staleBaseline: [], staleRegistry: [], unsplitBaseline: [] };
46
+ const context: ReportContext = {
47
+ baseline: config.baseline,
48
+ checked: staged.length,
49
+ descriptions: new Map(config.active.map((rule) => [rule.id, rule.description])),
50
+ registry: config.exceptions.length === 0 ? config.registry : `${relative(config.root, config.file)} exceptions`,
51
+ };
52
+ yield* Console.log(renderFindings(outcome, context));
53
+ return passes(outcome);
54
+ });
@@ -0,0 +1,111 @@
1
+ import * as NodePath from "@effect/platform-node/NodePath";
2
+ import { Console, Effect, FileSystem, Path } from "effect";
3
+ import type { ChildProcessSpawner } from "effect/process";
4
+ import { SetupFailure } from "#failure.ts";
5
+ import { gitOrFail } from "#git/command.ts";
6
+ import { shellWords } from "#hooks/command.ts";
7
+ import { orWhenAbsent } from "#inventory/filesystem.ts";
8
+
9
+ type WorkingCopy =
10
+ | { readonly kind: "absent"; readonly path: string }
11
+ | { readonly blob: string; readonly bytes: Uint8Array; readonly kind: "file"; readonly mode: number; readonly path: string }
12
+ | { readonly kind: "link"; readonly path: string; readonly target: string };
13
+
14
+ function failed(error: { readonly message: string }): SetupFailure {
15
+ return new SetupFailure({ cause: error, message: error.message });
16
+ }
17
+
18
+ function recovery(copy: WorkingCopy): string {
19
+ const path = shellWords([copy.path]);
20
+ switch (copy.kind) {
21
+ case "absent":
22
+ return `rm -f ${path}`;
23
+ case "file":
24
+ return `git cat-file blob ${copy.blob} > ${path} && chmod ${copy.mode.toString(8)} ${path}`;
25
+ case "link":
26
+ return `ln -sfn ${shellWords([copy.target])} ${path}`;
27
+ }
28
+ }
29
+
30
+ function notice(root: string, copies: readonly WorkingCopy[]): string {
31
+ const [only] = copies;
32
+ const intro =
33
+ copies.length === 1 && only !== undefined
34
+ ? `${only.path} changed after staging; Biome checks its staged content in place, then the working copy is put back. If the hook stops first, run this in ${root}:`
35
+ : `${copies.length} files changed after staging; Biome checks their staged content in place, then the working copies are put back. If the hook stops first, run these in ${root}:`;
36
+ return [`quality: ${intro}`, ...copies.map((copy) => ` ${recovery(copy)}`)].join("\n");
37
+ }
38
+
39
+ // The blob outlives a killed hook, so the printed command still recovers the working copy.
40
+ const setAside = Effect.fn("Hooks.setAside")(function* (
41
+ root: string,
42
+ path: string,
43
+ ): Effect.fn.Return<WorkingCopy, SetupFailure, FileSystem.FileSystem | ChildProcessSpawner.ChildProcessSpawner> {
44
+ const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
45
+
46
+ const fs = yield* FileSystem.FileSystem;
47
+ const at = join(root, path);
48
+ const info = yield* orWhenAbsent(at, fs.lstat(at), undefined).pipe(Effect.mapError(failed));
49
+ if (info === undefined) {
50
+ return { kind: "absent", path };
51
+ }
52
+ if (info.type === "SymbolicLink") {
53
+ return { kind: "link", path, target: yield* fs.readLink(at).pipe(Effect.mapError(failed)) };
54
+ }
55
+ if (info.type !== "File") {
56
+ return yield* new SetupFailure({ message: `${path} changed after staging into a ${info.type}, so the staged check cannot set it aside.` });
57
+ }
58
+ const bytes = yield* fs.readFile(at).pipe(Effect.mapError(failed));
59
+ const blob = (yield* gitOrFail(root, ["hash-object", "-w", "--no-filters", "--", path])).trim();
60
+ return { blob, bytes, kind: "file", mode: info.mode & 0o7777, path };
61
+ });
62
+
63
+ const setAsideAll = Effect.fn("Hooks.setAsideAll")(function* (root: string, paths: readonly string[]) {
64
+ const copies = yield* Effect.forEach(paths, (path) => setAside(root, path));
65
+ yield* Console.log(notice(root, copies));
66
+ return copies;
67
+ });
68
+
69
+ const putBack = Effect.fn("Hooks.putBack")(function* (root: string, copy: WorkingCopy) {
70
+ const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
71
+
72
+ const fs = yield* FileSystem.FileSystem;
73
+ const at = join(root, copy.path);
74
+ yield* fs.remove(at, { force: true });
75
+ if (copy.kind === "file") {
76
+ yield* fs.writeFile(at, copy.bytes);
77
+ yield* fs.chmod(at, copy.mode);
78
+ }
79
+ if (copy.kind === "link") {
80
+ yield* fs.symlink(copy.target, at);
81
+ }
82
+ });
83
+
84
+ const restore = Effect.fn("Hooks.restore")(function* (root: string, copies: readonly WorkingCopy[]) {
85
+ const [, failures] = yield* Effect.partition(copies, (copy) => Effect.mapError(putBack(root, copy), (error) => ({ copy, error })));
86
+ if (failures.length === 0) {
87
+ return;
88
+ }
89
+ const lines = failures.map(({ copy, error }) => `quality: cannot put back the working copy of ${copy.path}: ${error.message}\n ${recovery(copy)}`);
90
+ yield* Console.error(lines.join("\n"));
91
+ return yield* new SetupFailure({
92
+ message: `${failures.length === 1 ? "a working copy was" : `${failures.length} working copies were`} not put back; run the commands above in ${root}.`,
93
+ });
94
+ });
95
+
96
+ // Biome reports no diagnostics for content piped to its stdin, so a file edited again after staging shows Biome its staged content
97
+ // on disk until the check ends.
98
+ export const withStagedContent = Effect.fn("Hooks.withStagedContent")(function* <TValue, TError, TRequirements>(
99
+ root: string,
100
+ edited: readonly string[],
101
+ check: Effect.Effect<TValue, TError, TRequirements>,
102
+ ) {
103
+ if (edited.length === 0) {
104
+ return yield* check;
105
+ }
106
+ return yield* Effect.acquireUseRelease(
107
+ setAsideAll(root, edited),
108
+ () => Effect.andThen(gitOrFail(root, ["--literal-pathspecs", "checkout-index", "--force", "--", ...edited]), check),
109
+ (copies) => restore(root, copies),
110
+ );
111
+ });
@@ -1,6 +1,7 @@
1
1
  import { dirname, join } from "node:path";
2
- import { Effect, type FileSystem } from "effect";
2
+ import { type Context, Effect, type FileSystem } from "effect";
3
3
  import ts from "typescript";
4
+ import { DeclarationFiles } from "#adapters/declaration-files/service.ts";
4
5
  import { type FilesystemFailure, readRequiredText } from "#inventory/filesystem.ts";
5
6
 
6
7
  const portable = new Set([
@@ -67,8 +68,7 @@ const portable = new Set([
67
68
  "structuredClone",
68
69
  ]);
69
70
 
70
- function namesInDom(path: string, text: string): readonly string[] {
71
- const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true);
71
+ function namesInDom(source: ts.SourceFile): readonly string[] {
72
72
  return source.statements.flatMap((statement) => {
73
73
  if (ts.isVariableStatement(statement)) {
74
74
  return statement.declarationList.declarations.flatMap(({ name }) => (ts.isIdentifier(name) ? [name.text] : []));
@@ -80,9 +80,11 @@ function namesInDom(path: string, text: string): readonly string[] {
80
80
  export const browserNames = Effect.fn("Imports.browserNames")(function* (): Effect.fn.Return<
81
81
  ReadonlySet<string>,
82
82
  FilesystemFailure,
83
- FileSystem.FileSystem
83
+ Context.Service.Identifier<typeof DeclarationFiles> | FileSystem.FileSystem
84
84
  > {
85
85
  const path = join(dirname(ts.getDefaultLibFilePath({})), "lib.dom.d.ts");
86
86
  const text = yield* readRequiredText(path);
87
- return new Set(namesInDom(path, text).filter((name) => !portable.has(name)));
87
+ const declarations = yield* DeclarationFiles;
88
+ const source = yield* declarations.parse(path, text, { target: ts.ScriptTarget.Latest });
89
+ return new Set(namesInDom(source).filter((name) => !portable.has(name)));
88
90
  });
@@ -26,7 +26,7 @@ function graphOf(chain: Chain): FenceGraph | undefined {
26
26
  const edges = files.map(
27
27
  (from, index): ImportEdge => ({ from, kind: "import", line: 1, specifier: "", to: endpointOf(chain[index + 1] ?? from), type: false }),
28
28
  );
29
- return { edges, modules: files };
29
+ return { edges, ignoredEdges: [], modules: files };
30
30
  }
31
31
 
32
32
  function crossedBy(policy: readonly CompiledFence[], graph: FenceGraph): readonly string[] {
@@ -6,7 +6,7 @@ import type { ImportEdge, ImportGraph } from "#imports/graph.ts";
6
6
  import { isTestCode } from "#naming/testName.ts";
7
7
  import type { Finding } from "#rule.ts";
8
8
 
9
- export type FenceGraph = Pick<ImportGraph, "edges" | "modules">;
9
+ export type FenceGraph = Pick<ImportGraph, "edges" | "ignoredEdges" | "modules">;
10
10
 
11
11
  export type Evaluate = (graph: FenceGraph) => readonly Finding[];
12
12
 
@@ -49,7 +49,7 @@ function importFindings(fence: Fence, importer: (path: string) => boolean, to: M
49
49
 
50
50
  function reachFindings(fence: Fence, importer: (path: string) => boolean, to: Matcher): Evaluate {
51
51
  return (graph) => {
52
- const edgesFrom = outgoing(graph.edges);
52
+ const edgesFrom = outgoing([...graph.edges, ...graph.ignoredEdges]);
53
53
  return graph.modules.filter(importer).flatMap((module) =>
54
54
  reachedFrom(module, edgesFrom, to).map((reached) => ({
55
55
  file: module,