@shivaedev/quality 0.44.1 → 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 (442) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +23 -12
  3. package/biome/preset.json +11 -2
  4. package/dist/PackageManifest.d.ts +25 -0
  5. package/dist/PackageManifest.d.ts.map +1 -0
  6. package/dist/PackageManifest.js +21 -0
  7. package/dist/PackageManifest.js.map +1 -0
  8. package/dist/adapters/TestOutput.d.ts +8 -0
  9. package/dist/adapters/TestOutput.d.ts.map +1 -0
  10. package/dist/adapters/TestOutput.js +5 -0
  11. package/dist/adapters/TestOutput.js.map +1 -0
  12. package/dist/adapters/knip/configuration.d.ts.map +1 -1
  13. package/dist/adapters/knip/configuration.js +2 -9
  14. package/dist/adapters/knip/configuration.js.map +1 -1
  15. package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
  16. package/dist/adapters/knip/entryPointFindings.js +13 -3
  17. package/dist/adapters/knip/entryPointFindings.js.map +1 -1
  18. package/dist/adapters/knip/run.d.ts +3 -1
  19. package/dist/adapters/knip/run.d.ts.map +1 -1
  20. package/dist/adapters/knip/run.js +8 -8
  21. package/dist/adapters/knip/run.js.map +1 -1
  22. package/dist/adapters/manifestInventory.d.ts +23 -0
  23. package/dist/adapters/manifestInventory.d.ts.map +1 -0
  24. package/dist/adapters/manifestInventory.js +63 -0
  25. package/dist/adapters/manifestInventory.js.map +1 -0
  26. package/dist/adapters/manifestReader.d.ts +3 -0
  27. package/dist/adapters/manifestReader.d.ts.map +1 -0
  28. package/dist/adapters/manifestReader.js +8 -0
  29. package/dist/adapters/manifestReader.js.map +1 -0
  30. package/dist/adapters/testProjects.d.ts.map +1 -0
  31. package/dist/{testProjects.js → adapters/testProjects.js} +4 -3
  32. package/dist/adapters/testProjects.js.map +1 -0
  33. package/dist/appTestConfig.d.ts +2 -1
  34. package/dist/appTestConfig.d.ts.map +1 -1
  35. package/dist/appTestConfig.js +3 -3
  36. package/dist/appTestConfig.js.map +1 -1
  37. package/dist/appViteConfig.d.ts +1 -1
  38. package/dist/appViteConfig.d.ts.map +1 -1
  39. package/dist/appViteConfig.js +2 -2
  40. package/dist/appViteConfig.js.map +1 -1
  41. package/dist/baseline/format.js +2 -2
  42. package/dist/baseline/format.js.map +1 -1
  43. package/dist/baseline/legacy.js +2 -2
  44. package/dist/baseline/legacy.js.map +1 -1
  45. package/dist/baseline/merge.js +1 -1
  46. package/dist/baseline/merge.js.map +1 -1
  47. package/dist/baseline/shards.js +1 -1
  48. package/dist/baseline/shards.js.map +1 -1
  49. package/dist/biome/exceptionConfig.d.ts +7 -1
  50. package/dist/biome/exceptionConfig.d.ts.map +1 -1
  51. package/dist/biome/exceptionConfig.js +20 -25
  52. package/dist/biome/exceptionConfig.js.map +1 -1
  53. package/dist/biome/recommendedRules.d.ts +2 -1
  54. package/dist/biome/recommendedRules.d.ts.map +1 -1
  55. package/dist/biome/recommendedRules.js +10 -13
  56. package/dist/biome/recommendedRules.js.map +1 -1
  57. package/dist/biome/relocateConfig.d.ts +6 -0
  58. package/dist/biome/relocateConfig.d.ts.map +1 -0
  59. package/dist/biome/relocateConfig.js +49 -0
  60. package/dist/biome/relocateConfig.js.map +1 -0
  61. package/dist/biome/report.d.ts +27 -3
  62. package/dist/biome/report.d.ts.map +1 -1
  63. package/dist/biome/report.js +12 -10
  64. package/dist/biome/report.js.map +1 -1
  65. package/dist/biome/run.d.ts +12 -2
  66. package/dist/biome/run.d.ts.map +1 -1
  67. package/dist/biome/run.js +18 -24
  68. package/dist/biome/run.js.map +1 -1
  69. package/dist/biome/withoutEntryPointImports.d.ts.map +1 -1
  70. package/dist/biome/withoutEntryPointImports.js +2 -12
  71. package/dist/biome/withoutEntryPointImports.js.map +1 -1
  72. package/dist/cli/args.d.ts +2 -1
  73. package/dist/cli/args.d.ts.map +1 -1
  74. package/dist/cli/args.js +4 -3
  75. package/dist/cli/args.js.map +1 -1
  76. package/dist/cli/baseline.d.ts +4 -3
  77. package/dist/cli/baseline.d.ts.map +1 -1
  78. package/dist/cli/baseline.js.map +1 -1
  79. package/dist/cli/ci.d.ts +1 -1
  80. package/dist/cli/ci.d.ts.map +1 -1
  81. package/dist/cli/ci.js +13 -2
  82. package/dist/cli/ci.js.map +1 -1
  83. package/dist/cli/fix.d.ts +2 -1
  84. package/dist/cli/fix.d.ts.map +1 -1
  85. package/dist/cli/fix.js +3 -9
  86. package/dist/cli/fix.js.map +1 -1
  87. package/dist/cli/lint.d.ts +3 -2
  88. package/dist/cli/lint.d.ts.map +1 -1
  89. package/dist/cli/lint.js.map +1 -1
  90. package/dist/cli/messages.d.ts +1 -1
  91. package/dist/cli/messages.d.ts.map +1 -1
  92. package/dist/cli/messages.js +2 -1
  93. package/dist/cli/messages.js.map +1 -1
  94. package/dist/cli/migrateBaseline.d.ts +3 -2
  95. package/dist/cli/migrateBaseline.d.ts.map +1 -1
  96. package/dist/cli/migrateBaseline.js +2 -2
  97. package/dist/cli/migrateBaseline.js.map +1 -1
  98. package/dist/cli/migrateExceptions.d.ts.map +1 -1
  99. package/dist/cli/migrateExceptions.js +6 -4
  100. package/dist/cli/migrateExceptions.js.map +1 -1
  101. package/dist/cli/program.d.ts +1 -1
  102. package/dist/cli/program.d.ts.map +1 -1
  103. package/dist/cli/program.js +1 -1
  104. package/dist/cli/program.js.map +1 -1
  105. package/dist/config/decode.d.ts +1 -1
  106. package/dist/config/decode.d.ts.map +1 -1
  107. package/dist/config/decode.js +1 -2
  108. package/dist/config/decode.js.map +1 -1
  109. package/dist/config/load.js +2 -2
  110. package/dist/config/load.js.map +1 -1
  111. package/dist/config/resolve.d.ts +1 -1
  112. package/dist/decoded.d.ts +2 -3
  113. package/dist/decoded.d.ts.map +1 -1
  114. package/dist/decoded.js +6 -4
  115. package/dist/decoded.js.map +1 -1
  116. package/dist/docs/documentedModule.d.ts +0 -2
  117. package/dist/docs/documentedModule.d.ts.map +1 -1
  118. package/dist/docs/documentedModule.js +0 -3
  119. package/dist/docs/documentedModule.js.map +1 -1
  120. package/dist/docs/importFindings.d.ts.map +1 -1
  121. package/dist/docs/importFindings.js +0 -3
  122. package/dist/docs/importFindings.js.map +1 -1
  123. package/dist/engine/baselineFile.js +2 -2
  124. package/dist/engine/baselineFile.js.map +1 -1
  125. package/dist/engine/runRules.d.ts +3 -4
  126. package/dist/engine/runRules.d.ts.map +1 -1
  127. package/dist/engine/runRules.js +23 -8
  128. package/dist/engine/runRules.js.map +1 -1
  129. package/dist/engine/session.d.ts +4 -3
  130. package/dist/engine/session.d.ts.map +1 -1
  131. package/dist/engine/session.js +6 -7
  132. package/dist/engine/session.js.map +1 -1
  133. package/dist/exceptions/declaration.js +2 -2
  134. package/dist/exceptions/declaration.js.map +1 -1
  135. package/dist/exceptions/registry.d.ts.map +1 -1
  136. package/dist/exceptions/registry.js +2 -4
  137. package/dist/exceptions/registry.js.map +1 -1
  138. package/dist/failure.d.ts +5 -0
  139. package/dist/failure.d.ts.map +1 -1
  140. package/dist/failure.js +4 -0
  141. package/dist/failure.js.map +1 -1
  142. package/dist/git/command.js +1 -1
  143. package/dist/git/command.js.map +1 -1
  144. package/dist/hooks/install.js +2 -2
  145. package/dist/hooks/install.js.map +1 -1
  146. package/dist/hooks/preCommit.d.ts +1 -2
  147. package/dist/hooks/preCommit.d.ts.map +1 -1
  148. package/dist/hooks/preCommit.js +10 -11
  149. package/dist/hooks/preCommit.js.map +1 -1
  150. package/dist/hooks/status.js +1 -1
  151. package/dist/hooks/status.js.map +1 -1
  152. package/dist/hooks/uninstall.js +3 -3
  153. package/dist/hooks/uninstall.js.map +1 -1
  154. package/dist/imports/classifyRuntime.d.ts +10 -0
  155. package/dist/imports/classifyRuntime.d.ts.map +1 -0
  156. package/dist/imports/classifyRuntime.js +22 -0
  157. package/dist/imports/classifyRuntime.js.map +1 -0
  158. package/dist/imports/fences/declarations.d.ts.map +1 -1
  159. package/dist/imports/fences/declarations.js +1 -2
  160. package/dist/imports/fences/declarations.js.map +1 -1
  161. package/dist/imports/pnpmWorkspacePatterns.d.ts.map +1 -1
  162. package/dist/imports/pnpmWorkspacePatterns.js +2 -1
  163. package/dist/imports/pnpmWorkspacePatterns.js.map +1 -1
  164. package/dist/imports/runtime.d.ts +4 -3
  165. package/dist/imports/runtime.d.ts.map +1 -1
  166. package/dist/imports/runtime.js +35 -64
  167. package/dist/imports/runtime.js.map +1 -1
  168. package/dist/imports/workspace.d.ts.map +1 -1
  169. package/dist/imports/workspace.js +9 -19
  170. package/dist/imports/workspace.js.map +1 -1
  171. package/dist/inventory/collect.d.ts +1 -0
  172. package/dist/inventory/collect.d.ts.map +1 -1
  173. package/dist/inventory/collect.js +2 -1
  174. package/dist/inventory/collect.js.map +1 -1
  175. package/dist/inventory/filesystem.d.ts.map +1 -1
  176. package/dist/inventory/filesystem.js +2 -8
  177. package/dist/inventory/filesystem.js.map +1 -1
  178. package/dist/manifests/entryPoints.d.ts.map +1 -1
  179. package/dist/manifests/entryPoints.js +2 -12
  180. package/dist/manifests/entryPoints.js.map +1 -1
  181. package/dist/manifests/sorted.d.ts +2 -3
  182. package/dist/manifests/sorted.d.ts.map +1 -1
  183. package/dist/manifests/sorted.js +14 -8
  184. package/dist/manifests/sorted.js.map +1 -1
  185. package/dist/naming/packageLayout.d.ts.map +1 -1
  186. package/dist/naming/packageLayout.js +2 -12
  187. package/dist/naming/packageLayout.js.map +1 -1
  188. package/dist/rule.d.ts +15 -10
  189. package/dist/rule.d.ts.map +1 -1
  190. package/dist/rule.js +9 -1
  191. package/dist/rule.js.map +1 -1
  192. package/dist/rules/biome.d.ts.map +1 -1
  193. package/dist/rules/biome.js +7 -4
  194. package/dist/rules/biome.js.map +1 -1
  195. package/dist/rules/builtIn.d.ts +14 -14
  196. package/dist/rules/builtIn.d.ts.map +1 -1
  197. package/dist/rules/builtIn.js +8 -0
  198. package/dist/rules/builtIn.js.map +1 -1
  199. package/dist/rules/comments/maxPerFile.d.ts +1 -1
  200. package/dist/rules/comments/maxPerFile.d.ts.map +1 -1
  201. package/dist/rules/comments/noBanner.d.ts +1 -1
  202. package/dist/rules/comments/noBanner.d.ts.map +1 -1
  203. package/dist/rules/comments/noEnvironmentPragma.d.ts +1 -1
  204. package/dist/rules/comments/noEnvironmentPragma.d.ts.map +1 -1
  205. package/dist/rules/comments/noEnvironmentPragma.js +1 -1
  206. package/dist/rules/comments/noEnvironmentPragma.js.map +1 -1
  207. package/dist/rules/comments/noJsdoc.d.ts +1 -1
  208. package/dist/rules/comments/noJsdoc.d.ts.map +1 -1
  209. package/dist/rules/comments/noLineReference.d.ts +1 -1
  210. package/dist/rules/comments/noLineReference.d.ts.map +1 -1
  211. package/dist/rules/comments/noPrReference.d.ts +1 -1
  212. package/dist/rules/comments/noPrReference.d.ts.map +1 -1
  213. package/dist/rules/comments/noTodo.d.ts +1 -1
  214. package/dist/rules/comments/noTodo.d.ts.map +1 -1
  215. package/dist/rules/docs/references.d.ts +1 -1
  216. package/dist/rules/docs/references.d.ts.map +1 -1
  217. package/dist/rules/docs/references.js +5 -8
  218. package/dist/rules/docs/references.js.map +1 -1
  219. package/dist/rules/docs/unversionedInstalls.d.ts +1 -1
  220. package/dist/rules/docs/unversionedInstalls.d.ts.map +1 -1
  221. package/dist/rules/docs/unversionedInstalls.js +1 -1
  222. package/dist/rules/docs/unversionedInstalls.js.map +1 -1
  223. package/dist/rules/effect/boundary.d.ts +1 -1
  224. package/dist/rules/effect/boundary.d.ts.map +1 -1
  225. package/dist/rules/effect/serviceParameters.d.ts +1 -1
  226. package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
  227. package/dist/rules/effect/serviceTypes.d.ts.map +1 -1
  228. package/dist/rules/effect/serviceTypes.js +10 -0
  229. package/dist/rules/effect/serviceTypes.js.map +1 -1
  230. package/dist/rules/files/distinctCase.d.ts +1 -1
  231. package/dist/rules/files/distinctCase.d.ts.map +1 -1
  232. package/dist/rules/files/folderNames.d.ts +1 -1
  233. package/dist/rules/files/folderNames.d.ts.map +1 -1
  234. package/dist/rules/files/namedAfterExport.d.ts +1 -1
  235. package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
  236. package/dist/rules/files/otherNames.d.ts +1 -1
  237. package/dist/rules/files/otherNames.d.ts.map +1 -1
  238. package/dist/rules/files/packageImports.d.ts.map +1 -1
  239. package/dist/rules/files/packageImports.js +2 -13
  240. package/dist/rules/files/packageImports.js.map +1 -1
  241. package/dist/rules/imports/aliased.d.ts +1 -1
  242. package/dist/rules/imports/aliased.d.ts.map +1 -1
  243. package/dist/rules/imports/cycles.d.ts +1 -1
  244. package/dist/rules/imports/cycles.d.ts.map +1 -1
  245. package/dist/rules/imports/fences.d.ts +1 -1
  246. package/dist/rules/imports/fences.d.ts.map +1 -1
  247. package/dist/rules/imports/manifest.d.ts +1 -1
  248. package/dist/rules/imports/manifest.d.ts.map +1 -1
  249. package/dist/rules/imports/manifest.js +14 -32
  250. package/dist/rules/imports/manifest.js.map +1 -1
  251. package/dist/rules/imports/noTestCode.d.ts +1 -1
  252. package/dist/rules/imports/noTestCode.d.ts.map +1 -1
  253. package/dist/rules/imports/resolvable.d.ts +1 -1
  254. package/dist/rules/imports/resolvable.d.ts.map +1 -1
  255. package/dist/rules/imports/runtime.d.ts +1 -1
  256. package/dist/rules/imports/runtime.d.ts.map +1 -1
  257. package/dist/rules/imports/runtime.js +29 -25
  258. package/dist/rules/imports/runtime.js.map +1 -1
  259. package/dist/rules/manifestsApplication.d.ts +1 -1
  260. package/dist/rules/manifestsApplication.d.ts.map +1 -1
  261. package/dist/rules/manifestsApplication.js +2 -12
  262. package/dist/rules/manifestsApplication.js.map +1 -1
  263. package/dist/rules/manifestsExportsShape.d.ts +1 -1
  264. package/dist/rules/manifestsExportsShape.d.ts.map +1 -1
  265. package/dist/rules/manifestsExportsShape.js +12 -7
  266. package/dist/rules/manifestsExportsShape.js.map +1 -1
  267. package/dist/rules/manifestsSorted.d.ts +1 -1
  268. package/dist/rules/manifestsSorted.d.ts.map +1 -1
  269. package/dist/rules/manifestsSorted.js +10 -14
  270. package/dist/rules/manifestsSorted.js.map +1 -1
  271. package/dist/rules/manifestsSourceFirst.d.ts +1 -1
  272. package/dist/rules/manifestsSourceFirst.d.ts.map +1 -1
  273. package/dist/rules/manifestsSourceFirst.js +20 -23
  274. package/dist/rules/manifestsSourceFirst.js.map +1 -1
  275. package/dist/rules/manifestsValid.d.ts +2 -0
  276. package/dist/rules/manifestsValid.d.ts.map +1 -0
  277. package/dist/rules/manifestsValid.js +10 -0
  278. package/dist/rules/manifestsValid.js.map +1 -0
  279. package/dist/rules/maxDepth.d.ts +1 -1
  280. package/dist/rules/maxDepth.d.ts.map +1 -1
  281. package/dist/rules/maxLines.d.ts +1 -1
  282. package/dist/rules/maxLines.d.ts.map +1 -1
  283. package/dist/rules/noBarrel.d.ts +1 -1
  284. package/dist/rules/noBarrel.d.ts.map +1 -1
  285. package/dist/rules/react/jsxConditionals.d.ts +1 -1
  286. package/dist/rules/react/jsxConditionals.d.ts.map +1 -1
  287. package/dist/rules/stories/authSql.d.ts +1 -1
  288. package/dist/rules/stories/authSql.d.ts.map +1 -1
  289. package/dist/rules/stories/authSql.js +22 -3
  290. package/dist/rules/stories/authSql.js.map +1 -1
  291. package/dist/rules/stories/domainOutcomes.d.ts +2 -0
  292. package/dist/rules/stories/domainOutcomes.d.ts.map +1 -0
  293. package/dist/rules/stories/domainOutcomes.js +34 -0
  294. package/dist/rules/stories/domainOutcomes.js.map +1 -0
  295. package/dist/rules/stories/engine.d.ts +1 -1
  296. package/dist/rules/stories/engine.d.ts.map +1 -1
  297. package/dist/rules/stories/groupedOutcomes.d.ts +2 -0
  298. package/dist/rules/stories/groupedOutcomes.d.ts.map +1 -0
  299. package/dist/rules/stories/groupedOutcomes.js +55 -0
  300. package/dist/rules/stories/groupedOutcomes.js.map +1 -0
  301. package/dist/rules/stories/httpStatus.d.ts +1 -1
  302. package/dist/rules/stories/httpStatus.d.ts.map +1 -1
  303. package/dist/rules/stories/importBindings.d.ts +8 -0
  304. package/dist/rules/stories/importBindings.d.ts.map +1 -0
  305. package/dist/rules/stories/importBindings.js +29 -0
  306. package/dist/rules/stories/importBindings.js.map +1 -0
  307. package/dist/rules/stories/namedValues.d.ts +1 -1
  308. package/dist/rules/stories/namedValues.d.ts.map +1 -1
  309. package/dist/rules/stories/noExpect.d.ts +1 -1
  310. package/dist/rules/stories/noExpect.d.ts.map +1 -1
  311. package/dist/rules/stories/noLimitImports.d.ts +1 -1
  312. package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
  313. package/dist/rules/stories/prerequisites.d.ts.map +1 -1
  314. package/dist/rules/stories/prerequisites.js +3 -6
  315. package/dist/rules/stories/prerequisites.js.map +1 -1
  316. package/dist/rules/stories/queueSql.d.ts +1 -1
  317. package/dist/rules/stories/queueSql.d.ts.map +1 -1
  318. package/dist/rules/stories/setup.d.ts +1 -1
  319. package/dist/rules/stories/setup.d.ts.map +1 -1
  320. package/dist/rules/stories/sources.d.ts +4 -0
  321. package/dist/rules/stories/sources.d.ts.map +1 -0
  322. package/dist/rules/stories/sources.js +17 -0
  323. package/dist/rules/stories/sources.js.map +1 -0
  324. package/dist/rules/stories/specHelpers.d.ts +1 -1
  325. package/dist/rules/stories/specHelpers.d.ts.map +1 -1
  326. package/dist/rules/stories/specs.d.ts +1 -1
  327. package/dist/rules/stories/specs.d.ts.map +1 -1
  328. package/dist/rules/stories/waitOnEvents.d.ts +2 -0
  329. package/dist/rules/stories/waitOnEvents.d.ts.map +1 -0
  330. package/dist/rules/stories/waitOnEvents.js +52 -0
  331. package/dist/rules/stories/waitOnEvents.js.map +1 -0
  332. package/dist/rules/suppressions/biome/declarations.d.ts.map +1 -1
  333. package/dist/rules/suppressions/biome/declarations.js +2 -4
  334. package/dist/rules/suppressions/biome/declarations.js.map +1 -1
  335. package/dist/rules/suppressions/biome/resolvePackage.d.ts.map +1 -1
  336. package/dist/rules/suppressions/biome/resolvePackage.js +3 -15
  337. package/dist/rules/suppressions/biome/resolvePackage.js.map +1 -1
  338. package/dist/rules/suppressions/biomeOverrides.d.ts +1 -1
  339. package/dist/rules/suppressions/biomeOverrides.d.ts.map +1 -1
  340. package/dist/rules/suppressions/biomeRecommended.d.ts +6 -3
  341. package/dist/rules/suppressions/biomeRecommended.d.ts.map +1 -1
  342. package/dist/rules/suppressions/biomeRecommended.js +10 -7
  343. package/dist/rules/suppressions/biomeRecommended.js.map +1 -1
  344. package/dist/rules/suppressions/noDoubleCast.d.ts +1 -1
  345. package/dist/rules/suppressions/noDoubleCast.d.ts.map +1 -1
  346. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts +1 -1
  347. package/dist/rules/suppressions/noIgnoreDeprecations.d.ts.map +1 -1
  348. package/dist/rules/suppressions/noIgnoreDeprecations.js +7 -7
  349. package/dist/rules/suppressions/noIgnoreDeprecations.js.map +1 -1
  350. package/dist/rules/suppressions/noInline.d.ts +1 -1
  351. package/dist/rules/suppressions/noInline.d.ts.map +1 -1
  352. package/dist/rules/test-names/colocated.d.ts +1 -1
  353. package/dist/rules/test-names/colocated.d.ts.map +1 -1
  354. package/dist/rules/test-names/follow.d.ts +1 -1
  355. package/dist/rules/test-names/follow.d.ts.map +1 -1
  356. package/dist/rules/unusedCode.d.ts +1 -1
  357. package/dist/rules/unusedCode.d.ts.map +1 -1
  358. package/package.json +10 -15
  359. package/src/PackageManifest.ts +24 -0
  360. package/src/adapters/TestOutput.ts +9 -0
  361. package/src/adapters/knip/configuration.ts +2 -10
  362. package/src/adapters/knip/entryPointFindings.ts +17 -3
  363. package/src/adapters/knip/run.ts +42 -44
  364. package/src/adapters/manifestInventory.ts +87 -0
  365. package/src/adapters/manifestReader.ts +11 -0
  366. package/src/{testProjects.ts → adapters/testProjects.ts} +4 -3
  367. package/src/appTestConfig.ts +3 -3
  368. package/src/appViteConfig.ts +2 -2
  369. package/src/baseline/format.ts +2 -2
  370. package/src/baseline/legacy.ts +2 -2
  371. package/src/baseline/merge.ts +1 -1
  372. package/src/baseline/shards.ts +1 -1
  373. package/src/biome/exceptionConfig.ts +22 -29
  374. package/src/biome/recommendedRules.ts +18 -16
  375. package/src/biome/relocateConfig.ts +59 -0
  376. package/src/biome/report.ts +17 -11
  377. package/src/biome/run.ts +29 -28
  378. package/src/biome/withoutEntryPointImports.ts +2 -12
  379. package/src/cli/args.ts +5 -4
  380. package/src/cli/baseline.ts +3 -2
  381. package/src/cli/ci.ts +14 -2
  382. package/src/cli/fix.ts +15 -17
  383. package/src/cli/lint.ts +3 -2
  384. package/src/cli/messages.ts +2 -1
  385. package/src/cli/migrateBaseline.ts +4 -3
  386. package/src/cli/migrateExceptions.ts +6 -4
  387. package/src/cli/program.ts +1 -1
  388. package/src/config/decode.ts +1 -3
  389. package/src/config/load.ts +2 -2
  390. package/src/decoded.ts +9 -5
  391. package/src/docs/documentedModule.ts +1 -4
  392. package/src/docs/importFindings.ts +0 -5
  393. package/src/engine/baselineFile.ts +2 -2
  394. package/src/engine/runRules.ts +34 -15
  395. package/src/engine/session.ts +11 -10
  396. package/src/exceptions/declaration.ts +2 -2
  397. package/src/exceptions/registry.ts +2 -4
  398. package/src/failure.ts +6 -1
  399. package/src/git/command.ts +1 -1
  400. package/src/hooks/install.ts +2 -2
  401. package/src/hooks/preCommit.ts +10 -16
  402. package/src/hooks/status.ts +1 -1
  403. package/src/hooks/uninstall.ts +3 -3
  404. package/src/imports/classifyRuntime.ts +30 -0
  405. package/src/imports/fences/declarations.ts +1 -3
  406. package/src/imports/pnpmWorkspacePatterns.ts +3 -1
  407. package/src/imports/runtime.ts +48 -60
  408. package/src/imports/workspace.ts +9 -20
  409. package/src/inventory/collect.ts +3 -1
  410. package/src/inventory/filesystem.ts +2 -10
  411. package/src/manifests/entryPoints.ts +2 -12
  412. package/src/manifests/sorted.ts +21 -9
  413. package/src/naming/packageLayout.ts +2 -12
  414. package/src/rule.ts +38 -19
  415. package/src/rules/biome.ts +9 -5
  416. package/src/rules/builtIn.ts +8 -0
  417. package/src/rules/comments/noEnvironmentPragma.ts +1 -1
  418. package/src/rules/docs/references.ts +8 -10
  419. package/src/rules/docs/unversionedInstalls.ts +1 -1
  420. package/src/rules/effect/serviceTypes.ts +13 -0
  421. package/src/rules/files/packageImports.ts +2 -13
  422. package/src/rules/imports/manifest.ts +15 -32
  423. package/src/rules/imports/runtime.ts +41 -35
  424. package/src/rules/manifestsApplication.ts +2 -12
  425. package/src/rules/manifestsExportsShape.ts +11 -8
  426. package/src/rules/manifestsSorted.ts +13 -16
  427. package/src/rules/manifestsSourceFirst.ts +24 -24
  428. package/src/rules/manifestsValid.ts +14 -0
  429. package/src/rules/stories/authSql.ts +25 -3
  430. package/src/rules/stories/domainOutcomes.ts +44 -0
  431. package/src/rules/stories/groupedOutcomes.ts +66 -0
  432. package/src/rules/stories/importBindings.ts +37 -0
  433. package/src/rules/stories/prerequisites.ts +4 -8
  434. package/src/rules/stories/sources.ts +20 -0
  435. package/src/rules/stories/waitOnEvents.ts +61 -0
  436. package/src/rules/suppressions/biome/declarations.ts +2 -4
  437. package/src/rules/suppressions/biome/resolvePackage.ts +5 -21
  438. package/src/rules/suppressions/biomeRecommended.ts +14 -9
  439. package/src/rules/suppressions/noIgnoreDeprecations.ts +11 -8
  440. package/dist/testProjects.d.ts.map +0 -1
  441. package/dist/testProjects.js.map +0 -1
  442. /package/dist/{testProjects.d.ts → adapters/testProjects.d.ts} +0 -0
@@ -1,7 +1,8 @@
1
1
  import { fileURLToPath } from "node:url";
2
- import { Config, ConfigProvider, Effect } from "effect";
2
+ import { Effect } from "effect";
3
3
  import { coverageConfigDefaults, defaultExclude, type TestUserConfig } from "vitest/config";
4
4
  import type { Environment } from "#naming/testName.ts";
5
+ import { TestOutput } from "./TestOutput.ts";
5
6
 
6
7
  const EXTENSION = "?(c|m)[jt]s?(x)";
7
8
 
@@ -41,7 +42,7 @@ function workerCount({ connectionBudget = 80, connectionsPerWorker = 14, maxWork
41
42
 
42
43
  export function testProjects(options: TestProjectsOptions = {}): TestUserConfig {
43
44
  const { coverage = false } = options;
44
- const ci = Effect.runSync(Config.String("CI").pipe(Config.withDefault("")).parse(ConfigProvider.fromEnv()));
45
+ const output = Effect.runSync(TestOutput.pipe(Effect.provide(TestOutput.layer)));
45
46
  return {
46
47
  maxWorkers: workerCount(options),
47
48
  ...(coverage === false
@@ -82,7 +83,7 @@ export function testProjects(options: TestProjectsOptions = {}): TestUserConfig
82
83
  },
83
84
  { extends: true, test: { environment: "node", exclude: excluding(), include: [named("slow")], name: "slow" } },
84
85
  ],
85
- silent: ci ? false : "passed-only",
86
+ ...output,
86
87
  // Tests that start real servers, browsers or CLIs need seconds on a busy CI runner, and Vitest's 5s default fails them for load, not behavior.
87
88
  testTimeout: 30_000,
88
89
  };
@@ -1,10 +1,10 @@
1
1
  import { defineConfig } from "vitest/config";
2
- import { testProjects } from "#testProjects.ts";
2
+ import { type TestProjectsOptions, testProjects } from "#adapters/testProjects.ts";
3
3
 
4
- export function appTestConfig(conditions: string[] = []) {
4
+ export function appTestConfig(conditions: string[] = [], options: Pick<TestProjectsOptions, "coverage"> = {}) {
5
5
  return defineConfig({
6
6
  resolve: { conditions: [...conditions, "module", "browser", "development|production"] },
7
7
  ssr: { resolve: { conditions: [...conditions, "node", "development|production"] } },
8
- test: { ...testProjects(), server: { deps: { inline: [/^@shivaedev\//u] } } },
8
+ test: { ...testProjects(options), server: { deps: { inline: [/^@shivaedev\//u] } } },
9
9
  });
10
10
  }
@@ -1,11 +1,11 @@
1
- export function appViteConfig<TPlugin>(plugins: TPlugin[], conditions: string[] = []) {
1
+ export function appViteConfig<TPlugin>(plugins: TPlugin[], conditions: string[] = [], proxyPaths: string[] = []) {
2
2
  return {
3
3
  plugins,
4
4
  resolve: { conditions, tsconfigPaths: true },
5
5
  server: {
6
6
  host: "127.0.0.1",
7
7
  port: 5173,
8
- proxy: Object.fromEntries(["/api/auth", "/rpc"].map((path) => [path, { changeOrigin: false, target: "http://127.0.0.1:3000" }])),
8
+ proxy: Object.fromEntries(["/api/auth", "/rpc", ...proxyPaths].map((path) => [path, { changeOrigin: false, target: "http://127.0.0.1:3000" }])),
9
9
  strictPort: true,
10
10
  },
11
11
  };
@@ -8,7 +8,7 @@ const Line = Schema.Struct({
8
8
  rule: Schema.NonEmptyString,
9
9
  });
10
10
 
11
- const standard = Schema.toStandardSchemaV1(Schema.fromJsonString(Line), { parseOptions: { errors: "all", onExcessProperty: "error" } });
11
+ const BaselineLine = Schema.fromJsonString(Line);
12
12
 
13
13
  export interface BaselineEntry {
14
14
  readonly count: number;
@@ -36,7 +36,7 @@ export async function decodeBaseline(raw: string | undefined): Promise<Decoded<r
36
36
  const entries: BaselineEntry[] = [];
37
37
  const seen = new Set<string>();
38
38
  for (const { line, text } of linesOf(raw)) {
39
- const decoded = await decodeWith(standard, text);
39
+ const decoded = await decodeWith(BaselineLine, text);
40
40
  if (decoded._tag === "Invalid") {
41
41
  issues.push(...decoded.issues.map((issue) => `line ${line}: ${issue}`));
42
42
  continue;
@@ -13,14 +13,14 @@ const Entry = Schema.Struct({
13
13
 
14
14
  const LegacyFile = Schema.Record(Schema.String, Schema.Record(Schema.String, Entry));
15
15
 
16
- const standard = Schema.toStandardSchemaV1(Schema.fromJsonString(LegacyFile), { parseOptions: { errors: "all", onExcessProperty: "error" } });
16
+ const LegacySchema = Schema.fromJsonString(LegacyFile);
17
17
 
18
18
  export interface LegacyEntry extends BaselineEntry {
19
19
  readonly measure?: number | undefined;
20
20
  }
21
21
 
22
22
  export async function decodeLegacyBaseline(raw: string): Promise<Decoded<readonly LegacyEntry[]>> {
23
- const decoded = await decodeWith(standard, raw);
23
+ const decoded = await decodeWith(LegacySchema, raw);
24
24
  if (decoded._tag === "Invalid") {
25
25
  return decoded;
26
26
  }
@@ -30,5 +30,5 @@ export const mergeBaseline = Effect.fn("Baseline.mergeBaseline")(
30
30
  );
31
31
  yield* fs.writeFileString(ours, encodeBaseline(mergeEntries(entries[0] ?? [], entries[1] ?? [], entries[2] ?? [])));
32
32
  },
33
- Effect.mapError((failure) => new SetupFailure({ message: failure.message })),
33
+ Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })),
34
34
  );
@@ -56,5 +56,5 @@ export const saveShards = Effect.fn("Baseline.saveShards")(
56
56
  }
57
57
  }
58
58
  },
59
- Effect.mapError((failure) => new SetupFailure({ message: failure.message })),
59
+ Effect.mapError((failure) => new SetupFailure({ cause: failure, message: failure.message })),
60
60
  );
@@ -1,9 +1,8 @@
1
- import { randomUUID } from "node:crypto";
2
- import { access, readFile, rm, writeFile } from "node:fs/promises";
3
1
  import { join } from "node:path";
4
- import { Schema } from "effect";
5
- import ts from "typescript";
2
+ import { Effect, Schema } from "effect";
6
3
  import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
4
+ import { readOptionalText } from "#inventory/filesystem.ts";
5
+ import { parseConfig, relocateConfig } from "./relocateConfig.ts";
7
6
 
8
7
  function nativeOverride(files: readonly string[], rule: string): unknown {
9
8
  const [, tool, group = "", name = ""] = rule.split("/");
@@ -25,47 +24,41 @@ export function exceptionConfig(declarations: readonly ExceptionDeclaration[]):
25
24
  };
26
25
  }
27
26
 
28
- export async function withExceptionConfig<TValue>(
27
+ export const withExceptionConfig = Effect.fn("Biome.withExceptionConfig")(function* <TValue, TError, TRequirements>(
29
28
  root: string,
30
29
  declarations: readonly ExceptionDeclaration[],
31
- run: (args: readonly string[]) => Promise<TValue>,
32
- ): Promise<TValue> {
30
+ run: (args: readonly string[]) => Effect.Effect<TValue, TError, TRequirements>,
31
+ ) {
33
32
  const { includes, overrides } = exceptionConfig(declarations);
34
33
  if (includes.length === 0 && overrides.length === 0) {
35
- return run([]);
34
+ return yield* run([]);
36
35
  }
37
- const name = `.quality-biome-${randomUUID()}.json`;
38
- const path = join(root, name);
39
- const config = await access(join(root, "biome.json")).then(
40
- () => "biome.json",
41
- () => "biome.jsonc",
42
- );
43
- const text = await readFile(join(root, config), "utf8");
44
- const parsed = ts.parseConfigFileTextToJson(config, text);
45
- if (parsed.error !== undefined) {
46
- throw new Error(`Cannot load ${config}: ${ts.flattenDiagnosticMessageText(parsed.error.messageText, " ")}`);
47
- }
48
- const own = Schema.decodeUnknownSync(Schema.Record(Schema.String, Schema.Unknown))(parsed.config);
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 };
41
+ }
42
+ }
43
+ return { config: "biome.json", text: "{}" };
44
+ });
45
+ const own = yield* parseConfig(config, text);
49
46
  const files = Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files) ? own.files : {};
50
47
  if (
51
48
  (own.files !== undefined && !Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files))
52
49
  || (files.includes !== undefined && !Array.isArray(files.includes))
53
50
  || (own.overrides !== undefined && !Array.isArray(own.overrides))
54
51
  ) {
55
- 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.`));
56
53
  }
57
54
  const previousIncludes = Array.isArray(files.includes) ? files.includes : ["**"];
58
55
  const previousOverrides = Array.isArray(own.overrides) ? own.overrides : [];
59
56
  // Biome also matches a wildcard-led glob such as `!**/.worktrees` against the folders above the root, which ignores a whole linked worktree.
60
57
  const generated = {
61
58
  ...own,
62
- files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", `!${name}`] },
59
+ files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", "!.quality-biome-*"] },
63
60
  overrides: [...previousOverrides, ...overrides],
64
61
  };
65
- try {
66
- await writeFile(path, JSON.stringify(generated), { flag: "wx" });
67
- return await run([`--config-path=${path}`]);
68
- } finally {
69
- await rm(path, { force: true });
70
- }
71
- }
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", `--config-path=${directory}`]);
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,30 +14,32 @@ 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)));
20
- const toolOwned: readonly ExceptionDeclaration[] =
21
- folders.length === 0
22
- ? []
23
- : [
24
- {
25
- files: ["**", ...folders.map((folder) => `!${folder}`)],
26
- reason: "components.json assigns these folders to the shadcn CLI.",
27
- rules: ["biome/files/includes"],
28
- },
29
- ];
30
- return withExceptionConfig(
31
- root,
32
- [...exceptions, ...toolOwned],
33
- (configArgs) =>
34
- new Promise((resolve, reject) => {
35
- execFile(process.execPath, [BIN, ...args, ...configArgs, "--colors=off"], { cwd: root, maxBuffer: 2 ** 30 }, (error, stdout, stderr) => {
36
- if (error !== null && typeof error.code !== "number") {
37
- reject(error);
38
- return;
39
- }
40
- resolve({ code: error === null ? 0 : Number(error.code), stderr, stdout });
41
- });
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);
23
+ const toolOwned: readonly ExceptionDeclaration[] = [
24
+ {
25
+ files: ["**", "!**/pnpm-lock.yaml", ...folders.map((folder) => `!${folder}`)],
26
+ reason: "pnpm writes its lockfiles; components.json assigns UI folders to the shadcn CLI.",
27
+ rules: ["biome/files/includes"],
28
+ },
29
+ ];
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 };
42
42
  }),
43
+ ),
43
44
  );
44
- }
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
  }
package/src/cli/args.ts CHANGED
@@ -3,7 +3,7 @@ import { Result } from "effect";
3
3
  import { USAGE as COMMAND_USAGE, SUBCOMMANDS } from "./messages.ts";
4
4
 
5
5
  export type Command =
6
- | { readonly _tag: "Ci" }
6
+ | { readonly _tag: "Ci"; readonly coverage: boolean }
7
7
  | { readonly _tag: "Setup"; readonly config: string | undefined }
8
8
  | { readonly _tag: "Lint"; readonly config: string | undefined }
9
9
  | { readonly _tag: "ExceptionsMigrate"; readonly config: string | undefined; readonly from: string | undefined }
@@ -27,6 +27,7 @@ export const USAGE = COMMAND_USAGE;
27
27
  const OPTIONS = {
28
28
  against: { type: "string" },
29
29
  config: { type: "string" },
30
+ coverage: { type: "boolean" },
30
31
  force: { type: "boolean" },
31
32
  from: { type: "string" },
32
33
  help: { short: "h", type: "boolean" },
@@ -46,7 +47,7 @@ type Values = ReturnType<typeof parseArgs<{ options: typeof OPTIONS; allowPositi
46
47
 
47
48
  type Option = Exclude<keyof Values, "config" | "help">;
48
49
 
49
- const COMMAND_OPTIONS: readonly Option[] = ["against", "force", "from", "rule", "staged"];
50
+ const COMMAND_OPTIONS: readonly Option[] = ["against", "coverage", "force", "from", "rule", "staged"];
50
51
 
51
52
  const ACCEPTS: Readonly<Record<string, readonly Option[]>> = {
52
53
  "baseline install-driver": [],
@@ -54,7 +55,7 @@ const ACCEPTS: Readonly<Record<string, readonly Option[]>> = {
54
55
  "baseline prune": ["against"],
55
56
  "baseline tighten": ["staged"],
56
57
  "baseline write": ["rule"],
57
- ci: [],
58
+ ci: ["coverage"],
58
59
  "exceptions migrate": ["from"],
59
60
  fix: [],
60
61
  "hooks install": ["force"],
@@ -79,7 +80,7 @@ function commandFor(name: string, values: Values): Parsed {
79
80
  const config = values.config;
80
81
  switch (name) {
81
82
  case "ci":
82
- return parsed({ _tag: "Ci" });
83
+ return parsed({ _tag: "Ci", coverage: values.coverage === true });
83
84
  case "setup":
84
85
  return parsed({ _tag: "Setup", config });
85
86
  case "lint":
@@ -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/ci.ts CHANGED
@@ -2,9 +2,21 @@ import { Console, Effect } from "effect";
2
2
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
3
3
  import { GateFailed } from "#failure.ts";
4
4
 
5
- export const ci = Effect.fn("Cli.ci")(function* (cwd: string) {
5
+ const coverageArgs = [
6
+ "--coverage",
7
+ "--coverage.provider=v8",
8
+ "--coverage.reporter=lcov",
9
+ "--coverage.reportOnFailure",
10
+ "--coverage.reportsDirectory=coverage",
11
+ "--reporter=default",
12
+ "--reporter=junit",
13
+ "--outputFile.junit=coverage/junit.xml",
14
+ ];
15
+
16
+ export const ci = Effect.fn("Cli.ci")(function* (cwd: string, coverage = false) {
6
17
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
7
- for (const args of [["peers", "check"], ...["lint", "typecheck", "build", "test"].map((script) => ["run", script])]) {
18
+ const scripts = ["lint", "typecheck", "build", "test"].map((script) => ["run", script, ...(script === "test" && coverage ? coverageArgs : [])]);
19
+ for (const args of [["peers", "check"], ...scripts]) {
8
20
  yield* Console.log(`quality: running \`pnpm ${args.join(" ")}\``);
9
21
  const code = yield* spawner.exitCode(ChildProcess.make("pnpm", args, { cwd, stderr: "inherit", stdout: "inherit" }));
10
22
  if (code !== 0) {
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(