@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.
- package/CHANGELOG.md +66 -0
- package/README.md +23 -12
- package/biome/preset.json +11 -2
- package/dist/PackageManifest.d.ts +25 -0
- package/dist/PackageManifest.d.ts.map +1 -0
- package/dist/PackageManifest.js +21 -0
- package/dist/PackageManifest.js.map +1 -0
- package/dist/adapters/TestOutput.d.ts +8 -0
- package/dist/adapters/TestOutput.d.ts.map +1 -0
- package/dist/adapters/TestOutput.js +5 -0
- package/dist/adapters/TestOutput.js.map +1 -0
- package/dist/adapters/knip/configuration.d.ts.map +1 -1
- package/dist/adapters/knip/configuration.js +2 -9
- package/dist/adapters/knip/configuration.js.map +1 -1
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/knip/entryPointFindings.js +13 -3
- package/dist/adapters/knip/entryPointFindings.js.map +1 -1
- package/dist/adapters/knip/run.d.ts +3 -1
- package/dist/adapters/knip/run.d.ts.map +1 -1
- package/dist/adapters/knip/run.js +8 -8
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/manifestInventory.d.ts +23 -0
- package/dist/adapters/manifestInventory.d.ts.map +1 -0
- package/dist/adapters/manifestInventory.js +63 -0
- package/dist/adapters/manifestInventory.js.map +1 -0
- package/dist/adapters/manifestReader.d.ts +3 -0
- package/dist/adapters/manifestReader.d.ts.map +1 -0
- package/dist/adapters/manifestReader.js +8 -0
- package/dist/adapters/manifestReader.js.map +1 -0
- package/dist/adapters/testProjects.d.ts.map +1 -0
- package/dist/{testProjects.js → adapters/testProjects.js} +4 -3
- package/dist/adapters/testProjects.js.map +1 -0
- package/dist/appTestConfig.d.ts +2 -1
- package/dist/appTestConfig.d.ts.map +1 -1
- package/dist/appTestConfig.js +3 -3
- package/dist/appTestConfig.js.map +1 -1
- package/dist/appViteConfig.d.ts +1 -1
- package/dist/appViteConfig.d.ts.map +1 -1
- package/dist/appViteConfig.js +2 -2
- package/dist/appViteConfig.js.map +1 -1
- package/dist/baseline/format.js +2 -2
- package/dist/baseline/format.js.map +1 -1
- package/dist/baseline/legacy.js +2 -2
- package/dist/baseline/legacy.js.map +1 -1
- package/dist/baseline/merge.js +1 -1
- package/dist/baseline/merge.js.map +1 -1
- package/dist/baseline/shards.js +1 -1
- package/dist/baseline/shards.js.map +1 -1
- package/dist/biome/exceptionConfig.d.ts +7 -1
- package/dist/biome/exceptionConfig.d.ts.map +1 -1
- package/dist/biome/exceptionConfig.js +20 -25
- package/dist/biome/exceptionConfig.js.map +1 -1
- package/dist/biome/recommendedRules.d.ts +2 -1
- package/dist/biome/recommendedRules.d.ts.map +1 -1
- package/dist/biome/recommendedRules.js +10 -13
- package/dist/biome/recommendedRules.js.map +1 -1
- package/dist/biome/relocateConfig.d.ts +6 -0
- package/dist/biome/relocateConfig.d.ts.map +1 -0
- package/dist/biome/relocateConfig.js +49 -0
- package/dist/biome/relocateConfig.js.map +1 -0
- package/dist/biome/report.d.ts +27 -3
- package/dist/biome/report.d.ts.map +1 -1
- package/dist/biome/report.js +12 -10
- package/dist/biome/report.js.map +1 -1
- package/dist/biome/run.d.ts +12 -2
- package/dist/biome/run.d.ts.map +1 -1
- package/dist/biome/run.js +18 -24
- package/dist/biome/run.js.map +1 -1
- package/dist/biome/withoutEntryPointImports.d.ts.map +1 -1
- package/dist/biome/withoutEntryPointImports.js +2 -12
- package/dist/biome/withoutEntryPointImports.js.map +1 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/baseline.d.ts +4 -3
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/ci.d.ts +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +13 -2
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/fix.d.ts +2 -1
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +3 -9
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/lint.d.ts +3 -2
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/messages.d.ts +1 -1
- package/dist/cli/messages.d.ts.map +1 -1
- package/dist/cli/messages.js +2 -1
- package/dist/cli/messages.js.map +1 -1
- package/dist/cli/migrateBaseline.d.ts +3 -2
- package/dist/cli/migrateBaseline.d.ts.map +1 -1
- package/dist/cli/migrateBaseline.js +2 -2
- package/dist/cli/migrateBaseline.js.map +1 -1
- package/dist/cli/migrateExceptions.d.ts.map +1 -1
- package/dist/cli/migrateExceptions.js +6 -4
- package/dist/cli/migrateExceptions.js.map +1 -1
- package/dist/cli/program.d.ts +1 -1
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +1 -1
- package/dist/cli/program.js.map +1 -1
- package/dist/config/decode.d.ts +1 -1
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +1 -2
- package/dist/config/decode.js.map +1 -1
- package/dist/config/load.js +2 -2
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts +1 -1
- package/dist/decoded.d.ts +2 -3
- package/dist/decoded.d.ts.map +1 -1
- package/dist/decoded.js +6 -4
- package/dist/decoded.js.map +1 -1
- package/dist/docs/documentedModule.d.ts +0 -2
- package/dist/docs/documentedModule.d.ts.map +1 -1
- package/dist/docs/documentedModule.js +0 -3
- package/dist/docs/documentedModule.js.map +1 -1
- package/dist/docs/importFindings.d.ts.map +1 -1
- package/dist/docs/importFindings.js +0 -3
- package/dist/docs/importFindings.js.map +1 -1
- package/dist/engine/baselineFile.js +2 -2
- package/dist/engine/baselineFile.js.map +1 -1
- package/dist/engine/runRules.d.ts +3 -4
- package/dist/engine/runRules.d.ts.map +1 -1
- package/dist/engine/runRules.js +23 -8
- package/dist/engine/runRules.js.map +1 -1
- package/dist/engine/session.d.ts +4 -3
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +6 -7
- package/dist/engine/session.js.map +1 -1
- package/dist/exceptions/declaration.js +2 -2
- package/dist/exceptions/declaration.js.map +1 -1
- package/dist/exceptions/registry.d.ts.map +1 -1
- package/dist/exceptions/registry.js +2 -4
- package/dist/exceptions/registry.js.map +1 -1
- package/dist/failure.d.ts +5 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +4 -0
- package/dist/failure.js.map +1 -1
- package/dist/git/command.js +1 -1
- package/dist/git/command.js.map +1 -1
- package/dist/hooks/install.js +2 -2
- package/dist/hooks/install.js.map +1 -1
- package/dist/hooks/preCommit.d.ts +1 -2
- package/dist/hooks/preCommit.d.ts.map +1 -1
- package/dist/hooks/preCommit.js +10 -11
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/hooks/status.js +1 -1
- package/dist/hooks/status.js.map +1 -1
- package/dist/hooks/uninstall.js +3 -3
- package/dist/hooks/uninstall.js.map +1 -1
- package/dist/imports/classifyRuntime.d.ts +10 -0
- package/dist/imports/classifyRuntime.d.ts.map +1 -0
- package/dist/imports/classifyRuntime.js +22 -0
- package/dist/imports/classifyRuntime.js.map +1 -0
- package/dist/imports/fences/declarations.d.ts.map +1 -1
- package/dist/imports/fences/declarations.js +1 -2
- package/dist/imports/fences/declarations.js.map +1 -1
- package/dist/imports/pnpmWorkspacePatterns.d.ts.map +1 -1
- package/dist/imports/pnpmWorkspacePatterns.js +2 -1
- package/dist/imports/pnpmWorkspacePatterns.js.map +1 -1
- package/dist/imports/runtime.d.ts +4 -3
- package/dist/imports/runtime.d.ts.map +1 -1
- package/dist/imports/runtime.js +35 -64
- package/dist/imports/runtime.js.map +1 -1
- package/dist/imports/workspace.d.ts.map +1 -1
- package/dist/imports/workspace.js +9 -19
- package/dist/imports/workspace.js.map +1 -1
- package/dist/inventory/collect.d.ts +1 -0
- package/dist/inventory/collect.d.ts.map +1 -1
- package/dist/inventory/collect.js +2 -1
- package/dist/inventory/collect.js.map +1 -1
- package/dist/inventory/filesystem.d.ts.map +1 -1
- package/dist/inventory/filesystem.js +2 -8
- package/dist/inventory/filesystem.js.map +1 -1
- package/dist/manifests/entryPoints.d.ts.map +1 -1
- package/dist/manifests/entryPoints.js +2 -12
- package/dist/manifests/entryPoints.js.map +1 -1
- package/dist/manifests/sorted.d.ts +2 -3
- package/dist/manifests/sorted.d.ts.map +1 -1
- package/dist/manifests/sorted.js +14 -8
- package/dist/manifests/sorted.js.map +1 -1
- package/dist/naming/packageLayout.d.ts.map +1 -1
- package/dist/naming/packageLayout.js +2 -12
- package/dist/naming/packageLayout.js.map +1 -1
- package/dist/rule.d.ts +15 -10
- package/dist/rule.d.ts.map +1 -1
- package/dist/rule.js +9 -1
- package/dist/rule.js.map +1 -1
- package/dist/rules/biome.d.ts.map +1 -1
- package/dist/rules/biome.js +7 -4
- package/dist/rules/biome.js.map +1 -1
- package/dist/rules/builtIn.d.ts +14 -14
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +8 -0
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/comments/maxPerFile.d.ts +1 -1
- package/dist/rules/comments/maxPerFile.d.ts.map +1 -1
- package/dist/rules/comments/noBanner.d.ts +1 -1
- package/dist/rules/comments/noBanner.d.ts.map +1 -1
- package/dist/rules/comments/noEnvironmentPragma.d.ts +1 -1
- package/dist/rules/comments/noEnvironmentPragma.d.ts.map +1 -1
- package/dist/rules/comments/noEnvironmentPragma.js +1 -1
- package/dist/rules/comments/noEnvironmentPragma.js.map +1 -1
- package/dist/rules/comments/noJsdoc.d.ts +1 -1
- package/dist/rules/comments/noJsdoc.d.ts.map +1 -1
- package/dist/rules/comments/noLineReference.d.ts +1 -1
- package/dist/rules/comments/noLineReference.d.ts.map +1 -1
- package/dist/rules/comments/noPrReference.d.ts +1 -1
- package/dist/rules/comments/noPrReference.d.ts.map +1 -1
- package/dist/rules/comments/noTodo.d.ts +1 -1
- package/dist/rules/comments/noTodo.d.ts.map +1 -1
- package/dist/rules/docs/references.d.ts +1 -1
- package/dist/rules/docs/references.d.ts.map +1 -1
- package/dist/rules/docs/references.js +5 -8
- package/dist/rules/docs/references.js.map +1 -1
- package/dist/rules/docs/unversionedInstalls.d.ts +1 -1
- package/dist/rules/docs/unversionedInstalls.d.ts.map +1 -1
- package/dist/rules/docs/unversionedInstalls.js +1 -1
- package/dist/rules/docs/unversionedInstalls.js.map +1 -1
- package/dist/rules/effect/boundary.d.ts +1 -1
- package/dist/rules/effect/boundary.d.ts.map +1 -1
- package/dist/rules/effect/serviceParameters.d.ts +1 -1
- package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
- package/dist/rules/effect/serviceTypes.d.ts.map +1 -1
- package/dist/rules/effect/serviceTypes.js +10 -0
- package/dist/rules/effect/serviceTypes.js.map +1 -1
- package/dist/rules/files/distinctCase.d.ts +1 -1
- package/dist/rules/files/distinctCase.d.ts.map +1 -1
- package/dist/rules/files/folderNames.d.ts +1 -1
- package/dist/rules/files/folderNames.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts +1 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/otherNames.d.ts +1 -1
- package/dist/rules/files/otherNames.d.ts.map +1 -1
- package/dist/rules/files/packageImports.d.ts.map +1 -1
- package/dist/rules/files/packageImports.js +2 -13
- package/dist/rules/files/packageImports.js.map +1 -1
- package/dist/rules/imports/aliased.d.ts +1 -1
- package/dist/rules/imports/aliased.d.ts.map +1 -1
- package/dist/rules/imports/cycles.d.ts +1 -1
- package/dist/rules/imports/cycles.d.ts.map +1 -1
- package/dist/rules/imports/fences.d.ts +1 -1
- package/dist/rules/imports/fences.d.ts.map +1 -1
- package/dist/rules/imports/manifest.d.ts +1 -1
- package/dist/rules/imports/manifest.d.ts.map +1 -1
- package/dist/rules/imports/manifest.js +14 -32
- package/dist/rules/imports/manifest.js.map +1 -1
- package/dist/rules/imports/noTestCode.d.ts +1 -1
- package/dist/rules/imports/noTestCode.d.ts.map +1 -1
- package/dist/rules/imports/resolvable.d.ts +1 -1
- package/dist/rules/imports/resolvable.d.ts.map +1 -1
- package/dist/rules/imports/runtime.d.ts +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +29 -25
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/manifestsApplication.d.ts +1 -1
- package/dist/rules/manifestsApplication.d.ts.map +1 -1
- package/dist/rules/manifestsApplication.js +2 -12
- package/dist/rules/manifestsApplication.js.map +1 -1
- package/dist/rules/manifestsExportsShape.d.ts +1 -1
- package/dist/rules/manifestsExportsShape.d.ts.map +1 -1
- package/dist/rules/manifestsExportsShape.js +12 -7
- package/dist/rules/manifestsExportsShape.js.map +1 -1
- package/dist/rules/manifestsSorted.d.ts +1 -1
- package/dist/rules/manifestsSorted.d.ts.map +1 -1
- package/dist/rules/manifestsSorted.js +10 -14
- package/dist/rules/manifestsSorted.js.map +1 -1
- package/dist/rules/manifestsSourceFirst.d.ts +1 -1
- package/dist/rules/manifestsSourceFirst.d.ts.map +1 -1
- package/dist/rules/manifestsSourceFirst.js +20 -23
- package/dist/rules/manifestsSourceFirst.js.map +1 -1
- package/dist/rules/manifestsValid.d.ts +2 -0
- package/dist/rules/manifestsValid.d.ts.map +1 -0
- package/dist/rules/manifestsValid.js +10 -0
- package/dist/rules/manifestsValid.js.map +1 -0
- package/dist/rules/maxDepth.d.ts +1 -1
- package/dist/rules/maxDepth.d.ts.map +1 -1
- package/dist/rules/maxLines.d.ts +1 -1
- package/dist/rules/maxLines.d.ts.map +1 -1
- package/dist/rules/noBarrel.d.ts +1 -1
- package/dist/rules/noBarrel.d.ts.map +1 -1
- package/dist/rules/react/jsxConditionals.d.ts +1 -1
- package/dist/rules/react/jsxConditionals.d.ts.map +1 -1
- package/dist/rules/stories/authSql.d.ts +1 -1
- package/dist/rules/stories/authSql.d.ts.map +1 -1
- package/dist/rules/stories/authSql.js +22 -3
- package/dist/rules/stories/authSql.js.map +1 -1
- package/dist/rules/stories/domainOutcomes.d.ts +2 -0
- package/dist/rules/stories/domainOutcomes.d.ts.map +1 -0
- package/dist/rules/stories/domainOutcomes.js +34 -0
- package/dist/rules/stories/domainOutcomes.js.map +1 -0
- package/dist/rules/stories/engine.d.ts +1 -1
- package/dist/rules/stories/engine.d.ts.map +1 -1
- package/dist/rules/stories/groupedOutcomes.d.ts +2 -0
- package/dist/rules/stories/groupedOutcomes.d.ts.map +1 -0
- package/dist/rules/stories/groupedOutcomes.js +55 -0
- package/dist/rules/stories/groupedOutcomes.js.map +1 -0
- package/dist/rules/stories/httpStatus.d.ts +1 -1
- package/dist/rules/stories/httpStatus.d.ts.map +1 -1
- package/dist/rules/stories/importBindings.d.ts +8 -0
- package/dist/rules/stories/importBindings.d.ts.map +1 -0
- package/dist/rules/stories/importBindings.js +29 -0
- package/dist/rules/stories/importBindings.js.map +1 -0
- package/dist/rules/stories/namedValues.d.ts +1 -1
- package/dist/rules/stories/namedValues.d.ts.map +1 -1
- package/dist/rules/stories/noExpect.d.ts +1 -1
- package/dist/rules/stories/noExpect.d.ts.map +1 -1
- package/dist/rules/stories/noLimitImports.d.ts +1 -1
- package/dist/rules/stories/noLimitImports.d.ts.map +1 -1
- package/dist/rules/stories/prerequisites.d.ts.map +1 -1
- package/dist/rules/stories/prerequisites.js +3 -6
- package/dist/rules/stories/prerequisites.js.map +1 -1
- package/dist/rules/stories/queueSql.d.ts +1 -1
- package/dist/rules/stories/queueSql.d.ts.map +1 -1
- package/dist/rules/stories/setup.d.ts +1 -1
- package/dist/rules/stories/setup.d.ts.map +1 -1
- package/dist/rules/stories/sources.d.ts +4 -0
- package/dist/rules/stories/sources.d.ts.map +1 -0
- package/dist/rules/stories/sources.js +17 -0
- package/dist/rules/stories/sources.js.map +1 -0
- package/dist/rules/stories/specHelpers.d.ts +1 -1
- package/dist/rules/stories/specHelpers.d.ts.map +1 -1
- package/dist/rules/stories/specs.d.ts +1 -1
- package/dist/rules/stories/specs.d.ts.map +1 -1
- package/dist/rules/stories/waitOnEvents.d.ts +2 -0
- package/dist/rules/stories/waitOnEvents.d.ts.map +1 -0
- package/dist/rules/stories/waitOnEvents.js +52 -0
- package/dist/rules/stories/waitOnEvents.js.map +1 -0
- package/dist/rules/suppressions/biome/declarations.d.ts.map +1 -1
- package/dist/rules/suppressions/biome/declarations.js +2 -4
- package/dist/rules/suppressions/biome/declarations.js.map +1 -1
- package/dist/rules/suppressions/biome/resolvePackage.d.ts.map +1 -1
- package/dist/rules/suppressions/biome/resolvePackage.js +3 -15
- package/dist/rules/suppressions/biome/resolvePackage.js.map +1 -1
- package/dist/rules/suppressions/biomeOverrides.d.ts +1 -1
- package/dist/rules/suppressions/biomeOverrides.d.ts.map +1 -1
- package/dist/rules/suppressions/biomeRecommended.d.ts +6 -3
- package/dist/rules/suppressions/biomeRecommended.d.ts.map +1 -1
- package/dist/rules/suppressions/biomeRecommended.js +10 -7
- package/dist/rules/suppressions/biomeRecommended.js.map +1 -1
- package/dist/rules/suppressions/noDoubleCast.d.ts +1 -1
- package/dist/rules/suppressions/noDoubleCast.d.ts.map +1 -1
- package/dist/rules/suppressions/noIgnoreDeprecations.d.ts +1 -1
- package/dist/rules/suppressions/noIgnoreDeprecations.d.ts.map +1 -1
- package/dist/rules/suppressions/noIgnoreDeprecations.js +7 -7
- package/dist/rules/suppressions/noIgnoreDeprecations.js.map +1 -1
- package/dist/rules/suppressions/noInline.d.ts +1 -1
- package/dist/rules/suppressions/noInline.d.ts.map +1 -1
- package/dist/rules/test-names/colocated.d.ts +1 -1
- package/dist/rules/test-names/colocated.d.ts.map +1 -1
- package/dist/rules/test-names/follow.d.ts +1 -1
- package/dist/rules/test-names/follow.d.ts.map +1 -1
- package/dist/rules/unusedCode.d.ts +1 -1
- package/dist/rules/unusedCode.d.ts.map +1 -1
- package/package.json +10 -15
- package/src/PackageManifest.ts +24 -0
- package/src/adapters/TestOutput.ts +9 -0
- package/src/adapters/knip/configuration.ts +2 -10
- package/src/adapters/knip/entryPointFindings.ts +17 -3
- package/src/adapters/knip/run.ts +42 -44
- package/src/adapters/manifestInventory.ts +87 -0
- package/src/adapters/manifestReader.ts +11 -0
- package/src/{testProjects.ts → adapters/testProjects.ts} +4 -3
- package/src/appTestConfig.ts +3 -3
- package/src/appViteConfig.ts +2 -2
- package/src/baseline/format.ts +2 -2
- package/src/baseline/legacy.ts +2 -2
- package/src/baseline/merge.ts +1 -1
- package/src/baseline/shards.ts +1 -1
- package/src/biome/exceptionConfig.ts +22 -29
- package/src/biome/recommendedRules.ts +18 -16
- package/src/biome/relocateConfig.ts +59 -0
- package/src/biome/report.ts +17 -11
- package/src/biome/run.ts +29 -28
- package/src/biome/withoutEntryPointImports.ts +2 -12
- package/src/cli/args.ts +5 -4
- package/src/cli/baseline.ts +3 -2
- package/src/cli/ci.ts +14 -2
- package/src/cli/fix.ts +15 -17
- package/src/cli/lint.ts +3 -2
- package/src/cli/messages.ts +2 -1
- package/src/cli/migrateBaseline.ts +4 -3
- package/src/cli/migrateExceptions.ts +6 -4
- package/src/cli/program.ts +1 -1
- package/src/config/decode.ts +1 -3
- package/src/config/load.ts +2 -2
- package/src/decoded.ts +9 -5
- package/src/docs/documentedModule.ts +1 -4
- package/src/docs/importFindings.ts +0 -5
- package/src/engine/baselineFile.ts +2 -2
- package/src/engine/runRules.ts +34 -15
- package/src/engine/session.ts +11 -10
- package/src/exceptions/declaration.ts +2 -2
- package/src/exceptions/registry.ts +2 -4
- package/src/failure.ts +6 -1
- package/src/git/command.ts +1 -1
- package/src/hooks/install.ts +2 -2
- package/src/hooks/preCommit.ts +10 -16
- package/src/hooks/status.ts +1 -1
- package/src/hooks/uninstall.ts +3 -3
- package/src/imports/classifyRuntime.ts +30 -0
- package/src/imports/fences/declarations.ts +1 -3
- package/src/imports/pnpmWorkspacePatterns.ts +3 -1
- package/src/imports/runtime.ts +48 -60
- package/src/imports/workspace.ts +9 -20
- package/src/inventory/collect.ts +3 -1
- package/src/inventory/filesystem.ts +2 -10
- package/src/manifests/entryPoints.ts +2 -12
- package/src/manifests/sorted.ts +21 -9
- package/src/naming/packageLayout.ts +2 -12
- package/src/rule.ts +38 -19
- package/src/rules/biome.ts +9 -5
- package/src/rules/builtIn.ts +8 -0
- package/src/rules/comments/noEnvironmentPragma.ts +1 -1
- package/src/rules/docs/references.ts +8 -10
- package/src/rules/docs/unversionedInstalls.ts +1 -1
- package/src/rules/effect/serviceTypes.ts +13 -0
- package/src/rules/files/packageImports.ts +2 -13
- package/src/rules/imports/manifest.ts +15 -32
- package/src/rules/imports/runtime.ts +41 -35
- package/src/rules/manifestsApplication.ts +2 -12
- package/src/rules/manifestsExportsShape.ts +11 -8
- package/src/rules/manifestsSorted.ts +13 -16
- package/src/rules/manifestsSourceFirst.ts +24 -24
- package/src/rules/manifestsValid.ts +14 -0
- package/src/rules/stories/authSql.ts +25 -3
- package/src/rules/stories/domainOutcomes.ts +44 -0
- package/src/rules/stories/groupedOutcomes.ts +66 -0
- package/src/rules/stories/importBindings.ts +37 -0
- package/src/rules/stories/prerequisites.ts +4 -8
- package/src/rules/stories/sources.ts +20 -0
- package/src/rules/stories/waitOnEvents.ts +61 -0
- package/src/rules/suppressions/biome/declarations.ts +2 -4
- package/src/rules/suppressions/biome/resolvePackage.ts +5 -21
- package/src/rules/suppressions/biomeRecommended.ts +14 -9
- package/src/rules/suppressions/noIgnoreDeprecations.ts +11 -8
- package/dist/testProjects.d.ts.map +0 -1
- package/dist/testProjects.js.map +0 -1
- /package/dist/{testProjects.d.ts → adapters/testProjects.d.ts} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
};
|
package/src/appTestConfig.ts
CHANGED
|
@@ -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
|
}
|
package/src/appViteConfig.ts
CHANGED
|
@@ -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
|
};
|
package/src/baseline/format.ts
CHANGED
|
@@ -8,7 +8,7 @@ const Line = Schema.Struct({
|
|
|
8
8
|
rule: Schema.NonEmptyString,
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const
|
|
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(
|
|
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;
|
package/src/baseline/legacy.ts
CHANGED
|
@@ -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
|
|
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(
|
|
23
|
+
const decoded = await decodeWith(LegacySchema, raw);
|
|
24
24
|
if (decoded._tag === "Invalid") {
|
|
25
25
|
return decoded;
|
|
26
26
|
}
|
package/src/baseline/merge.ts
CHANGED
|
@@ -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
|
);
|
package/src/baseline/shards.ts
CHANGED
|
@@ -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
|
|
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[]) =>
|
|
32
|
-
)
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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",
|
|
59
|
+
files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", "!.quality-biome-*"] },
|
|
63
60
|
overrides: [...previousOverrides, ...overrides],
|
|
64
61
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
}
|
package/src/biome/report.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
)
|
|
44
|
+
) {
|
|
45
45
|
const command = [...args, "--reporter=json", "--max-diagnostics=none", ...paths];
|
|
46
|
-
const run =
|
|
46
|
+
const run = yield* runBiome(root, command, exceptions);
|
|
47
47
|
const report = decodeReport(run.stdout.trim());
|
|
48
48
|
if (report._tag === "None") {
|
|
49
|
-
|
|
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
|
-
|
|
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
|
|
58
|
-
|
|
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 :
|
|
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 {
|
|
5
|
-
import {
|
|
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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
[...exceptions, ...toolOwned],
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 =
|
|
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":
|
package/src/cli/baseline.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
48
|
-
|
|
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,
|
|
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
|
|
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,
|
|
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(
|