@shivaedev/quality 0.45.0 → 0.46.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 (413) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +13 -7
  3. package/dist/PackageManifest.d.ts +25 -0
  4. package/dist/PackageManifest.d.ts.map +1 -0
  5. package/dist/PackageManifest.js +21 -0
  6. package/dist/PackageManifest.js.map +1 -0
  7. package/dist/adapters/TestOutput.d.ts +8 -0
  8. package/dist/adapters/TestOutput.d.ts.map +1 -0
  9. package/dist/adapters/TestOutput.js +5 -0
  10. package/dist/adapters/TestOutput.js.map +1 -0
  11. package/dist/adapters/knip/configuration.d.ts.map +1 -1
  12. package/dist/adapters/knip/configuration.js +2 -9
  13. package/dist/adapters/knip/configuration.js.map +1 -1
  14. package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
  15. package/dist/adapters/knip/entryPointFindings.js +2 -1
  16. package/dist/adapters/knip/entryPointFindings.js.map +1 -1
  17. package/dist/adapters/knip/run.d.ts +3 -1
  18. package/dist/adapters/knip/run.d.ts.map +1 -1
  19. package/dist/adapters/knip/run.js +8 -8
  20. package/dist/adapters/knip/run.js.map +1 -1
  21. package/dist/adapters/manifestInventory.d.ts +23 -0
  22. package/dist/adapters/manifestInventory.d.ts.map +1 -0
  23. package/dist/adapters/manifestInventory.js +63 -0
  24. package/dist/adapters/manifestInventory.js.map +1 -0
  25. package/dist/adapters/manifestReader.d.ts +3 -0
  26. package/dist/adapters/manifestReader.d.ts.map +1 -0
  27. package/dist/adapters/manifestReader.js +8 -0
  28. package/dist/adapters/manifestReader.js.map +1 -0
  29. package/dist/adapters/testProjects.d.ts.map +1 -0
  30. package/dist/{testProjects.js → adapters/testProjects.js} +4 -3
  31. package/dist/adapters/testProjects.js.map +1 -0
  32. package/dist/appTestConfig.d.ts +1 -1
  33. package/dist/appTestConfig.d.ts.map +1 -1
  34. package/dist/appTestConfig.js +1 -1
  35. package/dist/appTestConfig.js.map +1 -1
  36. package/dist/baseline/format.js +2 -2
  37. package/dist/baseline/format.js.map +1 -1
  38. package/dist/baseline/legacy.js +2 -2
  39. package/dist/baseline/legacy.js.map +1 -1
  40. package/dist/baseline/merge.js +1 -1
  41. package/dist/baseline/merge.js.map +1 -1
  42. package/dist/baseline/shards.js +1 -1
  43. package/dist/baseline/shards.js.map +1 -1
  44. package/dist/biome/exceptionConfig.d.ts +7 -1
  45. package/dist/biome/exceptionConfig.d.ts.map +1 -1
  46. package/dist/biome/exceptionConfig.js +11 -25
  47. package/dist/biome/exceptionConfig.js.map +1 -1
  48. package/dist/biome/recommendedRules.d.ts +2 -1
  49. package/dist/biome/recommendedRules.d.ts.map +1 -1
  50. package/dist/biome/recommendedRules.js +10 -13
  51. package/dist/biome/recommendedRules.js.map +1 -1
  52. package/dist/biome/relocateConfig.d.ts +6 -0
  53. package/dist/biome/relocateConfig.d.ts.map +1 -0
  54. package/dist/biome/relocateConfig.js +49 -0
  55. package/dist/biome/relocateConfig.js.map +1 -0
  56. package/dist/biome/report.d.ts +27 -3
  57. package/dist/biome/report.d.ts.map +1 -1
  58. package/dist/biome/report.js +12 -10
  59. package/dist/biome/report.js.map +1 -1
  60. package/dist/biome/run.d.ts +12 -2
  61. package/dist/biome/run.d.ts.map +1 -1
  62. package/dist/biome/run.js +11 -15
  63. package/dist/biome/run.js.map +1 -1
  64. package/dist/biome/withoutEntryPointImports.d.ts.map +1 -1
  65. package/dist/biome/withoutEntryPointImports.js +2 -12
  66. package/dist/biome/withoutEntryPointImports.js.map +1 -1
  67. package/dist/cli/baseline.d.ts +4 -3
  68. package/dist/cli/baseline.d.ts.map +1 -1
  69. package/dist/cli/baseline.js.map +1 -1
  70. package/dist/cli/fix.d.ts +2 -1
  71. package/dist/cli/fix.d.ts.map +1 -1
  72. package/dist/cli/fix.js +3 -9
  73. package/dist/cli/fix.js.map +1 -1
  74. package/dist/cli/lint.d.ts +3 -2
  75. package/dist/cli/lint.d.ts.map +1 -1
  76. package/dist/cli/lint.js.map +1 -1
  77. package/dist/cli/migrateBaseline.d.ts +3 -2
  78. package/dist/cli/migrateBaseline.d.ts.map +1 -1
  79. package/dist/cli/migrateBaseline.js +2 -2
  80. package/dist/cli/migrateBaseline.js.map +1 -1
  81. package/dist/cli/migrateExceptions.d.ts.map +1 -1
  82. package/dist/cli/migrateExceptions.js +6 -4
  83. package/dist/cli/migrateExceptions.js.map +1 -1
  84. package/dist/cli/program.d.ts +1 -1
  85. package/dist/cli/program.d.ts.map +1 -1
  86. package/dist/config/decode.d.ts +1 -1
  87. package/dist/config/decode.d.ts.map +1 -1
  88. package/dist/config/decode.js +1 -2
  89. package/dist/config/decode.js.map +1 -1
  90. package/dist/config/load.js +2 -2
  91. package/dist/config/load.js.map +1 -1
  92. package/dist/config/resolve.d.ts +1 -1
  93. package/dist/decoded.d.ts +2 -3
  94. package/dist/decoded.d.ts.map +1 -1
  95. package/dist/decoded.js +6 -4
  96. package/dist/decoded.js.map +1 -1
  97. package/dist/docs/documentedModule.d.ts +0 -2
  98. package/dist/docs/documentedModule.d.ts.map +1 -1
  99. package/dist/docs/documentedModule.js +0 -3
  100. package/dist/docs/documentedModule.js.map +1 -1
  101. package/dist/docs/importFindings.d.ts.map +1 -1
  102. package/dist/docs/importFindings.js +0 -3
  103. package/dist/docs/importFindings.js.map +1 -1
  104. package/dist/engine/baselineFile.js +2 -2
  105. package/dist/engine/baselineFile.js.map +1 -1
  106. package/dist/engine/runRules.d.ts +3 -4
  107. package/dist/engine/runRules.d.ts.map +1 -1
  108. package/dist/engine/runRules.js +23 -8
  109. package/dist/engine/runRules.js.map +1 -1
  110. package/dist/engine/session.d.ts +4 -3
  111. package/dist/engine/session.d.ts.map +1 -1
  112. package/dist/engine/session.js +6 -7
  113. package/dist/engine/session.js.map +1 -1
  114. package/dist/exceptions/declaration.js +2 -2
  115. package/dist/exceptions/declaration.js.map +1 -1
  116. package/dist/exceptions/registry.d.ts.map +1 -1
  117. package/dist/exceptions/registry.js +2 -4
  118. package/dist/exceptions/registry.js.map +1 -1
  119. package/dist/failure.d.ts +5 -0
  120. package/dist/failure.d.ts.map +1 -1
  121. package/dist/failure.js +4 -0
  122. package/dist/failure.js.map +1 -1
  123. package/dist/git/command.js +1 -1
  124. package/dist/git/command.js.map +1 -1
  125. package/dist/hooks/install.js +2 -2
  126. package/dist/hooks/install.js.map +1 -1
  127. package/dist/hooks/preCommit.d.ts +1 -2
  128. package/dist/hooks/preCommit.d.ts.map +1 -1
  129. package/dist/hooks/preCommit.js +10 -11
  130. package/dist/hooks/preCommit.js.map +1 -1
  131. package/dist/hooks/status.js +1 -1
  132. package/dist/hooks/status.js.map +1 -1
  133. package/dist/hooks/uninstall.js +3 -3
  134. package/dist/hooks/uninstall.js.map +1 -1
  135. package/dist/imports/classifyRuntime.d.ts +10 -0
  136. package/dist/imports/classifyRuntime.d.ts.map +1 -0
  137. package/dist/imports/classifyRuntime.js +22 -0
  138. package/dist/imports/classifyRuntime.js.map +1 -0
  139. package/dist/imports/fences/declarations.d.ts.map +1 -1
  140. package/dist/imports/fences/declarations.js +1 -2
  141. package/dist/imports/fences/declarations.js.map +1 -1
  142. package/dist/imports/pnpmWorkspacePatterns.d.ts.map +1 -1
  143. package/dist/imports/pnpmWorkspacePatterns.js +2 -1
  144. package/dist/imports/pnpmWorkspacePatterns.js.map +1 -1
  145. package/dist/imports/runtime.d.ts +4 -3
  146. package/dist/imports/runtime.d.ts.map +1 -1
  147. package/dist/imports/runtime.js +35 -64
  148. package/dist/imports/runtime.js.map +1 -1
  149. package/dist/imports/workspace.d.ts.map +1 -1
  150. package/dist/imports/workspace.js +9 -19
  151. package/dist/imports/workspace.js.map +1 -1
  152. package/dist/inventory/collect.d.ts +1 -0
  153. package/dist/inventory/collect.d.ts.map +1 -1
  154. package/dist/inventory/collect.js +2 -1
  155. package/dist/inventory/collect.js.map +1 -1
  156. package/dist/inventory/filesystem.d.ts.map +1 -1
  157. package/dist/inventory/filesystem.js +2 -8
  158. package/dist/inventory/filesystem.js.map +1 -1
  159. package/dist/manifests/entryPoints.d.ts.map +1 -1
  160. package/dist/manifests/entryPoints.js +2 -12
  161. package/dist/manifests/entryPoints.js.map +1 -1
  162. package/dist/manifests/sorted.d.ts +2 -3
  163. package/dist/manifests/sorted.d.ts.map +1 -1
  164. package/dist/manifests/sorted.js +14 -8
  165. package/dist/manifests/sorted.js.map +1 -1
  166. package/dist/naming/packageLayout.d.ts.map +1 -1
  167. package/dist/naming/packageLayout.js +2 -12
  168. package/dist/naming/packageLayout.js.map +1 -1
  169. package/dist/rule.d.ts +15 -10
  170. package/dist/rule.d.ts.map +1 -1
  171. package/dist/rule.js +9 -1
  172. package/dist/rule.js.map +1 -1
  173. package/dist/rules/biome.d.ts.map +1 -1
  174. package/dist/rules/biome.js +7 -4
  175. package/dist/rules/biome.js.map +1 -1
  176. package/dist/rules/builtIn.d.ts +14 -14
  177. package/dist/rules/builtIn.d.ts.map +1 -1
  178. package/dist/rules/builtIn.js +2 -0
  179. package/dist/rules/builtIn.js.map +1 -1
  180. package/dist/rules/comments/maxPerFile.d.ts +1 -1
  181. package/dist/rules/comments/maxPerFile.d.ts.map +1 -1
  182. package/dist/rules/comments/noBanner.d.ts +1 -1
  183. package/dist/rules/comments/noBanner.d.ts.map +1 -1
  184. package/dist/rules/comments/noEnvironmentPragma.d.ts +1 -1
  185. package/dist/rules/comments/noEnvironmentPragma.d.ts.map +1 -1
  186. package/dist/rules/comments/noEnvironmentPragma.js +1 -1
  187. package/dist/rules/comments/noEnvironmentPragma.js.map +1 -1
  188. package/dist/rules/comments/noJsdoc.d.ts +1 -1
  189. package/dist/rules/comments/noJsdoc.d.ts.map +1 -1
  190. package/dist/rules/comments/noLineReference.d.ts +1 -1
  191. package/dist/rules/comments/noLineReference.d.ts.map +1 -1
  192. package/dist/rules/comments/noPrReference.d.ts +1 -1
  193. package/dist/rules/comments/noPrReference.d.ts.map +1 -1
  194. package/dist/rules/comments/noTodo.d.ts +1 -1
  195. package/dist/rules/comments/noTodo.d.ts.map +1 -1
  196. package/dist/rules/docs/references.d.ts +1 -1
  197. package/dist/rules/docs/references.d.ts.map +1 -1
  198. package/dist/rules/docs/references.js +5 -8
  199. package/dist/rules/docs/references.js.map +1 -1
  200. package/dist/rules/docs/unversionedInstalls.d.ts +1 -1
  201. package/dist/rules/docs/unversionedInstalls.d.ts.map +1 -1
  202. package/dist/rules/docs/unversionedInstalls.js +1 -1
  203. package/dist/rules/docs/unversionedInstalls.js.map +1 -1
  204. package/dist/rules/effect/boundary.d.ts +1 -1
  205. package/dist/rules/effect/boundary.d.ts.map +1 -1
  206. package/dist/rules/effect/serviceParameters.d.ts +1 -1
  207. package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
  208. package/dist/rules/effect/serviceTypes.d.ts.map +1 -1
  209. package/dist/rules/effect/serviceTypes.js +10 -0
  210. package/dist/rules/effect/serviceTypes.js.map +1 -1
  211. package/dist/rules/files/distinctCase.d.ts +1 -1
  212. package/dist/rules/files/distinctCase.d.ts.map +1 -1
  213. package/dist/rules/files/folderNames.d.ts +1 -1
  214. package/dist/rules/files/folderNames.d.ts.map +1 -1
  215. package/dist/rules/files/namedAfterExport.d.ts +1 -1
  216. package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
  217. package/dist/rules/files/otherNames.d.ts +1 -1
  218. package/dist/rules/files/otherNames.d.ts.map +1 -1
  219. package/dist/rules/files/packageImports.d.ts.map +1 -1
  220. package/dist/rules/files/packageImports.js +2 -13
  221. package/dist/rules/files/packageImports.js.map +1 -1
  222. package/dist/rules/imports/aliased.d.ts +1 -1
  223. package/dist/rules/imports/aliased.d.ts.map +1 -1
  224. package/dist/rules/imports/cycles.d.ts +1 -1
  225. package/dist/rules/imports/cycles.d.ts.map +1 -1
  226. package/dist/rules/imports/fences.d.ts +1 -1
  227. package/dist/rules/imports/fences.d.ts.map +1 -1
  228. package/dist/rules/imports/manifest.d.ts +1 -1
  229. package/dist/rules/imports/manifest.d.ts.map +1 -1
  230. package/dist/rules/imports/manifest.js +14 -32
  231. package/dist/rules/imports/manifest.js.map +1 -1
  232. package/dist/rules/imports/noTestCode.d.ts +1 -1
  233. package/dist/rules/imports/noTestCode.d.ts.map +1 -1
  234. package/dist/rules/imports/resolvable.d.ts +1 -1
  235. package/dist/rules/imports/resolvable.d.ts.map +1 -1
  236. package/dist/rules/imports/runtime.d.ts +1 -1
  237. package/dist/rules/imports/runtime.d.ts.map +1 -1
  238. package/dist/rules/imports/runtime.js +29 -25
  239. package/dist/rules/imports/runtime.js.map +1 -1
  240. package/dist/rules/manifestsApplication.d.ts +1 -1
  241. package/dist/rules/manifestsApplication.d.ts.map +1 -1
  242. package/dist/rules/manifestsApplication.js +2 -12
  243. package/dist/rules/manifestsApplication.js.map +1 -1
  244. package/dist/rules/manifestsExportsShape.d.ts +1 -1
  245. package/dist/rules/manifestsExportsShape.d.ts.map +1 -1
  246. package/dist/rules/manifestsExportsShape.js +12 -7
  247. package/dist/rules/manifestsExportsShape.js.map +1 -1
  248. package/dist/rules/manifestsSorted.d.ts +1 -1
  249. package/dist/rules/manifestsSorted.d.ts.map +1 -1
  250. package/dist/rules/manifestsSorted.js +10 -14
  251. package/dist/rules/manifestsSorted.js.map +1 -1
  252. package/dist/rules/manifestsSourceFirst.d.ts +1 -1
  253. package/dist/rules/manifestsSourceFirst.d.ts.map +1 -1
  254. package/dist/rules/manifestsSourceFirst.js +20 -23
  255. package/dist/rules/manifestsSourceFirst.js.map +1 -1
  256. package/dist/rules/manifestsValid.d.ts +2 -0
  257. package/dist/rules/manifestsValid.d.ts.map +1 -0
  258. package/dist/rules/manifestsValid.js +10 -0
  259. package/dist/rules/manifestsValid.js.map +1 -0
  260. package/dist/rules/maxDepth.d.ts +1 -1
  261. package/dist/rules/maxDepth.d.ts.map +1 -1
  262. package/dist/rules/maxLines.d.ts +1 -1
  263. package/dist/rules/maxLines.d.ts.map +1 -1
  264. package/dist/rules/noBarrel.d.ts +1 -1
  265. package/dist/rules/noBarrel.d.ts.map +1 -1
  266. package/dist/rules/react/jsxConditionals.d.ts +1 -1
  267. package/dist/rules/react/jsxConditionals.d.ts.map +1 -1
  268. package/dist/rules/stories/authSql.d.ts +1 -1
  269. package/dist/rules/stories/authSql.d.ts.map +1 -1
  270. package/dist/rules/stories/domainOutcomes.d.ts +1 -1
  271. package/dist/rules/stories/domainOutcomes.d.ts.map +1 -1
  272. package/dist/rules/stories/domainOutcomes.js +3 -3
  273. package/dist/rules/stories/domainOutcomes.js.map +1 -1
  274. package/dist/rules/stories/engine.d.ts +1 -1
  275. package/dist/rules/stories/engine.d.ts.map +1 -1
  276. package/dist/rules/stories/groupedOutcomes.d.ts +1 -1
  277. package/dist/rules/stories/groupedOutcomes.d.ts.map +1 -1
  278. package/dist/rules/stories/groupedOutcomes.js +2 -2
  279. package/dist/rules/stories/groupedOutcomes.js.map +1 -1
  280. package/dist/rules/stories/httpStatus.d.ts +1 -1
  281. package/dist/rules/stories/httpStatus.d.ts.map +1 -1
  282. package/dist/rules/stories/namedValues.d.ts +1 -1
  283. package/dist/rules/stories/namedValues.d.ts.map +1 -1
  284. package/dist/rules/stories/noExpect.d.ts +1 -1
  285. package/dist/rules/stories/noExpect.d.ts.map +1 -1
  286. package/dist/rules/stories/noLimitImports.d.ts +1 -1
  287. package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
  288. package/dist/rules/stories/prerequisites.d.ts.map +1 -1
  289. package/dist/rules/stories/prerequisites.js +3 -6
  290. package/dist/rules/stories/prerequisites.js.map +1 -1
  291. package/dist/rules/stories/queueSql.d.ts +1 -1
  292. package/dist/rules/stories/queueSql.d.ts.map +1 -1
  293. package/dist/rules/stories/setup.d.ts +1 -1
  294. package/dist/rules/stories/setup.d.ts.map +1 -1
  295. package/dist/rules/stories/sources.d.ts +4 -0
  296. package/dist/rules/stories/sources.d.ts.map +1 -0
  297. package/dist/rules/stories/{specSources.js → sources.js} +6 -6
  298. package/dist/rules/stories/sources.js.map +1 -0
  299. package/dist/rules/stories/specHelpers.d.ts +1 -1
  300. package/dist/rules/stories/specHelpers.d.ts.map +1 -1
  301. package/dist/rules/stories/specs.d.ts +1 -1
  302. package/dist/rules/stories/specs.d.ts.map +1 -1
  303. package/dist/rules/stories/waitOnEvents.d.ts +1 -1
  304. package/dist/rules/stories/waitOnEvents.d.ts.map +1 -1
  305. package/dist/rules/stories/waitOnEvents.js +4 -4
  306. package/dist/rules/stories/waitOnEvents.js.map +1 -1
  307. package/dist/rules/suppressions/biome/declarations.d.ts.map +1 -1
  308. package/dist/rules/suppressions/biome/declarations.js +2 -4
  309. package/dist/rules/suppressions/biome/declarations.js.map +1 -1
  310. package/dist/rules/suppressions/biome/resolvePackage.d.ts.map +1 -1
  311. package/dist/rules/suppressions/biome/resolvePackage.js +3 -15
  312. package/dist/rules/suppressions/biome/resolvePackage.js.map +1 -1
  313. package/dist/rules/suppressions/biomeOverrides.d.ts +1 -1
  314. package/dist/rules/suppressions/biomeOverrides.d.ts.map +1 -1
  315. package/dist/rules/suppressions/biomeRecommended.d.ts +6 -3
  316. package/dist/rules/suppressions/biomeRecommended.d.ts.map +1 -1
  317. package/dist/rules/suppressions/biomeRecommended.js +10 -7
  318. package/dist/rules/suppressions/biomeRecommended.js.map +1 -1
  319. package/dist/rules/suppressions/noDoubleCast.d.ts +1 -1
  320. package/dist/rules/suppressions/noDoubleCast.d.ts.map +1 -1
  321. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts +1 -1
  322. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts.map +1 -1
  323. package/dist/rules/suppressions/noIgnoreDeprecations.js +7 -7
  324. package/dist/rules/suppressions/noIgnoreDeprecations.js.map +1 -1
  325. package/dist/rules/suppressions/noInline.d.ts +1 -1
  326. package/dist/rules/suppressions/noInline.d.ts.map +1 -1
  327. package/dist/rules/test-names/colocated.d.ts +1 -1
  328. package/dist/rules/test-names/colocated.d.ts.map +1 -1
  329. package/dist/rules/test-names/follow.d.ts +1 -1
  330. package/dist/rules/test-names/follow.d.ts.map +1 -1
  331. package/dist/rules/unusedCode.d.ts +1 -1
  332. package/dist/rules/unusedCode.d.ts.map +1 -1
  333. package/package.json +2 -9
  334. package/src/PackageManifest.ts +24 -0
  335. package/src/adapters/TestOutput.ts +9 -0
  336. package/src/adapters/knip/configuration.ts +2 -10
  337. package/src/adapters/knip/entryPointFindings.ts +2 -1
  338. package/src/adapters/knip/run.ts +42 -44
  339. package/src/adapters/manifestInventory.ts +87 -0
  340. package/src/adapters/manifestReader.ts +11 -0
  341. package/src/{testProjects.ts → adapters/testProjects.ts} +4 -3
  342. package/src/appTestConfig.ts +1 -1
  343. package/src/baseline/format.ts +2 -2
  344. package/src/baseline/legacy.ts +2 -2
  345. package/src/baseline/merge.ts +1 -1
  346. package/src/baseline/shards.ts +1 -1
  347. package/src/biome/exceptionConfig.ts +19 -34
  348. package/src/biome/recommendedRules.ts +18 -16
  349. package/src/biome/relocateConfig.ts +59 -0
  350. package/src/biome/report.ts +17 -11
  351. package/src/biome/run.ts +22 -18
  352. package/src/biome/withoutEntryPointImports.ts +2 -12
  353. package/src/cli/baseline.ts +3 -2
  354. package/src/cli/fix.ts +15 -17
  355. package/src/cli/lint.ts +3 -2
  356. package/src/cli/migrateBaseline.ts +4 -3
  357. package/src/cli/migrateExceptions.ts +6 -4
  358. package/src/config/decode.ts +1 -3
  359. package/src/config/load.ts +2 -2
  360. package/src/decoded.ts +9 -5
  361. package/src/docs/documentedModule.ts +1 -4
  362. package/src/docs/importFindings.ts +0 -5
  363. package/src/engine/baselineFile.ts +2 -2
  364. package/src/engine/runRules.ts +34 -15
  365. package/src/engine/session.ts +11 -10
  366. package/src/exceptions/declaration.ts +2 -2
  367. package/src/exceptions/registry.ts +2 -4
  368. package/src/failure.ts +6 -1
  369. package/src/git/command.ts +1 -1
  370. package/src/hooks/install.ts +2 -2
  371. package/src/hooks/preCommit.ts +10 -16
  372. package/src/hooks/status.ts +1 -1
  373. package/src/hooks/uninstall.ts +3 -3
  374. package/src/imports/classifyRuntime.ts +30 -0
  375. package/src/imports/fences/declarations.ts +1 -3
  376. package/src/imports/pnpmWorkspacePatterns.ts +3 -1
  377. package/src/imports/runtime.ts +48 -60
  378. package/src/imports/workspace.ts +9 -20
  379. package/src/inventory/collect.ts +3 -1
  380. package/src/inventory/filesystem.ts +2 -10
  381. package/src/manifests/entryPoints.ts +2 -12
  382. package/src/manifests/sorted.ts +21 -9
  383. package/src/naming/packageLayout.ts +2 -12
  384. package/src/rule.ts +38 -19
  385. package/src/rules/biome.ts +9 -5
  386. package/src/rules/builtIn.ts +2 -0
  387. package/src/rules/comments/noEnvironmentPragma.ts +1 -1
  388. package/src/rules/docs/references.ts +8 -10
  389. package/src/rules/docs/unversionedInstalls.ts +1 -1
  390. package/src/rules/effect/serviceTypes.ts +13 -0
  391. package/src/rules/files/packageImports.ts +2 -13
  392. package/src/rules/imports/manifest.ts +15 -32
  393. package/src/rules/imports/runtime.ts +41 -35
  394. package/src/rules/manifestsApplication.ts +2 -12
  395. package/src/rules/manifestsExportsShape.ts +11 -8
  396. package/src/rules/manifestsSorted.ts +13 -16
  397. package/src/rules/manifestsSourceFirst.ts +24 -24
  398. package/src/rules/manifestsValid.ts +14 -0
  399. package/src/rules/stories/domainOutcomes.ts +3 -4
  400. package/src/rules/stories/groupedOutcomes.ts +2 -3
  401. package/src/rules/stories/prerequisites.ts +4 -8
  402. package/src/rules/stories/{specSources.ts → sources.ts} +5 -5
  403. package/src/rules/stories/waitOnEvents.ts +4 -5
  404. package/src/rules/suppressions/biome/declarations.ts +2 -4
  405. package/src/rules/suppressions/biome/resolvePackage.ts +5 -21
  406. package/src/rules/suppressions/biomeRecommended.ts +14 -9
  407. package/src/rules/suppressions/noIgnoreDeprecations.ts +11 -8
  408. package/dist/rules/stories/specSources.d.ts +0 -4
  409. package/dist/rules/stories/specSources.d.ts.map +0 -1
  410. package/dist/rules/stories/specSources.js.map +0 -1
  411. package/dist/testProjects.d.ts.map +0 -1
  412. package/dist/testProjects.js.map +0 -1
  413. /package/dist/{testProjects.d.ts → adapters/testProjects.d.ts} +0 -0
@@ -1,11 +1,8 @@
1
- import { randomUUID } from "node:crypto";
2
- import { rm, writeFile } from "node:fs/promises";
3
1
  import { join } from "node:path";
4
- import { NodeFileSystem } from "@effect/platform-node";
5
2
  import { Effect, Schema } from "effect";
6
- import ts from "typescript";
7
3
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
8
4
  import { readOptionalText } from "#inventory/filesystem.ts";
5
+ import { parseConfig, relocateConfig } from "./relocateConfig.ts";
9
6
 
10
7
  function nativeOverride(files: readonly string[], rule: string): unknown {
11
8
  const [, tool, group = "", name = ""] = rule.split("/");
@@ -27,53 +24,41 @@ export function exceptionConfig(declarations: readonly ExceptionDeclaration[]):
27
24
  };
28
25
  }
29
26
 
30
- export async function withExceptionConfig<TValue>(
27
+ export const withExceptionConfig = Effect.fn("Biome.withExceptionConfig")(function* <TValue, TError, TRequirements>(
31
28
  root: string,
32
29
  declarations: readonly ExceptionDeclaration[],
33
- run: (args: readonly string[]) => Promise<TValue>,
34
- ): Promise<TValue> {
30
+ run: (args: readonly string[]) => Effect.Effect<TValue, TError, TRequirements>,
31
+ ) {
35
32
  const { includes, overrides } = exceptionConfig(declarations);
36
33
  if (includes.length === 0 && overrides.length === 0) {
37
- return run([]);
34
+ return yield* run([]);
38
35
  }
39
- const name = `.quality-biome-${randomUUID()}.json`;
40
- const path = join(root, name);
41
- const { config, text } = await Effect.runPromise(
42
- Effect.gen(function* () {
43
- for (const candidate of ["biome.json", "biome.jsonc"]) {
44
- const content = yield* readOptionalText(join(root, candidate));
45
- if (content !== undefined) {
46
- return { config: candidate, text: content };
47
- }
36
+ const { config, text } = yield* Effect.gen(function* () {
37
+ for (const candidate of ["biome.json", "biome.jsonc"]) {
38
+ const content = yield* readOptionalText(join(root, candidate));
39
+ if (content !== undefined) {
40
+ return { config: candidate, text: content };
48
41
  }
49
- return { config: "biome.json", text: "{}" };
50
- }).pipe(Effect.provide(NodeFileSystem.layer)),
51
- );
52
- const parsed = ts.parseConfigFileTextToJson(config, text);
53
- if (parsed.error !== undefined) {
54
- throw new Error(`Cannot load ${config}: ${ts.flattenDiagnosticMessageText(parsed.error.messageText, " ")}`);
55
- }
56
- const own = Schema.decodeUnknownSync(Schema.Record(Schema.String, Schema.Unknown))(parsed.config);
42
+ }
43
+ return { config: "biome.json", text: "{}" };
44
+ });
45
+ const own = yield* parseConfig(config, text);
57
46
  const files = Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files) ? own.files : {};
58
47
  if (
59
48
  (own.files !== undefined && !Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files))
60
49
  || (files.includes !== undefined && !Array.isArray(files.includes))
61
50
  || (own.overrides !== undefined && !Array.isArray(own.overrides))
62
51
  ) {
63
- throw new Error(`Cannot merge exceptions into invalid ${config}: files, includes or overrides has the wrong shape.`);
52
+ return yield* Effect.die(new Error(`Cannot merge exceptions into invalid ${config}: files, includes or overrides has the wrong shape.`));
64
53
  }
65
54
  const previousIncludes = Array.isArray(files.includes) ? files.includes : ["**"];
66
55
  const previousOverrides = Array.isArray(own.overrides) ? own.overrides : [];
67
56
  // Biome also matches a wildcard-led glob such as `!**/.worktrees` against the folders above the root, which ignores a whole linked worktree.
68
57
  const generated = {
69
58
  ...own,
70
- files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", `!${name}`] },
59
+ files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", "!.quality-biome-*"] },
71
60
  overrides: [...previousOverrides, ...overrides],
72
61
  };
73
- try {
74
- await writeFile(path, JSON.stringify(generated), { flag: "wx" });
75
- return await run([`--config-path=${path}`]);
76
- } finally {
77
- await rm(path, { force: true });
78
- }
79
- }
62
+ const path = yield* relocateConfig(root, join(root, config), generated);
63
+ return yield* run([`--config-path=${path}`]);
64
+ });
@@ -1,23 +1,25 @@
1
- import { mkdtemp, rm, writeFile } from "node:fs/promises";
2
- import { tmpdir } from "node:os";
3
1
  import { join } from "node:path";
2
+ import { Effect, FileSystem } from "effect";
4
3
  import { runBiome } from "./run.ts";
5
4
 
6
5
  const RECOMMENDED_ONLY = '{ "linter": { "rules": { "preset": "recommended" } } }\n';
7
6
 
8
7
  const ENABLED_RULE = /^ {4}(?<rule>[a-z0-9]+\/\w+)$/gimu;
9
8
 
10
- export async function recommendedRules(): Promise<readonly string[]> {
11
- const directory = await mkdtemp(join(tmpdir(), "quality-biome-recommended-"));
12
- try {
13
- await writeFile(join(directory, "biome.json"), RECOMMENDED_ONLY);
14
- const rage = await runBiome(directory, ["rage", "--linter"]);
15
- const rules = [...rage.stdout.matchAll(ENABLED_RULE)].flatMap((match) => match.groups?.rule ?? []);
16
- if (rules.length === 0) {
17
- throw new Error(`biome rage --linter listed no enabled rules under the recommended preset:\n${[rage.stdout, rage.stderr].join("\n").trim()}`);
18
- }
19
- return rules;
20
- } finally {
21
- await rm(directory, { force: true, recursive: true });
22
- }
23
- }
9
+ export const recommendedRules = Effect.fn("Biome.recommendedRules")(function* () {
10
+ return yield* Effect.scoped(
11
+ Effect.gen(function* () {
12
+ const fs = yield* FileSystem.FileSystem;
13
+ const directory = yield* fs.makeTempDirectoryScoped({ prefix: "quality-biome-recommended-" });
14
+ yield* fs.writeFileString(join(directory, "biome.json"), RECOMMENDED_ONLY);
15
+ const rage = yield* runBiome(directory, ["rage", "--linter"]);
16
+ const rules = [...rage.stdout.matchAll(ENABLED_RULE)].flatMap((match) => match.groups?.rule ?? []);
17
+ if (rules.length === 0) {
18
+ return yield* Effect.die(
19
+ new Error(`biome rage --linter listed no enabled rules under the recommended preset:\n${[rage.stdout, rage.stderr].join("\n").trim()}`),
20
+ );
21
+ }
22
+ return rules;
23
+ }),
24
+ );
25
+ });
@@ -0,0 +1,59 @@
1
+ import { createRequire } from "node:module";
2
+ import { dirname, resolve } from "node:path";
3
+ import { Effect, FileSystem, type PlatformError, Schema, type Scope } from "effect";
4
+ import ts from "typescript";
5
+
6
+ const ObjectConfig = Schema.Record(Schema.String, Schema.Unknown);
7
+
8
+ export function parseConfig(path: string, text: string) {
9
+ const parsed = ts.parseConfigFileTextToJson(path, text);
10
+ return parsed.error === undefined
11
+ ? Schema.decodeUnknownEffect(ObjectConfig)(parsed.config)
12
+ : Effect.die(new Error(`Cannot load ${path}: ${ts.flattenDiagnosticMessageText(parsed.error.messageText, " ")}`));
13
+ }
14
+
15
+ const writeConfig = Effect.fn("Biome.writeConfig")(function* (
16
+ root: string,
17
+ original: string,
18
+ config: Readonly<Record<string, unknown>>,
19
+ paths: Map<string, string>,
20
+ ): Effect.fn.Return<string, PlatformError.PlatformError | Schema.SchemaError, FileSystem.FileSystem | Scope.Scope> {
21
+ const existing = paths.get(original);
22
+ if (existing !== undefined) {
23
+ return existing;
24
+ }
25
+ const fs = yield* FileSystem.FileSystem;
26
+ const path = yield* fs.makeTempFileScoped({ directory: root, prefix: ".quality-biome-", suffix: ".json" });
27
+ paths.set(original, path);
28
+ const require = createRequire(original);
29
+ const extended: string[] = [];
30
+ for (const specifier of Array.isArray(config.extends) ? config.extends : []) {
31
+ const source = specifier.startsWith(".") ? resolve(dirname(original), specifier) : require.resolve(specifier);
32
+ const inherited = yield* parseConfig(source, yield* fs.readFileString(source));
33
+ extended.push(yield* writeConfig(root, source, inherited, paths));
34
+ }
35
+ const vcs = config.vcs ?? {};
36
+ const generated = {
37
+ ...config,
38
+ ...(Array.isArray(config.extends) ? { extends: extended } : {}),
39
+ ...(Array.isArray(config.plugins)
40
+ ? {
41
+ plugins: config.plugins.map((plugin) =>
42
+ typeof plugin === "string" ? resolve(root, plugin) : { ...plugin, path: resolve(root, plugin.path) },
43
+ ),
44
+ }
45
+ : {}),
46
+ vcs: Schema.is(ObjectConfig)(vcs)
47
+ ? {
48
+ ...vcs,
49
+ root: typeof vcs.root === "string" ? resolve(root, vcs.root) : (vcs.root ?? root),
50
+ }
51
+ : vcs,
52
+ };
53
+ yield* fs.writeFileString(path, JSON.stringify(generated));
54
+ return path;
55
+ });
56
+
57
+ export function relocateConfig(root: string, original: string, config: Readonly<Record<string, unknown>>) {
58
+ return writeConfig(root, original, config, new Map());
59
+ }
@@ -1,5 +1,5 @@
1
1
  import { relative, sep } from "node:path";
2
- import { Schema } from "effect";
2
+ import { Effect, Schema } from "effect";
3
3
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
4
4
  import { ignoredTrackedPaths } from "#inventory/trackedPaths.ts";
5
5
  import { recognizeDiagnostics } from "./recognizeDiagnostics.ts";
@@ -36,35 +36,41 @@ function unexplained(run: BiomeRun, report: Report): boolean {
36
36
  return run.code !== 0 && !report.diagnostics.some((diagnostic) => FAILING.has(diagnostic.severity));
37
37
  }
38
38
 
39
- async function reportFor(
39
+ const reportFor = Effect.fn("Biome.reportFor")(function* (
40
40
  root: string,
41
41
  args: readonly string[],
42
42
  paths: readonly string[],
43
43
  exceptions: readonly ExceptionDeclaration[],
44
- ): Promise<Report> {
44
+ ) {
45
45
  const command = [...args, "--reporter=json", "--max-diagnostics=none", ...paths];
46
- const run = await runBiome(root, command, exceptions);
46
+ const run = yield* runBiome(root, command, exceptions);
47
47
  const report = decodeReport(run.stdout.trim());
48
48
  if (report._tag === "None") {
49
- throw failure(command, run, "a report", [run.stdout, run.stderr].join("\n"));
49
+ return yield* Effect.die(failure(command, run, "a report", [run.stdout, run.stderr].join("\n")));
50
50
  }
51
51
  if (unexplained(run, report.value)) {
52
- throw failure(command, run, "a failing diagnostic", run.stderr);
52
+ return yield* Effect.die(failure(command, run, "a failing diagnostic", run.stderr));
53
53
  }
54
54
  return report.value;
55
- }
55
+ });
56
56
 
57
- export async function biomeReport(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[] = []): Promise<Report> {
58
- const [report, tracked] = await Promise.all([reportFor(root, args, ["."], exceptions), ignoredTrackedPaths(root)]);
57
+ export const biomeReport = Effect.fn("Biome.biomeReport")(function* (
58
+ root: string,
59
+ args: readonly string[],
60
+ exceptions: readonly ExceptionDeclaration[] = [],
61
+ ) {
62
+ const [report, tracked] = yield* Effect.all([reportFor(root, args, ["."], exceptions), Effect.promise(() => ignoredTrackedPaths(root))], {
63
+ concurrency: "unbounded",
64
+ });
59
65
  const paths = tracked
60
66
  .map((path) => relative(root, path))
61
67
  .filter((path) => !path.split(sep).some((part) => part === ".git" || part === ".worktrees" || part === "node_modules"));
62
68
  const extra =
63
- paths.length === 0 ? undefined : await reportFor(root, [...args, "--vcs-enabled=false", "--no-errors-on-unmatched"], paths, exceptions);
69
+ paths.length === 0 ? undefined : yield* reportFor(root, [...args, "--vcs-enabled=false", "--no-errors-on-unmatched"], paths, exceptions);
64
70
  const diagnostics = [...report.diagnostics, ...(extra?.diagnostics ?? [])];
65
71
  const unique = [...new Map(diagnostics.map((diagnostic) => [JSON.stringify(diagnostic), diagnostic])).values()];
66
72
  return {
67
73
  diagnostics: recognizeDiagnostics(root, unique),
68
74
  summary: { changed: report.summary.changed + (extra?.summary.changed ?? 0) },
69
75
  };
70
- }
76
+ });
package/src/biome/run.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { execFile } from "node:child_process";
2
1
  import { createRequire } from "node:module";
3
2
  import process from "node:process";
4
- import { NodeFileSystem } from "@effect/platform-node";
5
- import { Effect } from "effect";
3
+ import { Effect, Stream } from "effect";
4
+ import { ChildProcess, ChildProcessSpawner } from "effect/process";
6
5
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
7
6
  import { shadcnFolders } from "#inventory/shadcnFolders.ts";
8
7
  import { withExceptionConfig } from "./exceptionConfig.ts";
@@ -15,8 +14,12 @@ export interface BiomeRun {
15
14
 
16
15
  const BIN = createRequire(import.meta.url).resolve("@biomejs/biome/bin/biome");
17
16
 
18
- export async function runBiome(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[] = []): Promise<BiomeRun> {
19
- const folders = await Effect.runPromise(shadcnFolders(root).pipe(Effect.provide(NodeFileSystem.layer)));
17
+ export const runBiome = Effect.fn("Biome.runBiome")(function* (
18
+ root: string,
19
+ args: readonly string[],
20
+ exceptions: readonly ExceptionDeclaration[] = [],
21
+ ) {
22
+ const folders = yield* shadcnFolders(root);
20
23
  const toolOwned: readonly ExceptionDeclaration[] = [
21
24
  {
22
25
  files: ["**", "!**/pnpm-lock.yaml", ...folders.map((folder) => `!${folder}`)],
@@ -24,18 +27,19 @@ export async function runBiome(root: string, args: readonly string[], exceptions
24
27
  rules: ["biome/files/includes"],
25
28
  },
26
29
  ];
27
- return withExceptionConfig(
28
- root,
29
- [...exceptions, ...toolOwned],
30
- (configArgs) =>
31
- new Promise((resolve, reject) => {
32
- execFile(process.execPath, [BIN, ...args, ...configArgs, "--colors=off"], { cwd: root, maxBuffer: 2 ** 30 }, (error, stdout, stderr) => {
33
- if (error !== null && typeof error.code !== "number") {
34
- reject(error);
35
- return;
36
- }
37
- resolve({ code: error === null ? 0 : Number(error.code), stderr, stdout });
38
- });
30
+ return yield* Effect.scoped(
31
+ withExceptionConfig(root, [...exceptions, ...toolOwned], (configArgs) =>
32
+ Effect.gen(function* () {
33
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
34
+ const child = yield* spawner.spawn(
35
+ ChildProcess.make(process.execPath, [BIN, ...args, ...configArgs, "--colors=off"], { cwd: root, stdin: "ignore" }),
36
+ );
37
+ const [stdout, stderr, code] = yield* Effect.all(
38
+ [Stream.mkString(Stream.decodeText(child.stdout)), Stream.mkString(Stream.decodeText(child.stderr)), child.exitCode],
39
+ { concurrency: "unbounded" },
40
+ );
41
+ return { code: Number(code), stderr, stdout };
39
42
  }),
43
+ ),
40
44
  );
41
- }
45
+ });
@@ -1,4 +1,5 @@
1
1
  import { posix } from "node:path";
2
+ import { readPackageManifest } from "#adapters/manifestInventory.ts";
2
3
  import { isTooling } from "#imports/isTooling.ts";
3
4
  import { entryPointsOf, isApplication, provider } from "#manifests/entryPoints.ts";
4
5
  import { isTestCode } from "#naming/testName.ts";
@@ -9,21 +10,10 @@ const UNDECLARED = "lint/correctness/noUndeclaredDependencies";
9
10
 
10
11
  const DEPENDENCY = /^Dependency (?<name>\S+) isn't specified in /u;
11
12
 
12
- function parsed(text: string | undefined): unknown {
13
- if (text === undefined) {
14
- return undefined;
15
- }
16
- try {
17
- return JSON.parse(text);
18
- } catch {
19
- return undefined;
20
- }
21
- }
22
-
23
13
  async function ownerOf(readText: RuleInputs["readText"], path: string) {
24
14
  let directory = posix.dirname(path);
25
15
  for (;;) {
26
- const manifest = parsed(await readText(posix.join(directory, "package.json")));
16
+ const manifest = await readPackageManifest(readText, posix.join(directory, "package.json"));
27
17
  if (manifest !== undefined || directory === ".") {
28
18
  return { directory, manifest };
29
19
  }
@@ -6,6 +6,7 @@ import { openSession, type Session } from "#engine/session.ts";
6
6
  import { applyRegistry } from "#exceptions/registry.ts";
7
7
  import { SetupFailure } from "#failure.ts";
8
8
  import { plural } from "#report/plural.ts";
9
+ import type { RuleServices } from "#rule.ts";
9
10
 
10
11
  function save(session: Session, entries: readonly BaselineEntry[]): Effect.Effect<void, SetupFailure, FileSystem.FileSystem> {
11
12
  return saveShards(session.config, session.baseline.files, entries);
@@ -19,7 +20,7 @@ export const writeBaseline = Effect.fn("Cli.writeBaseline")(function* (
19
20
  cwd: string,
20
21
  config: string | undefined,
21
22
  rules: readonly string[],
22
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
23
+ ): Effect.fn.Return<void, SetupFailure, RuleServices> {
23
24
  const session = yield* openSession(cwd, config);
24
25
  const existing = session.baseline.files.size === 0 ? undefined : session.baseline.entries;
25
26
  const adoption = adopt(existing, rules, unregistered(session), session.config);
@@ -47,7 +48,7 @@ export const shrinkBaseline = Effect.fn("Cli.shrinkBaseline")(function* <TRequir
47
48
  cwd: string,
48
49
  config: string | undefined,
49
50
  scopeOf: (session: Session) => Effect.Effect<Scope, SetupFailure, TRequirements>,
50
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem | TRequirements> {
51
+ ): Effect.fn.Return<void, SetupFailure, RuleServices | TRequirements> {
51
52
  const session = yield* openSession(cwd, config);
52
53
  if (session.baseline.files.size === 0) {
53
54
  return yield* Console.log(`quality: no baseline at ${session.config.baseline}; nothing to lower.`);
package/src/cli/fix.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { relative } from "node:path";
2
2
  import { Console, Effect, FileSystem } from "effect";
3
- import { biomeReport, type Report } from "#biome/report.ts";
3
+ import { biomeReport } from "#biome/report.ts";
4
4
  import { loadConfig } from "#config/load.ts";
5
5
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
6
6
  import { SetupFailure } from "#failure.ts";
@@ -8,16 +8,10 @@ import { posix } from "#inventory/ignoreScope.ts";
8
8
  import { walk } from "#inventory/walk.ts";
9
9
  import { sortManifests } from "#manifests/sorted.ts";
10
10
  import { plural } from "#report/plural.ts";
11
+ import type { RuleServices } from "#rule.ts";
11
12
 
12
13
  export const MAX_FIX_ROUNDS = 5;
13
14
 
14
- function biome(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[]): Effect.Effect<Report, SetupFailure> {
15
- return Effect.tryPromise({
16
- catch: (cause) => new SetupFailure({ message: cause instanceof Error ? cause.message : String(cause) }),
17
- try: () => biomeReport(root, args, exceptions),
18
- });
19
- }
20
-
21
15
  function isBinary(bytes: Uint8Array): boolean {
22
16
  return bytes.includes(0);
23
17
  }
@@ -31,7 +25,7 @@ export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, stri
31
25
  Effect.map(fs.readFile(path), (bytes) => (isBinary(bytes) ? [] : [[posix(relative(root, path)), decoder.decode(bytes)] as const])),
32
26
  );
33
27
  return new Map(texts.flat());
34
- }).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
28
+ }).pipe(Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
35
29
  }
36
30
 
37
31
  export interface Pass<TFailure, TRequirements> {
@@ -44,11 +38,18 @@ export interface Settling<TFailure, TRequirements> {
44
38
  readonly snapshot: Effect.Effect<ReadonlyMap<string, string>, TFailure, TRequirements>;
45
39
  }
46
40
 
47
- function changedBy(root: string, args: readonly string[], exceptions: readonly ExceptionDeclaration[]): Effect.Effect<number, SetupFailure> {
48
- return Effect.map(biome(root, args, exceptions), (report) => report.summary.changed);
41
+ function changedBy(
42
+ root: string,
43
+ args: readonly string[],
44
+ exceptions: readonly ExceptionDeclaration[],
45
+ ): Effect.Effect<number, SetupFailure, RuleServices> {
46
+ return Effect.map(
47
+ biomeReport(root, args, exceptions).pipe(Effect.mapError((cause) => new SetupFailure({ cause, message: cause.message }))),
48
+ (report) => report.summary.changed,
49
+ );
49
50
  }
50
51
 
51
- function biomePasses(root: string, exceptions: readonly ExceptionDeclaration[]): readonly Pass<SetupFailure, never>[] {
52
+ function biomePasses(root: string, exceptions: readonly ExceptionDeclaration[]): readonly Pass<SetupFailure, RuleServices>[] {
52
53
  return [
53
54
  {
54
55
  label: "with fixes",
@@ -121,12 +122,9 @@ export const settle = Effect.fn("Cli.settle")(function* <TFailure, TRequirements
121
122
  return yield* unsettled(changed);
122
123
  });
123
124
 
124
- export const fix = Effect.fn("Cli.fix")(function* (
125
- cwd: string,
126
- config: string | undefined,
127
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
125
+ export const fix = Effect.fn("Cli.fix")(function* (cwd: string, config: string | undefined): Effect.fn.Return<void, SetupFailure, RuleServices> {
128
126
  const { root, exceptions } = yield* loadConfig(cwd, config);
129
- const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ message: failure.message }));
127
+ const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ cause: failure, message: failure.message }));
130
128
  yield* Console.log(`quality: sort-package-json rewrote ${plural(sorted, "manifest")}.`);
131
129
  yield* settle({ passes: biomePasses(root, exceptions), snapshot: snapshotOf(root) });
132
130
  });
package/src/cli/lint.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { relative } from "node:path";
2
- import { Console, Effect, type FileSystem } from "effect";
2
+ import { Console, Effect } from "effect";
3
3
  import { evaluate, passes } from "#engine/evaluate.ts";
4
4
  import { openSession } from "#engine/session.ts";
5
5
  import { GateFailed, type SetupFailure } from "#failure.ts";
6
6
  import { render } from "#report/render.ts";
7
+ import type { RuleServices } from "#rule.ts";
7
8
 
8
9
  export const lint = Effect.fn("Cli.lint")(function* (
9
10
  cwd: string,
10
11
  config: string | undefined,
11
- ): Effect.fn.Return<void, SetupFailure | GateFailed, FileSystem.FileSystem> {
12
+ ): Effect.fn.Return<void, SetupFailure | GateFailed, RuleServices> {
12
13
  const session = yield* openSession(cwd, config);
13
14
  const outcome = evaluate(session.violations, session.registry, session.baseline.entries, session.config);
14
15
  yield* Console.log(
@@ -9,15 +9,16 @@ import { readInput } from "#engine/baselineFile.ts";
9
9
  import { scan } from "#engine/session.ts";
10
10
  import { SetupFailure } from "#failure.ts";
11
11
  import { plural } from "#report/plural.ts";
12
+ import type { RuleServices } from "#rule.ts";
12
13
 
13
14
  export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
14
15
  cwd: string,
15
16
  configPath: string | undefined,
16
17
  from: string | undefined,
17
- ): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
18
+ ): Effect.fn.Return<void, SetupFailure, RuleServices> {
18
19
  const config = yield* loadConfig(cwd, configPath);
19
20
  const source = from ?? LEGACY_BASELINE;
20
- const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })));
21
+ const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })));
21
22
  const existing = yield* Effect.forEach(paths, (path) => readInput(config.root, path));
22
23
  if (source === config.baseline || existing.some((text) => text !== undefined)) {
23
24
  return yield* new SetupFailure({ message: `${config.baseline} already exists. Migrate into a baseline file that does not exist yet.` });
@@ -32,7 +33,7 @@ export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
32
33
  const entries = source.endsWith(".jsonl") ? legacy : convertLegacy(legacy, (yield* scan(config)).violations);
33
34
  const fs = yield* FileSystem.FileSystem;
34
35
  const written = Effect.andThen(saveShards(config, new Map(), entries), fs.remove(join(config.root, source)));
35
- yield* Effect.mapError(written, (failure) => new SetupFailure({ message: failure.message }));
36
+ yield* Effect.mapError(written, (failure) => new SetupFailure({ cause: failure, message: failure.message }));
36
37
  const fixed = legacy.length - entries.length;
37
38
  const dropped = fixed > 0 ? `, dropping ${plural(fixed, "fixed entry", "fixed entries")}` : "";
38
39
  yield* Console.log(`quality: moved ${plural(entries.length, "entry", "entries")} from ${source} to ${config.baseline}${dropped}.`);
@@ -60,7 +60,7 @@ export const migrateExceptions = Effect.fnUntraced(function* (
60
60
  yield* validOrFail(config.file, yield* Effect.promise(() => decodeExceptions(entries)));
61
61
  const text = yield* readInput("", config.file);
62
62
  const next = yield* Effect.try({
63
- catch: (cause) => new SetupFailure({ message: String(cause) }),
63
+ catch: (cause) => new SetupFailure({ cause, message: String(cause) }),
64
64
  try: () => migrateConfig(text, config.file, entries, config.biomeDeclarations.length > 0),
65
65
  });
66
66
  const updates: Array<{ readonly path: string; readonly text: string }> = [{ path: config.file, text: next }];
@@ -69,7 +69,7 @@ export const migrateExceptions = Effect.fnUntraced(function* (
69
69
  const biome = yield* readInput(config.root, file);
70
70
  if (biome !== undefined) {
71
71
  const updated = yield* Effect.try({
72
- catch: (cause) => new SetupFailure({ message: String(cause) }),
72
+ catch: (cause) => new SetupFailure({ cause, message: String(cause) }),
73
73
  try: () => migrateBiome(biome, file, config.biomeDeclarations),
74
74
  });
75
75
  updates.push({ path: join(config.root, file), text: updated });
@@ -77,11 +77,13 @@ export const migrateExceptions = Effect.fnUntraced(function* (
77
77
  }
78
78
  }
79
79
  for (const update of updates) {
80
- yield* writeText(update.path, update.text).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
80
+ yield* writeText(update.path, update.text).pipe(Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
81
81
  }
82
82
  if (raw !== undefined) {
83
83
  const fs = yield* FileSystem.FileSystem;
84
- yield* fs.remove(join(config.root, registryPath)).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
84
+ yield* fs
85
+ .remove(join(config.root, registryPath))
86
+ .pipe(Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })));
85
87
  }
86
88
  yield* Console.log(`quality: moved exceptions to ${config.file}. Run quality fix and review the changes; remove unused declaration imports.`);
87
89
  });
@@ -34,8 +34,6 @@ const ConfigInput = Schema.Struct({
34
34
 
35
35
  export type ConfigInput = typeof ConfigInput.Type;
36
36
 
37
- const standard = Schema.toStandardSchemaV1(ConfigInput, { parseOptions: { errors: "all", onExcessProperty: "error" } });
38
-
39
37
  export function decodeConfig(value: unknown): Promise<Decoded<ConfigInput>> {
40
- return decodeWith(standard, value);
38
+ return decodeWith(ConfigInput, value);
41
39
  }
@@ -27,7 +27,7 @@ function messageOf(cause: unknown): string {
27
27
  function importDefault(file: string): Effect.Effect<unknown, SetupFailure> {
28
28
  return Effect.flatMap(
29
29
  Effect.tryPromise({
30
- catch: (cause) => new SetupFailure({ message: `cannot load ${file}: ${messageOf(cause)}` }),
30
+ catch: (cause) => new SetupFailure({ cause, message: `cannot load ${file}: ${messageOf(cause)}` }),
31
31
  try: async (): Promise<unknown> => import(pathToFileURL(file).href),
32
32
  }),
33
33
  (loaded) =>
@@ -71,7 +71,7 @@ export const loadConfig = Effect.fn("Config.loadConfig")(function* (
71
71
  Effect.catchTag("PlatformError", (error) =>
72
72
  error.reason._tag === "NotFound"
73
73
  ? Effect.succeed<string[]>([])
74
- : Effect.fail(new SetupFailure({ message: `cannot inspect ${file}: ${error.message}` })),
74
+ : Effect.fail(new SetupFailure({ cause: error, message: `cannot inspect ${file}: ${error.message}` })),
75
75
  ),
76
76
  );
77
77
  const present = entries.includes(basename(file));
package/src/decoded.ts CHANGED
@@ -1,12 +1,16 @@
1
- import { Effect } from "effect";
1
+ import { Effect, Result, Schema, SchemaIssue } from "effect";
2
2
  import { SetupFailure } from "./failure.ts";
3
- import { describeIssue, type StandardSchemaV1 } from "./standardSchema.ts";
3
+ import { describeIssue } from "./standardSchema.ts";
4
4
 
5
5
  export type Decoded<TValue> = { readonly _tag: "Valid"; readonly value: TValue } | { readonly _tag: "Invalid"; readonly issues: readonly string[] };
6
6
 
7
- export async function decodeWith<TOutput>(schema: StandardSchemaV1<unknown, TOutput>, value: unknown): Promise<Decoded<TOutput>> {
8
- const result = await schema["~standard"].validate(value);
9
- return result.issues === undefined ? { _tag: "Valid", value: result.value } : { _tag: "Invalid", issues: result.issues.map(describeIssue) };
7
+ export function decodeWith<TSchema extends Schema.ConstraintDecoder<unknown>>(schema: TSchema, value: unknown): Promise<Decoded<TSchema["Type"]>> {
8
+ const result = Schema.decodeUnknownResult(schema, { errors: "all", onExcessProperty: "error" })(value);
9
+ return Promise.resolve(
10
+ Result.isSuccess(result)
11
+ ? { _tag: "Valid", value: result.success }
12
+ : { _tag: "Invalid", issues: SchemaIssue.makeFormatterStandardSchemaV1()(result.failure.issue).issues.map(describeIssue) },
13
+ );
10
14
  }
11
15
 
12
16
  export function validOrFail<TValue>(file: string, decoded: Decoded<TValue>): Effect.Effect<TValue, SetupFailure> {
@@ -3,7 +3,7 @@ import ts from "typescript";
3
3
  import { exportEntry, exportTargets } from "#imports/packageExports.ts";
4
4
  import type { WorkspacePackage } from "#imports/workspace.ts";
5
5
 
6
- export type DocumentedModule = { readonly kind: "missing" } | { readonly kind: "private" } | { readonly kind: "source"; readonly path: string };
6
+ export type DocumentedModule = { readonly kind: "missing" } | { readonly kind: "source"; readonly path: string };
7
7
 
8
8
  const BUILT = /^\.\/dist\/(?<path>.+?)(?:\.d)?\.[cm]?[jt]s$/u;
9
9
 
@@ -31,9 +31,6 @@ export function documentedModule(root: string, owner: WorkspacePackage, exports:
31
31
  if (entry === undefined) {
32
32
  return MISSING;
33
33
  }
34
- if (entry[1] === null) {
35
- return { kind: "private" };
36
- }
37
34
  const [prefix = "", suffix = ""] = entry[0].split("*");
38
35
  const star = subpath.slice(prefix.length, subpath.length - suffix.length);
39
36
  return found(
@@ -29,11 +29,6 @@ function problem(
29
29
  if (module.kind === "missing") {
30
30
  return Effect.succeed(`"${entry.specifier}" names no module of ${owner.name}. Use the path of a module its package.json "exports" maps.`);
31
31
  }
32
- if (module.kind === "private") {
33
- return Effect.succeed(
34
- `"${entry.specifier}" is private: the package.json "exports" of ${owner.name} blocks it. Document a module the package exports.`,
35
- );
36
- }
37
32
  const name = entry.name;
38
33
  if (name === undefined) {
39
34
  return Effect.succeed(undefined);
@@ -14,14 +14,14 @@ export interface BaselineFile {
14
14
  }
15
15
 
16
16
  export function readInput(root: string, path: string): Effect.Effect<string | undefined, SetupFailure, FileSystem.FileSystem> {
17
- return Effect.mapError(readOptionalText(join(root, path)), (failure) => new SetupFailure({ message: failure.message }));
17
+ return Effect.mapError(readOptionalText(join(root, path)), (failure) => new SetupFailure({ cause: failure, message: failure.message }));
18
18
  }
19
19
 
20
20
  export const readBaseline = Effect.fn("Engine.readBaseline")(function* (
21
21
  config: ResolvedConfig,
22
22
  ): Effect.fn.Return<BaselineFile, SetupFailure, FileSystem.FileSystem> {
23
23
  const files = new Map<string, Shard>();
24
- for (const path of yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ message: error.message })))) {
24
+ for (const path of yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })))) {
25
25
  const raw = yield* readInput(config.root, path);
26
26
  if (raw === undefined) {
27
27
  continue;