@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.46.0 - 2026-10-30
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Export every Quality module through its file path, including the DOM environment, unit I/O guard, tooling classifier, bundle-input analysis, shadcn inventory helpers and migration-file naming helpers.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- `tests/domain-outcomes`, `tests/grouped-outcomes` and `tests/wait-on-events` now read every story file, whatever its suffix, so a story named after its module such as `pane.dom.test.ts` follows the same rules as a `.spec.ts`. Type tests, unit tests and `test-support` files stay out of scope. Repair the new findings, or record them with `quality baseline write --rule <rule>` for each of the three rules.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Keep plain option objects such as `RequestInit`, including options nested inside Vitest types, out of service-parameter findings when an Effect service uses the same type. Service keys, callable services and method-bearing service implementations remain checked.
|
|
16
|
+
- Decode package manifests once per scan through a shared Schema, report an invalid manifest once with its path before dependent checks run, and surface read failures instead of treating them as missing files.
|
|
17
|
+
- Decode Quality configuration, baselines, registries and declarations directly with Effect Schema.
|
|
18
|
+
- Rule checks retain the caller's services and interruption instead of starting independent runtimes. The deprecation check reads configuration through the supplied file system and fails when a discovered configuration cannot be read.
|
|
19
|
+
- Read the CI test-output policy while building its Effect Layer, keeping the synchronous Vitest configuration bridge in an adapter.
|
|
20
|
+
- Keep the shared Vitest configuration loadable with both bundled and native config loaders.
|
|
21
|
+
- Scoped Biome configs preserve malformed VCS settings so the native tool reports them instead of applying defaults.
|
|
22
|
+
- Interrupting rules stops Biome and knip child processes and removes their scoped temporary configs before the run ends.
|
|
23
|
+
- A crashing rule prints its id and original stack through `Cause.pretty`. Setup failures retain their original cause as a non-enumerable property.
|
|
24
|
+
|
|
25
|
+
### Breaking
|
|
26
|
+
|
|
27
|
+
- Invalid manifest fields now fail `manifests/valid`; correct malformed JSON and manifest field types before running lint or fix. Optional files are absent only for `NotFound`; repair unreadable paths instead of relying on them being ignored.
|
|
28
|
+
- `sortManifests` reports invalid data as `ManifestFailure`; handle that tag or repair the manifest before sorting.
|
|
29
|
+
- `decodeWith` accepts an Effect Schema instead of a Standard Schema; pass the original Effect Schema. Rule option schemas still use Standard Schema.
|
|
30
|
+
- `runtimeOf` and `runtimeDeclarationProblems` return Effects; yield their results in Effect programs. `sortingOf` expects validated JSON; validate a manifest through the shared inventory before sorting. `Inventory` includes `manifestFiles`; provide the repository's manifest paths when constructing an inventory.
|
|
31
|
+
- `manifests/exports-shape` rejects null export entries. Remove those entries so callers can import modules through the file-preserving wildcard; record existing blocks in the baseline while adopting the rule.
|
|
32
|
+
- `docs/references` reports null-blocked module paths as unavailable modules instead of private APIs, and `documentedModule` returns `kind: "missing"` for them. Handle `"missing"` instead of `"private"` when using that result, and remove the export blocks before documenting those paths.
|
|
33
|
+
- Import `testProjects` and `TestProjectsOptions` from `@shivaedev/quality/adapters/testProjects.ts` instead of `@shivaedev/quality/testProjects.ts`. The Vitest configuration entry point now lives with its adapter; no alias remains at the old path.
|
|
34
|
+
- Direct callers of the configured `suppressions/no-ignore-deprecations` check must provide Effect's `FileSystem` service. The Quality CLI already supplies it; custom runners can provide `NodeFileSystem.layer` at their entry point.
|
|
35
|
+
- Configured rules now return an Effect. Use `yield* configured.check(inputs)` and provide the services required by the check at your application's boundary; raw `Rule.configure` implementations must return an Effect check. `defineRule` still accepts synchronous and Promise checks, now also accepts Effect checks, and supplies `context.signal` for cancellable Promise work.
|
|
36
|
+
- `runBiome`, `biomeReport`, `recommendedRules`, `runKnip` and `withExceptionConfig` now return Effects. Compose them with `yield*` instead of awaiting them; supply the filesystem and child-process services, and scope `withExceptionConfig` and its Effect callback. Engine scans and CLI commands that run rules require both services too.
|
|
37
|
+
- Rule crashes are defects rather than `SetupFailure` values. Handle expected setup failures in the error channel and use Effect cause handling for rule defects.
|
|
38
|
+
|
|
39
|
+
## 0.45.0 - 2026-10-30
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- `quality ci --coverage` collects V8 coverage and JUnit from the gate's single test run into `coverage/lcov.info` and `coverage/junit.xml`, including failed tests. Quality provides the V8 coverage dependency, and `appTestConfig` accepts native coverage options through its second argument.
|
|
44
|
+
- `@shivaedev/quality` accepts extra host proxy paths as the third argument to `appViteConfig`, beside `/api/auth` and `/rpc`, so applications can exercise their host routes through Vite during development.
|
|
45
|
+
- Quality accepts app migrations referencing the auth user id with `ON DELETE CASCADE` or `ON DELETE SET NULL`, while keeping auth reads and writes behind identity.
|
|
46
|
+
- Identity exports `userReference` from `server/better-auth/userReference.ts` so app migrations share the user table and id column names.
|
|
47
|
+
- Starter notes use a `user_id` foreign key with cascading deletion. A numbered migration renames the existing ownership column and adds the constraint for existing apps.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- Require Effect 4.0.6 and align the Effect companion package peers and generated starter catalog to the same exact release. Install the 4.0.6 Effect stack together.
|
|
52
|
+
- Recognize ambient runtime modules in their declaring TypeScript project when checking missing package dependencies, including generated JavaScript clients. Undeclared dependencies and declarations outside that project still fail.
|
|
53
|
+
- The `story-testing` skill covers how a story reads: one name per actor, actions that name their change, a proven before state, domain outcomes, a separated action, a true title, `outcomes` for several checks, explained setup, one behaviour per story, stories only for plausible regressions, and settling on events. It now applies to package stories as well as app stories.
|
|
54
|
+
- Generated apps record the starter's existing findings for the new story rules in their baseline.
|
|
55
|
+
- Quality applies Biome’s test-title check only to `*.test.*`, `*.spec.*` and `test-support/` files, so ordinary helpers named `describe`, `it` or `test` do not receive test-title findings.
|
|
56
|
+
- Quality and starter guidance explain that a `CreateSpace` component in `spaces/client/` is named `Create.tsx`, keeping the full export name without repeating a folder in the file name.
|
|
57
|
+
|
|
58
|
+
### Fixed
|
|
59
|
+
|
|
60
|
+
- Register hosted RPC cache-control handling through Effect 4.0.6's request-scoped pre-response API so responses keep `private, no-store`.
|
|
61
|
+
- Accept native RPC's `application/x-ndjson` media type while preserving `application/ndjson` callers at the transport guard.
|
|
62
|
+
- Keep subscriptions open after their HTTP request body completes; closing the socket still cancels them.
|
|
63
|
+
- Leave pnpm-generated lockfiles out of Biome checks and fixes so dependency updates retain pnpm's YAML format. Hand-written YAML remains checked and formatted.
|
|
64
|
+
|
|
65
|
+
### Breaking
|
|
66
|
+
|
|
67
|
+
- Specs get new findings from three story rules. `tests/domain-outcomes` reports Effect `Exit`, `Cause` and `Result` uses, `_tag` reads and `"Success"` or `"Failure"` tagged literals: return the outcome in the domain's words from a kit verb or readout. `tests/grouped-outcomes` reports consecutive `expect(yield* …)` checks: write them as rows of one `outcomes` call from `@shivaedev/test-story/server/outcomes.ts`. `tests/wait-on-events` reports sleeps, timers, `eventually`, Vitest fake timers and `TestClock` adjustments: settle on the engine's own signal, and advance the clock in a kit verb named for the time that passes. Record existing findings with `quality baseline write --rule tests/domain-outcomes --rule tests/grouped-outcomes --rule tests/wait-on-events`.
|
|
68
|
+
|
|
3
69
|
## 0.44.1 - 2026-10-29
|
|
4
70
|
|
|
5
71
|
### Changed
|
package/README.md
CHANGED
|
@@ -28,6 +28,12 @@ Exceptions apply first, then the baseline. With the default rule settings, remai
|
|
|
28
28
|
|
|
29
29
|
The work has three parts: connect the repository to the shared tools once; describe an import boundary when its architecture needs one; run the gate and repair findings every day. Writing local rules is not an adoption requirement.
|
|
30
30
|
|
|
31
|
+
### Rule lifecycle
|
|
32
|
+
|
|
33
|
+
`defineRule` accepts synchronous, Promise and Effect checks. Promise checks receive an abort signal as `context.signal`; pass it to cancellable APIs. Effect checks compose filesystem and child-process work in the run's scope. Configured checks return Effects and preserve their service requirements; tool checks read `FileSystem` and `ChildProcessSpawner` from the environment.
|
|
34
|
+
|
|
35
|
+
Interrupting a run stops its Biome and knip processes and removes their scoped temporary configs before it ends. A rule crash is a defect; the CLI prints the rule id and original stack. Expected setup failures retain their underlying cause without including it in enumerable error data.
|
|
36
|
+
|
|
31
37
|
### Effect boundaries and services
|
|
32
38
|
|
|
33
39
|
`effect/boundary` checks every TypeScript or JavaScript source in Quality's inventory, including shipped code, tooling and specs. It reports async functions, methods and arrows, await (including `for await`), `new Promise(...)`, `.then(...)`, try statements and throw statements. Model the work with Effect, fail with a tagged error, and use `Effect.die` for defects. Effect's resource and finalizer primitives model cleanup.
|
|
@@ -66,6 +72,8 @@ Add the daily commands to `package.json`:
|
|
|
66
72
|
|
|
67
73
|
For pnpm applications, `quality ci` checks peer dependencies, then runs the app’s `lint`, `typecheck`, `build` and `test` scripts in that order. It stops at the first failure. Keep those scripts as the app’s native tool commands; set `ci` to `quality ci` and let `ready` call the same script.
|
|
68
74
|
|
|
75
|
+
Run `quality ci --coverage` to collect V8 coverage during that single test run. It writes `coverage/lcov.info` and `coverage/junit.xml`, including when tests fail, through Vitest's `reportOnFailure`. Add `coverage/` to `.gitignore`. Quality provides the V8 provider; the application needs no coverage dependency or separate coverage configuration. Without the flag, the gate uses the test script unchanged.
|
|
76
|
+
|
|
69
77
|
The optional pre-commit hook runs Quality's lint, then the `typecheck` script when it exists, then an optional `quality:commit` script for repository checks. It uses the manifest's `packageManager` (`npm`, `pnpm`, `yarn` or `bun`), defaulting to `npm` when omitted. Add `quality:commit` only when the repository has extra commit checks.
|
|
70
78
|
|
|
71
79
|
Inspect the report and install the optional commit check explicitly:
|
|
@@ -169,7 +177,9 @@ Quality's `tests/story-setup` rule reports top-level test functions named with t
|
|
|
169
177
|
|
|
170
178
|
Specs keep expectations visible. `tests/spec-helpers` moves all module-level helper functions out of specs and into the kit; `tests/no-expect-in-support` moves `expect` calls into the spec, except in test-support files that register tests at module top level and are not imported by any module, so nested Vitest runs can execute them as test files with real assertions. `tests/named-values` rejects numeric literals passed to `toBe` or `toHaveLength` in specs, except zero and process exit codes asserted on an `exitCode` subject: assert the observed items or use a domain name that comes from the story's inputs or the product. For HTTP statuses, import `* as HttpStatus` from `effect/http/HttpStatus` and use `HttpStatus.fromLiteral("NotFound")`; subjects named `status` or `code` do not exempt numeric assertions. A spec-local numeric const that only feeds these matchers is reported, including aliases for zero and codes. `tests/no-limit-imports` rejects importing `MAX_*` constants from a `limits` module into specs, so a story proves behavior instead of copying an implementation cap.
|
|
171
179
|
|
|
172
|
-
|
|
180
|
+
Three more rules keep a spec readable as a story, as the [story-testing skill](https://github.com/ShivaeDev/platform/blob/main/packages/skills/skills/story-testing/SKILL.md) describes. They read every story file, whatever its suffix: any `.test` or `.spec` file outside `test-support` that is not a type or unit test, such as `orders.spec.ts`, `pane.dom.test.ts` or `orders.slow.test.ts`. The suffix says where a test sits under `tests/follow`, not whether it is a story, and `tests/story-specs` already holds every such file to the story kit. They exempt the same test-story prerequisites as `tests/story-specs`. `tests/domain-outcomes` reports each use of Effect's `Exit`, `Cause` or `Result` module, each `_tag` read or destructuring, and each object literal tagged `"Success"` or `"Failure"`: the kit's verb or readout returns the outcome in the domain's words, such as `"unauthorized"`, and a trait builds any failing input. A domain's own tagged value, such as `{ _tag: "Resync" }`, passes. `tests/grouped-outcomes` reports each run of two or more consecutive `expect(yield* …)` statements once, at its first statement: write the outcomes as rows of one `outcomes` call. `tests/wait-on-events` reports `Effect.sleep`, `setTimeout` and `setInterval`, calls to an imported `eventually`, Vitest's fake timers, `vi.waitFor`, and `TestClock.adjust` and `TestClock.setTime`: settle on the engine's own signal through a kit verb, and when time passing is the behaviour, advance the clock in a verb named for it.
|
|
181
|
+
|
|
182
|
+
`boundaries/queue-sql` rejects SQL mentioning the private `pgboss.` schema. Apps use their queue definitions and let workers process jobs; there is no queue-purge API by design. `boundaries/auth-sql` rejects SQL accessing Better Auth's `user`, `account`, `session` and `verification` tables. App tables reference users by foreign key: migrations may reference only `user(id)` with `ON DELETE CASCADE` or `ON DELETE SET NULL`. Import `userReference` from `@shivaedev/identity/server/better-auth/userReference.ts` and interpolate `sql(userReference.table)` and `sql(userReference.column)` in the reference. Apps use identity for account data; `options.owners` names platform's own auth implementation and its migrations. These rules inspect SQL templates, literal query calls and query variables, and inventoried `.sql` files. They do not evaluate arbitrary runtime SQL construction.
|
|
173
183
|
|
|
174
184
|
`boundaries/http-status` rejects comparisons with HTTP error status numbers, switch cases and literal status-list membership outside `options.edge`. Domain code handles typed errors; the named HTTP edge translates them into transport responses. Process exit codes remain ordinary domain values.
|
|
175
185
|
|
|
@@ -178,7 +188,7 @@ Declare these architectural facts in the repository's quality config; paths and
|
|
|
178
188
|
```ts
|
|
179
189
|
export default defineConfig({
|
|
180
190
|
rules: {
|
|
181
|
-
"boundaries/auth-sql": { options: { owners: ["
|
|
191
|
+
"boundaries/auth-sql": { options: { owners: ["packages/identity/src/server/better-auth/**", "examples/starter/src/server/migrations/**"] } },
|
|
182
192
|
"boundaries/http-status": { options: { edge: ["src/http/**"] } },
|
|
183
193
|
},
|
|
184
194
|
});
|
|
@@ -225,7 +235,7 @@ Git calls `quality baseline merge <ancestor> <current> <other>`. Entries are key
|
|
|
225
235
|
|
|
226
236
|
### Unused code
|
|
227
237
|
|
|
228
|
-
`code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config.
|
|
238
|
+
`code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
|
|
229
239
|
|
|
230
240
|
Package `exports` are public API, including wildcard targets and source conditions. Package `bin` and scripts, test and story globs, tool configs and `src/test-support` provide the other entry points. Imports reachable from those entries count as used. Source-conditioned package import aliases resolve to their sources before a build. Compiler mappings from `tsconfig.json` and `tsconfig.build.json` keep imports on their source files when build output exists. An internal module can be used while one of its exports remains unused. An application’s declared dependency entry points satisfy provided imports under the same policy as `imports/manifest`.
|
|
231
241
|
|
|
@@ -236,13 +246,13 @@ For adoption, run `quality baseline write --rule code/unused` and review the rec
|
|
|
236
246
|
`quality lint` prints each failing rule's guidance with its findings, so the finding is the reference for what to change. The built-in rules fall into these groups:
|
|
237
247
|
- **Structure:** `structure/max-lines` allows 150 lines in a source file and 300 in test code, `nesting/max-depth` rejects lines indented eight tabs deep, and `structure/no-barrel` rejects `index` modules. The preset rejects every re-export, types included; when `noExportedImports` suggests `export … from`, import the name where it is used instead. A module does one job.
|
|
238
248
|
- **Comments:** the `comments/*` rules reject JSDoc, TODOs, banners, line and pull request references, environment pragmas and more than two comments per file. A comment says why, never what the code already says or what it used to be. A tool pragma such as `@jsxImportSource` counts as a comment until both `comments/no-jsdoc` and `comments/max-per-file` list its tag in their `allow` option.
|
|
239
|
-
- **Documentation:** `docs/references` checks every Markdown file in the sources except `CHANGELOG.md`, whose released history keeps the links of its release. Relative links, reference definitions and `href`/`src` attributes reach an existing file or folder inside the repository, and a heading anchor matches one GitHub forms from the target's headings. A link to the repository's own GitHub tree, named by the root `package.json` `repository` field, is checked like a relative one unless it is pinned to a commit or a release tag. A published workspace package's README is shown on npm without the repository around it, so its links that leave the package use absolute URLs. Imports in TypeScript and JavaScript code blocks, workspace module paths such as `@scope/lib/repository.ts` written as inline code, `` `name` from `module` `` phrases and a package README's API rows resolve through the owning package's `exports` to
|
|
249
|
+
- **Documentation:** `docs/references` checks every Markdown file in the sources except `CHANGELOG.md`, whose released history keeps the links of its release. Relative links, reference definitions and `href`/`src` attributes reach an existing file or folder inside the repository, and a heading anchor matches one GitHub forms from the target's headings. A link to the repository's own GitHub tree, named by the root `package.json` `repository` field, is checked like a relative one unless it is pinned to a commit or a release tag. A published workspace package's README is shown on npm without the repository around it, so its links that leave the package use absolute URLs. Imports in TypeScript and JavaScript code blocks, workspace module paths such as `@scope/lib/repository.ts` written as inline code, `` `name` from `module` `` phrases and a package README's API rows resolve through the owning package's `exports` to an exported module, and every named import exists in that module unless it re-exports another. A linked document such as `CLAUDE.md` beside `AGENTS.md` is checked once, through its target. `docs/unversioned-installs` rejects a version after a package name in install commands, in shell code blocks and inline code; the package's own version ranges decide what installs, and a written version goes stale with the next release. A dist-tag such as `latest` passes.
|
|
240
250
|
- **Suppressions:** the `suppressions/*` rules reject inline lint and compiler directives, casts through `unknown`, `any` or `never`, Biome settings that weaken a check, recommended Biome rules the preset leaves below `error`, and `ignoreDeprecations`. None of them takes exceptions. A type test (`*.typecheck.test.ts`) may use `@ts-expect-error`; a test that must pass a rejected value at run time calls the API through `Reflect.apply`.
|
|
241
251
|
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder, production imports of test code, runtime folders and fences, as described above.
|
|
242
|
-
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
252
|
+
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
243
253
|
- **React:** `react/jsx-conditionals` reports `&&` and ternaries in JSX children, including nested decisions. Decide before the JSX or extract a component that receives the data and returns `null` when it has nothing to show. Inside `.map`, extract an item component that makes its own decision. Conditional attributes such as `className` are accepted. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
|
|
244
254
|
- **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
|
|
245
|
-
- **Manifests:** `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members with exports. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `source`, `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry
|
|
255
|
+
- **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. Read failures other than `NotFound` fail the scan. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members with exports. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `source`, `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. `manifests/application` keeps an application on its entry points, as described above.
|
|
246
256
|
- **Biome:** the `biome` rule reports Biome's error findings as `biome/<category>`. A Biome run that fails without an error finding, such as one whose config leaves no file to check, fails lint and fix with Biome's message. The preset leaves out the `.worktrees` folder at the root, so a checkout does not lint its linked worktrees, while a worktree inside it lints all of its own files. The preset's plugins ban ambient time, randomness, `console` and `process.env` in favour of Effect's services.
|
|
247
257
|
|
|
248
258
|
### Decide before JSX
|
|
@@ -300,7 +310,7 @@ Import names from their defining module; there is no root entry. The package's `
|
|
|
300
310
|
| `imports/fence.ts` | `fence` |
|
|
301
311
|
| `imports/fences/selectors.ts` | `packages`, `folders`, `files`, `modules`, `scopes`, `anyOf`, `workspace`, `anything`, `external` |
|
|
302
312
|
| `imports/fences/model.ts` | `Fence`, `Target`, `Selector`, `Prohibition`, `Examples`, `Chain`, `ExampleStep`, `External` |
|
|
303
|
-
| `testProjects.ts`
|
|
313
|
+
| `adapters/testProjects.ts` | `testProjects`, `TestProjectsOptions` |
|
|
304
314
|
| `appViteConfig.ts` | `appViteConfig` |
|
|
305
315
|
| `appTestConfig.ts` | `appTestConfig` |
|
|
306
316
|
| `naming/testName.ts` | `testName`, `isTestCode`, `isTestSupport`, `ENVIRONMENTS`, `Environment`, `TestName` |
|
|
@@ -338,6 +348,7 @@ Register it with `defineConfig({ local: [noLog] })`. Its check receives `root`,
|
|
|
338
348
|
|
|
339
349
|
```text
|
|
340
350
|
quality lint [--config <file>]
|
|
351
|
+
quality ci [--coverage]
|
|
341
352
|
quality fix [--config <file>]
|
|
342
353
|
quality exceptions migrate [--config <file>] [--from <registry>]
|
|
343
354
|
quality baseline merge <ancestor> <current> <other>
|
|
@@ -392,7 +403,7 @@ import { appViteConfig } from "@shivaedev/quality/appViteConfig.ts";
|
|
|
392
403
|
export default appViteConfig([tailwindcss(), react()]);
|
|
393
404
|
```
|
|
394
405
|
|
|
395
|
-
Use this in `vite.config.ts`. Plugins belong to the app. The shared server proxies `/api/auth` and `/rpc` to the local host on port 3000, preserving the request Host. It enables TypeScript path resolution. Client routes, including administration pages, stay on Vite.
|
|
406
|
+
Use this in `vite.config.ts`. Plugins belong to the app. The shared server proxies `/api/auth` and `/rpc` to the local host on port 3000, preserving the request Host. Pass extra host routes as the third argument, for example `appViteConfig(plugins, [], ["/health"])`, to proxy them to the same host during development. It enables TypeScript path resolution. Client routes, including administration pages, stay on Vite.
|
|
396
407
|
|
|
397
408
|
```ts
|
|
398
409
|
import { appTestConfig } from "@shivaedev/quality/appTestConfig.ts";
|
|
@@ -405,7 +416,7 @@ Use this in `vitest.config.ts`. It composes `testProjects` with browser and serv
|
|
|
405
416
|
For Vitest, install `vitest`, and add `@shivaedev/test-story` and `happy-dom` when the repository has DOM tests, then use:
|
|
406
417
|
|
|
407
418
|
```ts
|
|
408
|
-
import { testProjects } from "@shivaedev/quality/testProjects.ts";
|
|
419
|
+
import { testProjects } from "@shivaedev/quality/adapters/testProjects.ts";
|
|
409
420
|
import { defineConfig } from "vitest/config";
|
|
410
421
|
|
|
411
422
|
export default defineConfig({ test: testProjects() });
|
|
@@ -424,12 +435,12 @@ testProjects({ maxWorkers: 4 });
|
|
|
424
435
|
|
|
425
436
|
The first configuration allows six workers, including on a two-CPU runner. `maxWorkers` takes precedence over the connection calculation. Counts and estimates must be positive safe integers. Vitest's native `--maxWorkers` CLI option can also override the returned configuration for a single run.
|
|
426
437
|
|
|
427
|
-
Coverage is opt-in: `testProjects({ coverage: true })` enables Vitest's V8 provider across the selected projects.
|
|
438
|
+
Coverage is opt-in: `testProjects({ coverage: true })` enables Vitest's V8 provider across the selected projects. Quality supplies `@vitest/coverage-v8` at its supported Vitest version. The report includes unvisited `src/**/*.ts` and `src/**/*.tsx` files and excludes declarations, tests, specs and `test-support`. To customize it, pass native Vitest coverage options, for example `testProjects({ coverage: { reporter: ["lcov", "text-summary"] } })` or `appTestConfig([], { coverage: { include: ["src/domain/**/*.ts"] } })`. No separate coverage config is needed.
|
|
428
439
|
|
|
429
440
|
Outside CI, `testProjects` sets `silent: "passed-only"` so local runs show logs only from failing tests. When `CI` is set to a nonempty value, it sets `silent: false` so CI keeps all test logs. It leaves `reporters` unset so Vitest can auto-detect its agent reporter. If a repository adds a reporter, spread `configDefaults.reporters` instead of replacing the defaults:
|
|
430
441
|
|
|
431
442
|
```ts
|
|
432
|
-
import { testProjects } from "@shivaedev/quality/testProjects.ts";
|
|
443
|
+
import { testProjects } from "@shivaedev/quality/adapters/testProjects.ts";
|
|
433
444
|
import { configDefaults, defineConfig } from "vitest/config";
|
|
434
445
|
|
|
435
446
|
export default defineConfig({
|
|
@@ -473,4 +484,4 @@ export default defineConfig({
|
|
|
473
484
|
Quality merges the Biome settings at lint and fix time; do not add or mirror an override in `biome.json`. Files are explicit repository paths. Biome exceptions cover individual lint rules or assist actions; whole checks, rule groups and globs are rejected. `biome/files/includes` is the directory exclusion form: keep `**` and list negative patterns naming directories, such as `!**/test-support/generated`. Quality's shipped exceptions are part of its internal policy. [Exceptions and upgrades](https://github.com/ShivaeDev/platform/blob/main/packages/quality/docs/debt-and-hooks.md#exceptions) describes subjects, stale entries and the upgrade command.
|
|
474
485
|
- The source inventory and Biome have their own scopes. `quality fix` runs Biome from the config's folder; it is not restricted to the source-rule inventory.
|
|
475
486
|
- The installed hook checks files on disk, not only what is staged, and uses each committing worktree's config and dependencies. Installation sets repository-local `core.hooksPath`; the hook chains an executable global pre-commit hook without changing global configuration. Either hook's failure blocks the commit. `quality hooks status` reports when git's effective hooks path does not run Quality.
|
|
476
|
-
- Workspace imports require a declaration in the importing package’s `dependencies`, `peerDependencies` or `optionalDependencies`. Tests, `test-support`, package-root tooling folders (`script`, `scripts`, `tooling`) and package-root config files may also use `devDependencies`.
|
|
487
|
+
- Workspace imports require a declaration in the importing package’s `dependencies`, `peerDependencies` or `optionalDependencies`. Tests, `test-support`, package-root tooling folders (`script`, `scripts`, `tooling`) and package-root config files may also use `devDependencies`. Executables and public modules keep their imports in the runtime boundary.
|
package/biome/preset.json
CHANGED
|
@@ -337,8 +337,7 @@
|
|
|
337
337
|
"useRegexpExec": "error",
|
|
338
338
|
"useStringStartsEndsWith": "error",
|
|
339
339
|
"useTailwindShorthandClasses": "error",
|
|
340
|
-
"useTailwindSortedClasses": { "fix": "safe", "level": "error" }
|
|
341
|
-
"useValidTestTitle": "error"
|
|
340
|
+
"useTailwindSortedClasses": { "fix": "safe", "level": "error" }
|
|
342
341
|
},
|
|
343
342
|
"performance": {
|
|
344
343
|
"noAccumulatingSpread": "error",
|
|
@@ -615,6 +614,16 @@
|
|
|
615
614
|
},
|
|
616
615
|
"markdown": { "parser": { "frontmatter": true } },
|
|
617
616
|
"overrides": [
|
|
617
|
+
{
|
|
618
|
+
"includes": ["**/*.test.*", "**/*.spec.*", "**/test-support/**"],
|
|
619
|
+
"linter": {
|
|
620
|
+
"rules": {
|
|
621
|
+
"nursery": {
|
|
622
|
+
"useValidTestTitle": "error"
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
},
|
|
618
627
|
{
|
|
619
628
|
"assist": {
|
|
620
629
|
"actions": {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const PackageManifest: Schema.Struct<{
|
|
3
|
+
readonly bin: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.$Record<Schema.String, Schema.String>]>>;
|
|
4
|
+
readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
5
|
+
readonly devDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
6
|
+
readonly engines: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
7
|
+
readonly exports: Schema.optionalKey<Schema.Unknown>;
|
|
8
|
+
readonly imports: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
9
|
+
readonly main: Schema.optionalKey<Schema.String>;
|
|
10
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
11
|
+
readonly optionalDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
12
|
+
readonly packageManager: Schema.optionalKey<Schema.String>;
|
|
13
|
+
readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
14
|
+
readonly private: Schema.optionalKey<Schema.Boolean>;
|
|
15
|
+
readonly quality: Schema.optionalKey<Schema.Struct<{
|
|
16
|
+
readonly runtime: Schema.optionalKey<Schema.Unknown>;
|
|
17
|
+
}>>;
|
|
18
|
+
readonly repository: Schema.optionalKey<Schema.Unknown>;
|
|
19
|
+
readonly scripts: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
20
|
+
readonly workspaces: Schema.optionalKey<Schema.Union<readonly [Schema.$Array<Schema.String>, Schema.Struct<{
|
|
21
|
+
readonly packages: Schema.$Array<Schema.String>;
|
|
22
|
+
}>]>>;
|
|
23
|
+
}>;
|
|
24
|
+
export type PackageManifest = typeof PackageManifest.Type;
|
|
25
|
+
//# sourceMappingURL=PackageManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageManifest.d.ts","sourceRoot":"","sources":["../src/PackageManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;EAiB1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
const Dependencies = Schema.Record(Schema.String, Schema.String);
|
|
3
|
+
export const PackageManifest = Schema.Struct({
|
|
4
|
+
bin: Schema.optionalKey(Schema.Union([Schema.String, Dependencies])),
|
|
5
|
+
dependencies: Schema.optionalKey(Dependencies),
|
|
6
|
+
devDependencies: Schema.optionalKey(Dependencies),
|
|
7
|
+
engines: Schema.optionalKey(Dependencies),
|
|
8
|
+
exports: Schema.optionalKey(Schema.Unknown),
|
|
9
|
+
imports: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)),
|
|
10
|
+
main: Schema.optionalKey(Schema.String),
|
|
11
|
+
name: Schema.optionalKey(Schema.String),
|
|
12
|
+
optionalDependencies: Schema.optionalKey(Dependencies),
|
|
13
|
+
packageManager: Schema.optionalKey(Schema.String),
|
|
14
|
+
peerDependencies: Schema.optionalKey(Dependencies),
|
|
15
|
+
private: Schema.optionalKey(Schema.Boolean),
|
|
16
|
+
quality: Schema.optionalKey(Schema.Struct({ runtime: Schema.optionalKey(Schema.Unknown) })),
|
|
17
|
+
repository: Schema.optionalKey(Schema.Unknown),
|
|
18
|
+
scripts: Schema.optionalKey(Dependencies),
|
|
19
|
+
workspaces: Schema.optionalKey(Schema.Union([Schema.Array(Schema.String), Schema.Struct({ packages: Schema.Array(Schema.String) })])),
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=PackageManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageManifest.js","sourceRoot":"","sources":["../src/PackageManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AW,CAAC,MAAM,CAAC,OAAO,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACrI,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Config, Context, Layer } from "effect";
|
|
2
|
+
import type { TestUserConfig } from "vitest/config";
|
|
3
|
+
declare const TestOutput_base: Context.ServiceClass<TestOutput, "@shivaedev/quality/TestOutput", Pick<TestUserConfig, "silent">>;
|
|
4
|
+
export declare class TestOutput extends TestOutput_base {
|
|
5
|
+
static readonly layer: Layer.Layer<TestOutput, Config.ConfigError, never>;
|
|
6
|
+
}
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=TestOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestOutput.d.ts","sourceRoot":"","sources":["../../src/adapters/TestOutput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;;AAEpD,qBAAa,UAAW,SAAQ,eAA8F;IAC7H,MAAM,CAAC,QAAQ,CAAC,KAAK,qDAGnB;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Config, Context, Effect, Layer } from "effect";
|
|
2
|
+
export class TestOutput extends Context.Service()("@shivaedev/quality/TestOutput") {
|
|
3
|
+
static layer = Layer.effect(TestOutput, Effect.map(Config.String("CI").pipe(Config.withDefault("")), (ci) => ({ silent: ci ? false : "passed-only" })));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=TestOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestOutput.js","sourceRoot":"","sources":["../../src/adapters/TestOutput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGxD,MAAM,OAAO,UAAW,SAAQ,OAAO,CAAC,OAAO,EAA8C,CAAC,+BAA+B,CAAC;IAC7H,MAAM,CAAU,KAAK,GAAG,KAAK,CAAC,MAAM,CACnC,UAAU,EACV,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAC9G,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/configuration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/configuration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAe3C,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CzD"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
3
|
import { exportedModule, exportTargets } from "#imports/packageExports.ts";
|
|
4
4
|
import { packageOf, workspacePackages } from "#imports/workspace.ts";
|
|
5
5
|
import { KNIP_ISSUES } from "./findings.js";
|
|
6
|
-
const Manifest = Schema.Struct({
|
|
7
|
-
bin: Schema.optional(Schema.Unknown),
|
|
8
|
-
exports: Schema.optional(Schema.Unknown),
|
|
9
|
-
imports: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
10
|
-
scripts: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
11
|
-
});
|
|
12
6
|
const ENTRIES = ["**/*.{test,spec,stories,story}.{ts,tsx,mts,cts,js,jsx,mjs,cjs}", "src/test-support/**", "*.config.{ts,mts,cts,js,mjs,cjs}"];
|
|
13
7
|
function importPaths(imports) {
|
|
14
8
|
return Object.fromEntries(Object.entries(imports).flatMap(([name, target]) => {
|
|
@@ -20,8 +14,7 @@ function importPaths(imports) {
|
|
|
20
14
|
export async function knipConfiguration(inputs) {
|
|
21
15
|
const packages = await workspacePackages(inputs);
|
|
22
16
|
const manifests = await Promise.all([".", ...packages.map(({ directory }) => directory)].map(async (directory) => {
|
|
23
|
-
const
|
|
24
|
-
const manifest = Schema.decodeUnknownSync(Schema.fromJsonString(Manifest))(text ?? "{}");
|
|
17
|
+
const manifest = (await readPackageManifest(inputs.readText, posix.join(directory, "package.json"))) ?? {};
|
|
25
18
|
return { directory, manifest };
|
|
26
19
|
}));
|
|
27
20
|
const scripted = new Set(manifests.flatMap(({ directory, manifest }) => Object.values(manifest.scripts ?? {}).flatMap((script) => script.split(/[\s'"`;|&()]+/u).map((word) => posix.join(directory, word)))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/adapters/knip/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/adapters/knip/configuration.ts"],"names":[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ACpB,mBAAmB,EAAE,KAAK;QAC1B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACrE,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;KAC1C,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entryPointFindings.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entryPointFindings.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGrD,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuDlG"}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
-
import { posix } from "node:path";
|
|
1
|
+
import { join, posix } from "node:path";
|
|
2
|
+
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
|
+
import { ambientModules } from "#imports/ambient.ts";
|
|
2
4
|
import { importGraph } from "#imports/graph.ts";
|
|
3
5
|
import { isTooling } from "#imports/isTooling.ts";
|
|
6
|
+
import { projectsFor } from "#imports/projects.ts";
|
|
4
7
|
import { packageOf } from "#imports/workspace.ts";
|
|
5
8
|
import { entryPointsOf, isApplication, provider } from "#manifests/entryPoints.ts";
|
|
6
9
|
import { isTestCode } from "#naming/testName.ts";
|
|
10
|
+
import { parse } from "#rules/parse.ts";
|
|
7
11
|
export async function entryPointFindings(inputs, findings) {
|
|
8
12
|
const graph = await importGraph(inputs);
|
|
13
|
+
const projectOf = projectsFor(inputs.root);
|
|
14
|
+
const ambient = ambientModules(inputs.sources.flatMap((file) => {
|
|
15
|
+
const syntax = parse(file);
|
|
16
|
+
return syntax === undefined ? [] : [{ path: join(inputs.root, file.path), syntax }];
|
|
17
|
+
}));
|
|
9
18
|
const unusedFiles = new Set(findings.filter((finding) => finding.subject?.startsWith("files:")).map((finding) => finding.file));
|
|
10
19
|
const workspace = new Map(graph.packages.map(({ name, directory }) => [name, directory]));
|
|
11
20
|
const directories = [".", ...graph.packages.map(({ directory }) => directory)];
|
|
12
21
|
const policies = new Map(await Promise.all(directories.map(async (directory) => {
|
|
13
|
-
const manifest =
|
|
22
|
+
const manifest = await readPackageManifest(inputs.readText, posix.join(directory, "package.json"));
|
|
14
23
|
return [directory, isApplication(manifest) ? await entryPointsOf(inputs, directory, manifest, workspace) : []];
|
|
15
24
|
})));
|
|
16
25
|
function owner(path) {
|
|
@@ -27,7 +36,8 @@ export async function entryPointFindings(inputs, findings) {
|
|
|
27
36
|
const directory = owner(finding.file);
|
|
28
37
|
const entries = policies.get(directory) ?? [];
|
|
29
38
|
if (kind === "unlisted") {
|
|
30
|
-
return
|
|
39
|
+
return (!ambient(name, projectOf(join(inputs.root, finding.file)).files)
|
|
40
|
+
&& provider(entries, name, development(directory, finding.file), true) === undefined);
|
|
31
41
|
}
|
|
32
42
|
if (kind !== "dependencies" && kind !== "devDependencies") {
|
|
33
43
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entryPointFindings.js","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"entryPointFindings.js","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAA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,CAAC;qBAChD,IAAI,CAAC,GAAG,CAAC,CAAC;YACd,OAAO,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;QAClH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Effect, FileSystem } from "effect";
|
|
2
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
1
3
|
import type { RuleInputs } from "#rule.ts";
|
|
2
|
-
export declare
|
|
4
|
+
export declare const runKnip: (inputs: RuleInputs) => Effect.Effect<import("#rule.ts").Findings, Error | import("effect/PlatformError").PlatformError, ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem>;
|
|
3
5
|
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/run.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAU,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAO3C,eAAO,MAAM,OAAO,2LA4ClB,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { basename, dirname, join, posix } from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
|
-
import { NodeServices } from "@effect/platform-node";
|
|
5
4
|
import { Effect, FileSystem, Stream } from "effect";
|
|
6
5
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
+
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
7
7
|
import { knipConfiguration } from "./configuration.js";
|
|
8
8
|
import { entryPointFindings } from "./entryPointFindings.js";
|
|
9
9
|
import { KNIP_ISSUES, knipFindings } from "./findings.js";
|
|
10
10
|
import { sourceConfig } from "./sourceConfig.js";
|
|
11
11
|
const BIN = join(dirname(createRequire(import.meta.url).resolve("knip")), "..", "bin", "knip.js");
|
|
12
|
-
export
|
|
13
|
-
if ((
|
|
12
|
+
export const runKnip = Effect.fn("Knip.runKnip")(function* (inputs) {
|
|
13
|
+
if ((yield* Effect.promise(() => readPackageManifest(inputs.readText, "package.json"))) === undefined) {
|
|
14
14
|
return [];
|
|
15
15
|
}
|
|
16
|
-
const configuration =
|
|
16
|
+
const configuration = yield* Effect.promise(() => knipConfiguration(inputs));
|
|
17
17
|
const checked = new Set([...inputs.files, ...Object.keys(configuration.workspaces).map((directory) => posix.join(directory, "package.json"))]);
|
|
18
|
-
const findings =
|
|
18
|
+
const findings = yield* Effect.scoped(Effect.gen(function* () {
|
|
19
19
|
const fs = yield* FileSystem.FileSystem;
|
|
20
20
|
const temporary = yield* fs.makeTempDirectoryScoped({ prefix: "quality-knip-" });
|
|
21
21
|
const config = join(temporary, "knip.json");
|
|
@@ -40,7 +40,7 @@ export async function runKnip(inputs) {
|
|
|
40
40
|
return yield* Effect.fail(new Error(`knip failed: ${stderr || `exit code ${code}`}`));
|
|
41
41
|
}
|
|
42
42
|
return knipFindings(stdout).filter((finding) => checked.has(finding.file));
|
|
43
|
-
}))
|
|
44
|
-
return entryPointFindings(inputs, findings);
|
|
45
|
-
}
|
|
43
|
+
}));
|
|
44
|
+
return yield* Effect.promise(() => entryPointFindings(inputs, findings));
|
|
45
|
+
});
|
|
46
46
|
//# sourceMappingURL=run.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/adapters/knip/run.ts"],"names":[],"mappings":"AAAA,O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E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PackageManifest } from "#PackageManifest.ts";
|
|
2
|
+
import type { RuleInputs } from "#rule.ts";
|
|
3
|
+
type ReadText = RuleInputs["readText"];
|
|
4
|
+
declare const ManifestFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly _tag: "ManifestFailure";
|
|
6
|
+
} & Readonly<A>;
|
|
7
|
+
export declare class ManifestFailure extends ManifestFailure_base<{
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export interface ManifestEntry {
|
|
13
|
+
readonly manifest: PackageManifest;
|
|
14
|
+
readonly text: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function manifestEntry(readText: ReadText, path: string): Promise<ManifestEntry | undefined>;
|
|
17
|
+
export declare function readPackageManifest(readText: ReadText, path: string): Promise<PackageManifest | undefined>;
|
|
18
|
+
export declare function manifestText(readText: ReadText, path: string): Promise<string | undefined>;
|
|
19
|
+
export declare function manifestFiles(inputs: Pick<RuleInputs, "readText" | "files">): readonly string[];
|
|
20
|
+
export declare function setManifestFiles(readText: ReadText, files: readonly string[]): void;
|
|
21
|
+
export declare function loadPackageManifests(readText: ReadText, files: readonly string[]): Promise<readonly ManifestFailure[]>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=manifestInventory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifestInventory.d.ts","sourceRoot":"","sources":["../../src/adapters/manifestInventory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,KAAK,QAAQ,GAAG,UAAU,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