@shivaedev/quality 0.74.3 → 0.75.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 +20 -0
- package/README.md +15 -4
- package/dist/adapters/asciiFindings.d.ts +1 -1
- package/dist/adapters/asciiFindings.d.ts.map +1 -1
- package/dist/adapters/asciiFindings.js +1 -1
- package/dist/adapters/asciiFindings.js.map +1 -1
- package/dist/adapters/biome/configs.d.ts +4 -1
- package/dist/adapters/biome/configs.d.ts.map +1 -1
- package/dist/adapters/biome/configs.js +32 -27
- package/dist/adapters/biome/configs.js.map +1 -1
- package/dist/adapters/biome/presetConfig.d.ts +2 -2
- package/dist/adapters/biome/presetConfig.d.ts.map +1 -1
- package/dist/adapters/biome/presetConfig.js +5 -5
- package/dist/adapters/biome/presetConfig.js.map +1 -1
- package/dist/adapters/biome/resolvePackage.d.ts +2 -2
- package/dist/adapters/biome/resolvePackage.d.ts.map +1 -1
- package/dist/adapters/biome/resolvePackage.js +5 -4
- package/dist/adapters/biome/resolvePackage.js.map +1 -1
- package/dist/adapters/biome/rootConfig.d.ts +3 -2
- package/dist/adapters/biome/rootConfig.d.ts.map +1 -1
- package/dist/adapters/biome/rootConfig.js +4 -3
- package/dist/adapters/biome/rootConfig.js.map +1 -1
- package/dist/adapters/biome/toolContractDefaults.d.ts +1 -1
- package/dist/adapters/biome/toolContractDefaults.d.ts.map +1 -1
- package/dist/adapters/biome/toolContractDefaults.js +2 -5
- package/dist/adapters/biome/toolContractDefaults.js.map +1 -1
- package/dist/adapters/builtinName.d.ts +2 -0
- package/dist/adapters/builtinName.d.ts.map +1 -0
- package/dist/adapters/builtinName.js +9 -0
- package/dist/adapters/builtinName.js.map +1 -0
- package/dist/adapters/catalogWorkspace.d.ts +1 -1
- package/dist/adapters/catalogWorkspace.d.ts.map +1 -1
- package/dist/adapters/catalogWorkspace.js +1 -1
- package/dist/adapters/catalogWorkspace.js.map +1 -1
- package/dist/adapters/commandLine.d.ts +15 -0
- package/dist/adapters/commandLine.d.ts.map +1 -0
- package/dist/adapters/commandLine.js +10 -0
- package/dist/adapters/commandLine.js.map +1 -0
- package/dist/adapters/contentHashedModule.d.ts +2 -0
- package/dist/adapters/contentHashedModule.d.ts.map +1 -0
- package/dist/adapters/contentHashedModule.js +9 -0
- package/dist/adapters/contentHashedModule.js.map +1 -0
- package/dist/adapters/databaseUrlFindings.d.ts +1 -1
- package/dist/adapters/databaseUrlFindings.d.ts.map +1 -1
- package/dist/adapters/domEnvironment.config.d.ts.map +1 -0
- package/dist/adapters/domEnvironment.config.js.map +1 -0
- package/dist/adapters/freshObject.d.ts +3 -0
- package/dist/adapters/freshObject.d.ts.map +1 -0
- package/dist/adapters/freshObject.js +53 -0
- package/dist/adapters/freshObject.js.map +1 -0
- package/dist/adapters/imports/resolve.d.ts.map +1 -1
- package/dist/adapters/imports/resolve.js +2 -1
- package/dist/adapters/imports/resolve.js.map +1 -1
- package/dist/adapters/knip/configuration.d.ts +3 -2
- package/dist/adapters/knip/configuration.d.ts.map +1 -1
- package/dist/adapters/knip/configuration.js +8 -7
- package/dist/adapters/knip/configuration.js.map +1 -1
- package/dist/adapters/knip/entryPointFindings.d.ts +1 -1
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/knip/entryPointFindings.js +4 -4
- package/dist/adapters/knip/entryPointFindings.js.map +1 -1
- package/dist/adapters/knip/run.d.ts +1 -1
- package/dist/adapters/knip/run.d.ts.map +1 -1
- package/dist/adapters/knip/run.js +2 -2
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/knip/sourceConfig.d.ts +1 -1
- package/dist/adapters/knip/sourceConfig.d.ts.map +1 -1
- package/dist/adapters/knip/sourceConfig.js +1 -1
- package/dist/adapters/knip/sourceConfig.js.map +1 -1
- package/dist/adapters/manifestInventory.d.ts +45 -4
- package/dist/adapters/manifestInventory.d.ts.map +1 -1
- package/dist/adapters/manifestInventory.js +26 -32
- package/dist/adapters/manifestInventory.js.map +1 -1
- package/dist/adapters/manifestReader.d.ts +2 -2
- package/dist/adapters/manifestReader.d.ts.map +1 -1
- package/dist/adapters/manifestReader.js +3 -4
- package/dist/adapters/manifestReader.js.map +1 -1
- package/dist/adapters/manifestSorting.d.ts +8 -0
- package/dist/adapters/manifestSorting.d.ts.map +1 -0
- package/dist/adapters/manifestSorting.js +6 -0
- package/dist/adapters/manifestSorting.js.map +1 -0
- package/dist/adapters/outsideImportFindings.d.ts +3 -1
- package/dist/adapters/outsideImportFindings.d.ts.map +1 -1
- package/dist/adapters/outsideImportFindings.js +1 -1
- package/dist/adapters/outsideImportFindings.js.map +1 -1
- package/dist/adapters/queueReadoutFindings.d.ts +1 -1
- package/dist/adapters/queueReadoutFindings.d.ts.map +1 -1
- package/dist/adapters/queueReadoutFindings.js +1 -1
- package/dist/adapters/queueReadoutFindings.js.map +1 -1
- package/dist/adapters/repositoryPathFindings.d.ts +1 -1
- package/dist/adapters/repositoryPathFindings.d.ts.map +1 -1
- package/dist/adapters/repositoryPathFindings.js +1 -1
- package/dist/adapters/repositoryPathFindings.js.map +1 -1
- package/dist/adapters/rpcBoundaryFindings.d.ts +1 -1
- package/dist/adapters/rpcBoundaryFindings.d.ts.map +1 -1
- package/dist/adapters/rule.d.ts +1 -1
- package/dist/adapters/rule.d.ts.map +1 -1
- package/dist/adapters/rule.js +2 -3
- package/dist/adapters/rule.js.map +1 -1
- package/dist/adapters/runMain.d.ts.map +1 -0
- package/dist/adapters/runMain.js.map +1 -0
- package/dist/adapters/serviceIdFindings.d.ts +1 -1
- package/dist/adapters/serviceIdFindings.d.ts.map +1 -1
- package/dist/adapters/serviceIdFindings.js +1 -1
- package/dist/adapters/serviceIdFindings.js.map +1 -1
- package/dist/adapters/sharedErrorFindings.d.ts +1 -1
- package/dist/adapters/sharedErrorFindings.d.ts.map +1 -1
- package/dist/adapters/sharedErrorFindings.js +1 -1
- package/dist/adapters/sharedErrorFindings.js.map +1 -1
- package/dist/adapters/sharedErrorModules.d.ts +2 -1
- package/dist/adapters/sharedErrorModules.d.ts.map +1 -1
- package/dist/adapters/sharedErrorModules.js +4 -3
- package/dist/adapters/sharedErrorModules.js.map +1 -1
- package/dist/adapters/testProjects.js +2 -2
- package/dist/adapters/testProjects.js.map +1 -1
- package/dist/adapters/unitIoGuard.config.d.ts.map +1 -0
- package/dist/adapters/unitIoGuard.config.js.map +1 -0
- package/dist/appTestConfig.d.ts +2 -1
- package/dist/appTestConfig.d.ts.map +1 -1
- package/dist/appTestConfig.js +2 -3
- package/dist/appTestConfig.js.map +1 -1
- package/dist/baseline/format.d.ts +1 -1
- package/dist/baseline/format.d.ts.map +1 -1
- package/dist/baseline/format.js +2 -2
- package/dist/baseline/format.js.map +1 -1
- package/dist/baseline/legacy.d.ts +1 -1
- package/dist/baseline/legacy.d.ts.map +1 -1
- package/dist/baseline/legacy.js +2 -2
- package/dist/baseline/legacy.js.map +1 -1
- package/dist/baseline/looseStagedEntries.js +2 -2
- package/dist/baseline/looseStagedEntries.js.map +1 -1
- package/dist/baseline/merge.js +1 -1
- package/dist/baseline/merge.js.map +1 -1
- package/dist/biome/report.d.ts +1 -1
- package/dist/biome/report.d.ts.map +1 -1
- package/dist/biome/withoutEntryPointImports.d.ts +1 -1
- package/dist/biome/withoutEntryPointImports.d.ts.map +1 -1
- package/dist/biome/withoutEntryPointImports.js +2 -2
- package/dist/biome/withoutEntryPointImports.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +3 -6
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/migrateBaseline.d.ts.map +1 -1
- package/dist/cli/migrateBaseline.js +1 -3
- package/dist/cli/migrateBaseline.js.map +1 -1
- package/dist/cli/migrateExceptions.js +2 -2
- package/dist/cli/migrateExceptions.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/decode.d.ts +1 -1
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/load.js +1 -1
- package/dist/config/load.js.map +1 -1
- package/dist/decoded.d.ts +1 -1
- package/dist/decoded.d.ts.map +1 -1
- package/dist/decoded.js +2 -2
- package/dist/decoded.js.map +1 -1
- package/dist/docs/importFindings.d.ts +4 -3
- package/dist/docs/importFindings.d.ts.map +1 -1
- package/dist/docs/importFindings.js.map +1 -1
- package/dist/docs/linkFindings.d.ts +3 -2
- package/dist/docs/linkFindings.d.ts.map +1 -1
- package/dist/docs/linkFindings.js.map +1 -1
- package/dist/engine/baselineFile.js +1 -1
- package/dist/engine/baselineFile.js.map +1 -1
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +1 -1
- package/dist/engine/session.js.map +1 -1
- package/dist/exceptions/biomeFindings.d.ts +3 -2
- package/dist/exceptions/biomeFindings.d.ts.map +1 -1
- package/dist/exceptions/biomeFindings.js +2 -2
- package/dist/exceptions/biomeFindings.js.map +1 -1
- package/dist/exceptions/declaration.d.ts +1 -1
- package/dist/exceptions/declaration.d.ts.map +1 -1
- package/dist/exceptions/registry.d.ts +1 -1
- package/dist/exceptions/registry.d.ts.map +1 -1
- package/dist/exceptions/registry.js +1 -1
- package/dist/exceptions/registry.js.map +1 -1
- package/dist/hooks/preCommit.js +2 -5
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/imports/browserGlobals.d.ts +1 -1
- package/dist/imports/browserGlobals.d.ts.map +1 -1
- package/dist/imports/browserGlobals.js +7 -2
- package/dist/imports/browserGlobals.js.map +1 -1
- package/dist/imports/browserNames.d.ts +3 -1
- package/dist/imports/browserNames.d.ts.map +1 -1
- package/dist/imports/browserNames.js +9 -5
- package/dist/imports/browserNames.js.map +1 -1
- package/dist/imports/departures.d.ts +1 -1
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/departures.js +1 -1
- package/dist/imports/departures.js.map +1 -1
- package/dist/imports/fences/BoundaryFailure.d.ts +10 -0
- package/dist/imports/fences/BoundaryFailure.d.ts.map +1 -0
- package/dist/imports/fences/BoundaryFailure.js +4 -0
- package/dist/imports/fences/BoundaryFailure.js.map +1 -0
- package/dist/imports/fences/check.d.ts +1 -1
- package/dist/imports/fences/check.d.ts.map +1 -1
- package/dist/imports/fences/check.js +1 -1
- package/dist/imports/fences/check.js.map +1 -1
- package/dist/imports/fences/declarations.d.ts +1 -1
- package/dist/imports/fences/declarations.d.ts.map +1 -1
- package/dist/imports/fences/discover.d.ts +3 -1
- package/dist/imports/fences/discover.d.ts.map +1 -1
- package/dist/imports/fences/discover.js +32 -26
- package/dist/imports/fences/discover.js.map +1 -1
- package/dist/imports/fences/match.d.ts.map +1 -1
- package/dist/imports/fences/match.js +2 -1
- package/dist/imports/fences/match.js.map +1 -1
- package/dist/imports/globMatcher.d.ts +10 -1
- package/dist/imports/globMatcher.d.ts.map +1 -1
- package/dist/imports/globMatcher.js +12 -17
- package/dist/imports/globMatcher.js.map +1 -1
- package/dist/imports/graph.d.ts +1 -1
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/imports/graph.js +1 -1
- package/dist/imports/graph.js.map +1 -1
- package/dist/imports/packageName.d.ts +0 -1
- package/dist/imports/packageName.d.ts.map +1 -1
- package/dist/imports/packageName.js +1 -8
- package/dist/imports/packageName.js.map +1 -1
- package/dist/imports/runtime.d.ts +2 -2
- package/dist/imports/runtime.d.ts.map +1 -1
- package/dist/imports/runtime.js +2 -2
- package/dist/imports/runtime.js.map +1 -1
- package/dist/imports/segmentsMatch.d.ts +5 -0
- package/dist/imports/segmentsMatch.d.ts.map +1 -0
- package/dist/imports/segmentsMatch.js +16 -0
- package/dist/imports/segmentsMatch.js.map +1 -0
- package/dist/imports/withoutGenerated.d.ts +1 -1
- package/dist/imports/withoutGenerated.d.ts.map +1 -1
- package/dist/imports/withoutGenerated.js +1 -1
- package/dist/imports/withoutGenerated.js.map +1 -1
- package/dist/imports/workspace.d.ts +2 -1
- package/dist/imports/workspace.d.ts.map +1 -1
- package/dist/imports/workspace.js +17 -15
- package/dist/imports/workspace.js.map +1 -1
- package/dist/inventory/programmaticBuilds.d.ts +1 -1
- package/dist/inventory/programmaticBuilds.d.ts.map +1 -1
- package/dist/manifests/entryPoints.d.ts +2 -1
- package/dist/manifests/entryPoints.d.ts.map +1 -1
- package/dist/manifests/entryPoints.js +9 -8
- package/dist/manifests/entryPoints.js.map +1 -1
- package/dist/manifests/sorted.d.ts +0 -7
- package/dist/manifests/sorted.d.ts.map +1 -1
- package/dist/manifests/sorted.js +3 -10
- package/dist/manifests/sorted.js.map +1 -1
- package/dist/naming/developmentCode.d.ts +1 -1
- package/dist/naming/developmentCode.d.ts.map +1 -1
- package/dist/naming/developmentCode.js +2 -2
- package/dist/naming/developmentCode.js.map +1 -1
- package/dist/naming/packageLayout.d.ts +2 -1
- package/dist/naming/packageLayout.d.ts.map +1 -1
- package/dist/naming/packageLayout.js +4 -1
- package/dist/naming/packageLayout.js.map +1 -1
- package/dist/naming/packageTests.d.ts +1 -1
- package/dist/naming/packageTests.d.ts.map +1 -1
- package/dist/naming/packageTests.js +2 -2
- package/dist/naming/packageTests.js.map +1 -1
- package/dist/naming/testCode.d.ts +1 -1
- package/dist/naming/testCode.d.ts.map +1 -1
- package/dist/naming/testCode.js +1 -1
- package/dist/naming/testCode.js.map +1 -1
- package/dist/rule.d.ts +2 -2
- package/dist/rule.d.ts.map +1 -1
- package/dist/rules/biome.js +1 -1
- package/dist/rules/biome.js.map +1 -1
- package/dist/rules/docs/references.d.ts.map +1 -1
- package/dist/rules/docs/references.js +6 -10
- package/dist/rules/docs/references.js.map +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.map +1 -1
- package/dist/rules/effect/boundary.js +1 -1
- package/dist/rules/effect/boundary.js.map +1 -1
- package/dist/rules/effect/failureFindings.d.ts +1 -1
- package/dist/rules/effect/failureFindings.d.ts.map +1 -1
- package/dist/rules/effect/failureFindings.js +9 -3
- package/dist/rules/effect/failureFindings.js.map +1 -1
- package/dist/rules/effect/failureHonesty.d.ts.map +1 -1
- package/dist/rules/effect/failureHonesty.js +3 -2
- package/dist/rules/effect/failureHonesty.js.map +1 -1
- package/dist/rules/effect/serviceParameters.js +2 -2
- package/dist/rules/effect/serviceParameters.js.map +1 -1
- package/dist/rules/effect/successRecovery.d.ts +1 -0
- package/dist/rules/effect/successRecovery.d.ts.map +1 -1
- package/dist/rules/effect/successRecovery.js +23 -0
- package/dist/rules/effect/successRecovery.js.map +1 -1
- package/dist/rules/files/packageImports.d.ts +2 -1
- package/dist/rules/files/packageImports.d.ts.map +1 -1
- package/dist/rules/files/packageImports.js +1 -1
- package/dist/rules/files/packageImports.js.map +1 -1
- package/dist/rules/files/stylesheetImporters.d.ts +2 -1
- package/dist/rules/files/stylesheetImporters.d.ts.map +1 -1
- package/dist/rules/files/stylesheetImporters.js +1 -1
- package/dist/rules/files/stylesheetImporters.js.map +1 -1
- package/dist/rules/imports/manifest.js +4 -4
- package/dist/rules/imports/manifest.js.map +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +2 -3
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/manifestsApplication.d.ts.map +1 -1
- package/dist/rules/manifestsApplication.js +4 -4
- package/dist/rules/manifestsApplication.js.map +1 -1
- package/dist/rules/manifestsDependencyPins.js +1 -1
- package/dist/rules/manifestsDependencyPins.js.map +1 -1
- package/dist/rules/manifestsExportsShape.js +2 -2
- package/dist/rules/manifestsExportsShape.js.map +1 -1
- package/dist/rules/manifestsNoTestKits.d.ts.map +1 -1
- package/dist/rules/manifestsNoTestKits.js +1 -1
- package/dist/rules/manifestsNoTestKits.js.map +1 -1
- package/dist/rules/manifestsSorted.js +2 -2
- package/dist/rules/manifestsSorted.js.map +1 -1
- package/dist/rules/manifestsSourceFirst.js +1 -1
- package/dist/rules/manifestsSourceFirst.js.map +1 -1
- package/dist/rules/manifestsValid.d.ts.map +1 -1
- package/dist/rules/manifestsValid.js +1 -1
- package/dist/rules/manifestsValid.js.map +1 -1
- package/dist/rules/stories/authSql.js +1 -1
- package/dist/rules/stories/authSql.js.map +1 -1
- package/dist/rules/stories/engine.js +1 -1
- package/dist/rules/stories/engine.js.map +1 -1
- package/dist/rules/stories/prerequisites.d.ts +2 -1
- package/dist/rules/stories/prerequisites.d.ts.map +1 -1
- package/dist/rules/stories/prerequisites.js +4 -3
- package/dist/rules/stories/prerequisites.js.map +1 -1
- package/dist/rules/stories/queueSql.d.ts.map +1 -1
- package/dist/rules/stories/queueSql.js +3 -2
- package/dist/rules/stories/queueSql.js.map +1 -1
- package/dist/rules/stories/sources.d.ts +2 -2
- package/dist/rules/stories/sources.d.ts.map +1 -1
- package/dist/rules/stories/sources.js +1 -1
- package/dist/rules/stories/sources.js.map +1 -1
- package/dist/rules/stories/specs.js +1 -1
- package/dist/rules/stories/specs.js.map +1 -1
- package/dist/rules/stories/sqlText.d.ts +3 -1
- package/dist/rules/stories/sqlText.d.ts.map +1 -1
- package/dist/rules/stories/sqlText.js +12 -11
- package/dist/rules/stories/sqlText.js.map +1 -1
- package/dist/rules/suppressions/biome/declarations.d.ts +1 -1
- package/dist/rules/suppressions/biome/declarations.d.ts.map +1 -1
- package/dist/rules/suppressions/biome/declarations.js +1 -1
- package/dist/rules/suppressions/biome/declarations.js.map +1 -1
- package/dist/rules/suppressions/biomeOverrides.js +1 -1
- package/dist/rules/suppressions/biomeOverrides.js.map +1 -1
- package/dist/rules/suppressions/noDoubleCast.js +1 -1
- package/dist/rules/suppressions/noDoubleCast.js.map +1 -1
- package/dist/rules/suppressions/noInline.d.ts.map +1 -1
- package/dist/rules/suppressions/noInline.js +11 -4
- package/dist/rules/suppressions/noInline.js.map +1 -1
- package/dist/rules/suppressions/readonlyWrite.d.ts.map +1 -1
- package/dist/rules/suppressions/readonlyWrite.js +2 -1
- package/dist/rules/suppressions/readonlyWrite.js.map +1 -1
- package/dist/testing/adapters/cli.js +1 -1
- package/dist/testing/adapters/cli.js.map +1 -1
- package/dist/testing/adapters/imports.js +2 -2
- package/dist/testing/adapters/imports.js.map +1 -1
- package/dist/testing/adapters/run.js +1 -1
- package/dist/testing/adapters/run.js.map +1 -1
- package/dist/testing/adapters/tree.d.ts +1 -0
- package/dist/testing/adapters/tree.d.ts.map +1 -1
- package/dist/testing/adapters/tree.js +3 -0
- package/dist/testing/adapters/tree.js.map +1 -1
- package/dist/testing/ruleStory.js +1 -1
- package/dist/testing/ruleStory.js.map +1 -1
- package/package.json +4 -4
- package/src/adapters/asciiFindings.ts +1 -1
- package/src/adapters/biome/configs.ts +50 -28
- package/src/adapters/biome/presetConfig.ts +5 -5
- package/src/adapters/biome/resolvePackage.ts +5 -4
- package/src/adapters/biome/rootConfig.ts +7 -3
- package/src/adapters/biome/toolContractDefaults.ts +4 -5
- package/src/adapters/builtinName.ts +10 -0
- package/src/adapters/catalogWorkspace.ts +1 -1
- package/src/adapters/commandLine.ts +10 -0
- package/src/adapters/contentHashedModule.ts +9 -0
- package/src/adapters/freshObject.ts +61 -0
- package/src/adapters/imports/resolve.ts +2 -1
- package/src/adapters/knip/configuration.ts +12 -8
- package/src/adapters/knip/entryPointFindings.ts +7 -7
- package/src/adapters/knip/run.ts +2 -2
- package/src/adapters/knip/sourceConfig.ts +1 -3
- package/src/adapters/manifestInventory.ts +37 -32
- package/src/adapters/manifestReader.ts +4 -5
- package/src/adapters/manifestSorting.ts +8 -0
- package/src/adapters/outsideImportFindings.ts +4 -3
- package/src/adapters/queueReadoutFindings.ts +1 -1
- package/src/adapters/repositoryPathFindings.ts +1 -1
- package/src/adapters/rule.ts +3 -4
- package/src/adapters/serviceIdFindings.ts +1 -1
- package/src/adapters/sharedErrorFindings.ts +1 -1
- package/src/adapters/sharedErrorModules.ts +4 -3
- package/src/adapters/testProjects.ts +2 -2
- package/src/appTestConfig.ts +4 -4
- package/src/baseline/format.ts +2 -2
- package/src/baseline/legacy.ts +2 -2
- package/src/baseline/looseStagedEntries.ts +2 -2
- package/src/baseline/merge.ts +1 -1
- package/src/biome/withoutEntryPointImports.ts +2 -2
- package/src/cli/args.ts +3 -6
- package/src/cli/migrateBaseline.ts +1 -3
- package/src/cli/migrateExceptions.ts +2 -2
- package/src/cli.ts +1 -1
- package/src/config/decode.ts +1 -1
- package/src/config/load.ts +1 -1
- package/src/decoded.ts +4 -6
- package/src/docs/importFindings.ts +5 -4
- package/src/docs/linkFindings.ts +8 -3
- package/src/engine/baselineFile.ts +1 -1
- package/src/engine/session.ts +3 -3
- package/src/exceptions/biomeFindings.ts +7 -3
- package/src/exceptions/declaration.ts +1 -1
- package/src/exceptions/registry.ts +2 -2
- package/src/hooks/preCommit.ts +5 -5
- package/src/imports/browserGlobals.ts +8 -2
- package/src/imports/browserNames.ts +13 -5
- package/src/imports/departures.ts +1 -1
- package/src/imports/fences/BoundaryFailure.ts +6 -0
- package/src/imports/fences/check.ts +1 -1
- package/src/imports/fences/discover.ts +41 -26
- package/src/imports/fences/match.ts +2 -1
- package/src/imports/globMatcher.ts +15 -21
- package/src/imports/graph.ts +1 -1
- package/src/imports/packageName.ts +1 -10
- package/src/imports/runtime.ts +3 -4
- package/src/imports/segmentsMatch.ts +19 -0
- package/src/imports/withoutGenerated.ts +1 -1
- package/src/imports/workspace.ts +25 -17
- package/src/manifests/entryPoints.ts +25 -13
- package/src/manifests/sorted.ts +5 -16
- package/src/naming/developmentCode.ts +2 -2
- package/src/naming/packageLayout.ts +6 -6
- package/src/naming/packageTests.ts +2 -2
- package/src/naming/testCode.ts +8 -11
- package/src/rule.ts +2 -2
- package/src/rules/biome.ts +1 -1
- package/src/rules/docs/references.ts +8 -15
- package/src/rules/docs/unversionedInstalls.ts +1 -4
- package/src/rules/effect/boundary.ts +16 -19
- package/src/rules/effect/failureFindings.ts +12 -3
- package/src/rules/effect/failureHonesty.ts +3 -2
- package/src/rules/effect/serviceParameters.ts +2 -2
- package/src/rules/effect/successRecovery.ts +26 -0
- package/src/rules/files/packageImports.ts +3 -6
- package/src/rules/files/stylesheetImporters.ts +3 -6
- package/src/rules/imports/manifest.ts +6 -6
- package/src/rules/imports/runtime.ts +2 -3
- package/src/rules/manifestsApplication.ts +8 -9
- package/src/rules/manifestsDependencyPins.ts +1 -1
- package/src/rules/manifestsExportsShape.ts +2 -2
- package/src/rules/manifestsNoTestKits.ts +1 -4
- package/src/rules/manifestsSorted.ts +2 -2
- package/src/rules/manifestsSourceFirst.ts +1 -1
- package/src/rules/manifestsValid.ts +2 -3
- package/src/rules/stories/authSql.ts +1 -1
- package/src/rules/stories/engine.ts +1 -1
- package/src/rules/stories/prerequisites.ts +4 -3
- package/src/rules/stories/queueSql.ts +12 -9
- package/src/rules/stories/sources.ts +1 -1
- package/src/rules/stories/specs.ts +1 -1
- package/src/rules/stories/sqlText.ts +16 -12
- package/src/rules/suppressions/biome/declarations.ts +2 -2
- package/src/rules/suppressions/biomeOverrides.ts +1 -1
- package/src/rules/suppressions/noDoubleCast.ts +1 -1
- package/src/rules/suppressions/noInline.ts +15 -7
- package/src/rules/suppressions/readonlyWrite.ts +2 -1
- package/src/testing/adapters/cli.ts +1 -1
- package/src/testing/adapters/imports.ts +2 -2
- package/src/testing/adapters/run.ts +1 -1
- package/src/testing/adapters/tree.ts +4 -0
- package/src/testing/ruleStory.ts +1 -1
- package/dist/cli/runMain.d.ts.map +0 -1
- package/dist/cli/runMain.js.map +0 -1
- package/dist/domEnvironment.config.d.ts.map +0 -1
- package/dist/domEnvironment.config.js.map +0 -1
- package/dist/unitIoGuard.config.d.ts.map +0 -1
- package/dist/unitIoGuard.config.js.map +0 -1
- /package/dist/{domEnvironment.config.d.ts → adapters/domEnvironment.config.d.ts} +0 -0
- /package/dist/{domEnvironment.config.js → adapters/domEnvironment.config.js} +0 -0
- /package/dist/{cli → adapters}/runMain.d.ts +0 -0
- /package/dist/{cli → adapters}/runMain.js +0 -0
- /package/dist/{unitIoGuard.config.d.ts → adapters/unitIoGuard.config.d.ts} +0 -0
- /package/dist/{unitIoGuard.config.js → adapters/unitIoGuard.config.js} +0 -0
- /package/src/{domEnvironment.config.ts → adapters/domEnvironment.config.ts} +0 -0
- /package/src/{cli → adapters}/runMain.ts +0 -0
- /package/src/{unitIoGuard.config.ts → adapters/unitIoGuard.config.ts} +0 -0
package/src/adapters/rule.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { describeIssue, type StandardSchemaV1 } from "#adapters/standardSchema.t
|
|
|
3
3
|
import { validOrFail } from "#decoded.ts";
|
|
4
4
|
import type { Configured, Findings, RegisteredRule, RuleContext } from "#rule.ts";
|
|
5
5
|
|
|
6
|
-
export type RuleCheckResult<TServices> = Findings |
|
|
6
|
+
export type RuleCheckResult<TServices> = Findings | Effect.Effect<Findings, unknown, TServices>;
|
|
7
7
|
|
|
8
8
|
export const ruleConfiguration = Symbol("@shivaedev/quality/ruleConfiguration");
|
|
9
9
|
|
|
@@ -43,9 +43,8 @@ export function configureWith<TInput, TOptions, TServices>(
|
|
|
43
43
|
inputs.configFile ?? "quality.config.ts",
|
|
44
44
|
issues.length === 0 ? { _tag: "Valid", value: undefined } : { _tag: "Invalid", issues },
|
|
45
45
|
);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
return yield* Effect.isEffect(checked) ? checked : Effect.promise(() => Promise.resolve(checked));
|
|
46
|
+
const checked = check(context);
|
|
47
|
+
return Effect.isEffect(checked) ? yield* checked : checked;
|
|
49
48
|
}),
|
|
50
49
|
),
|
|
51
50
|
};
|
|
@@ -66,7 +66,7 @@ function checkPackage(inputs: RuleInputs, prefix: string): readonly Finding[] {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export const serviceIdFindings = Effect.fn("ServiceIds.serviceIdFindings")(function* (inputs: RuleInputs) {
|
|
69
|
-
const packages = yield*
|
|
69
|
+
const packages = yield* workspacePackages(inputs);
|
|
70
70
|
const groups = new Map<WorkspacePackage, RuleInputs["sources"][number][]>();
|
|
71
71
|
for (const source of inputs.sources) {
|
|
72
72
|
if (!source.path.startsWith("packages/")) {
|
|
@@ -66,7 +66,7 @@ export const sharedErrorFindings = Effect.fn("SharedErrorClasses.sharedErrorFind
|
|
|
66
66
|
if (sources.length === 0) {
|
|
67
67
|
return [];
|
|
68
68
|
}
|
|
69
|
-
const modules = yield*
|
|
69
|
+
const modules = yield* sharedErrorModules({ ...inputs, sources });
|
|
70
70
|
if (modules.length === 0) {
|
|
71
71
|
return [];
|
|
72
72
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { Effect } from "effect";
|
|
4
5
|
import ts from "typescript";
|
|
5
6
|
import errorsPackage from "@shivaedev/errors/package.json" with { type: "json" };
|
|
6
7
|
import { type Project, projectsFor } from "#adapters/imports/projects.ts";
|
|
@@ -46,7 +47,7 @@ function resolveModules(specifiers: readonly string[], from: string, project: Pr
|
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
export
|
|
50
|
+
export const sharedErrorModules = Effect.fn("SharedErrors.sharedErrorModules")(function* (inputs: RuleInputs) {
|
|
50
51
|
const projectOf = projectsFor(inputs.root);
|
|
51
52
|
const manifests = new Map<string, string>();
|
|
52
53
|
for (const source of inputs.sources) {
|
|
@@ -68,7 +69,7 @@ export async function sharedErrorModules(inputs: RuleInputs): Promise<readonly S
|
|
|
68
69
|
}
|
|
69
70
|
const modules = new Map<string, SharedErrorModule>();
|
|
70
71
|
for (const [manifestPath, from] of manifests) {
|
|
71
|
-
const manifest =
|
|
72
|
+
const manifest = yield* readPackageManifest(inputs.readText, relative(inputs.root, manifestPath));
|
|
72
73
|
const exports = manifest?.exports;
|
|
73
74
|
if (typeof exports !== "object" || exports === null || Array.isArray(exports)) {
|
|
74
75
|
continue;
|
|
@@ -78,4 +79,4 @@ export async function sharedErrorModules(inputs: RuleInputs): Promise<readonly S
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
return [...modules.values()];
|
|
81
|
-
}
|
|
82
|
+
});
|
|
@@ -75,13 +75,13 @@ export function testProjects(options: TestProjectsOptions = {}): TestUserConfig
|
|
|
75
75
|
exclude: excluding(),
|
|
76
76
|
include: [named("unit")],
|
|
77
77
|
name: "pure",
|
|
78
|
-
setupFiles: [fileURLToPath(import.meta.resolve("#unitIoGuard.config.ts"))],
|
|
78
|
+
setupFiles: [fileURLToPath(import.meta.resolve("#adapters/unitIoGuard.config.ts"))],
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
extends: true,
|
|
83
83
|
test: {
|
|
84
|
-
environment: fileURLToPath(import.meta.resolve("#domEnvironment.config.ts")),
|
|
84
|
+
environment: fileURLToPath(import.meta.resolve("#adapters/domEnvironment.config.ts")),
|
|
85
85
|
exclude: excluding(named("slow")),
|
|
86
86
|
include: [named("dom")],
|
|
87
87
|
name: "dom",
|
package/src/appTestConfig.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ViteUserConfig } from "vitest/config";
|
|
2
2
|
import { type TestProjectsOptions, testProjects } from "#adapters/testProjects.ts";
|
|
3
3
|
|
|
4
|
-
export function appTestConfig(conditions: string[] = [], options: TestProjectsOptions = {}) {
|
|
5
|
-
return
|
|
4
|
+
export function appTestConfig(conditions: string[] = [], options: TestProjectsOptions = {}): ViteUserConfig {
|
|
5
|
+
return {
|
|
6
6
|
resolve: { conditions: [...conditions, "module", "browser", "development|production"] },
|
|
7
7
|
ssr: { resolve: { conditions: [...conditions, "node", "development|production"] } },
|
|
8
8
|
test: { ...testProjects(options), server: { deps: { inline: [/^@shivaedev\//u] } } },
|
|
9
|
-
}
|
|
9
|
+
};
|
|
10
10
|
}
|
package/src/baseline/format.ts
CHANGED
|
@@ -33,12 +33,12 @@ export function linesOf(raw: string | undefined): ReadonlyArray<{ readonly line:
|
|
|
33
33
|
.filter((row) => row.text.trim() !== "");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export
|
|
36
|
+
export function decodeBaseline(raw: string | undefined): Decoded<readonly BaselineEntry[]> {
|
|
37
37
|
const issues: string[] = [];
|
|
38
38
|
const entries: BaselineEntry[] = [];
|
|
39
39
|
const seen = new Set<string>();
|
|
40
40
|
for (const { line, text } of linesOf(raw)) {
|
|
41
|
-
const decoded =
|
|
41
|
+
const decoded = decodeWith(BaselineLine, text);
|
|
42
42
|
if (decoded._tag === "Invalid") {
|
|
43
43
|
issues.push(...decoded.issues.map((issue) => `line ${line}: ${issue}`));
|
|
44
44
|
continue;
|
package/src/baseline/legacy.ts
CHANGED
|
@@ -19,8 +19,8 @@ export interface LegacyEntry extends BaselineEntry {
|
|
|
19
19
|
readonly measure?: number | undefined;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export
|
|
23
|
-
const decoded =
|
|
22
|
+
export function decodeLegacyBaseline(raw: string): Decoded<readonly LegacyEntry[]> {
|
|
23
|
+
const decoded = decodeWith(LegacySchema, raw);
|
|
24
24
|
if (decoded._tag === "Invalid") {
|
|
25
25
|
return decoded;
|
|
26
26
|
}
|
|
@@ -20,10 +20,10 @@ export const looseStagedEntries = Effect.fn("Baseline.looseStagedEntries")(funct
|
|
|
20
20
|
const entries: BaselineEntry[] = [];
|
|
21
21
|
for (const path of paths) {
|
|
22
22
|
const raw = yield* gitOrFail(root, ["show", `:./${path}`]);
|
|
23
|
-
const decoded = yield* validOrFail(path,
|
|
23
|
+
const decoded = yield* validOrFail(path, decodeBaseline(raw));
|
|
24
24
|
const tracked = head.code === 0 ? yield* gitOrFail(root, ["ls-tree", "HEAD", "--", path]) : "";
|
|
25
25
|
const previous = tracked === "" ? undefined : yield* gitOrFail(root, ["show", `HEAD:./${path}`]);
|
|
26
|
-
const before = yield* validOrFail(path,
|
|
26
|
+
const before = yield* validOrFail(path, decodeBaseline(previous));
|
|
27
27
|
const counts = new Map(before.map((entry) => [keyOf(entry.rule, entry.file), entry.count]));
|
|
28
28
|
entries.push(...decoded.filter((entry) => changed.files.has(entry.file) || counts.get(keyOf(entry.rule, entry.file)) !== entry.count));
|
|
29
29
|
}
|
package/src/baseline/merge.ts
CHANGED
|
@@ -25,7 +25,7 @@ export const mergeBaseline = Effect.fn("Baseline.mergeBaseline")(
|
|
|
25
25
|
const entries = yield* Effect.forEach([base, ours, theirs], (path) =>
|
|
26
26
|
Effect.gen(function* () {
|
|
27
27
|
const raw = yield* fs.readFileString(path);
|
|
28
|
-
return yield* validOrFail(path,
|
|
28
|
+
return yield* validOrFail(path, decodeBaseline(raw));
|
|
29
29
|
}),
|
|
30
30
|
);
|
|
31
31
|
yield* fs.writeFileString(ours, encodeBaseline(mergeEntries(entries[0] ?? [], entries[1] ?? [], entries[2] ?? [])));
|
|
@@ -15,7 +15,7 @@ const ownerOf = Effect.fn("Biome.ownerOf")(function* (inputs: Pick<RuleInputs, "
|
|
|
15
15
|
let directory = posix.dirname(path);
|
|
16
16
|
for (;;) {
|
|
17
17
|
const file = posix.join(directory, "package.json");
|
|
18
|
-
const manifest = yield*
|
|
18
|
+
const manifest = yield* readPackageManifest(inputs.readText, file);
|
|
19
19
|
if (manifest !== undefined || directory === ".") {
|
|
20
20
|
return { directory, manifest };
|
|
21
21
|
}
|
|
@@ -33,7 +33,7 @@ const brought = Effect.fn("Biome.brought")(function* (inputs: Pick<RuleInputs, "
|
|
|
33
33
|
if (!isApplication(owner.manifest)) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
-
const entryPoints = yield*
|
|
36
|
+
const entryPoints = yield* entryPointsOf(inputs, owner.directory, owner.manifest, new Map());
|
|
37
37
|
const development = isTestCode(path) || isTooling(owner.directory, path);
|
|
38
38
|
return provider(entryPoints, name, development, true) !== undefined;
|
|
39
39
|
});
|
package/src/cli/args.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseArgs } from "node:util";
|
|
2
1
|
import { Result } from "effect";
|
|
3
|
-
import {
|
|
2
|
+
import { commandLine } from "#adapters/commandLine.ts";
|
|
3
|
+
import { ACCEPTS, misplaced, type Values } from "#cli/misplaced.ts";
|
|
4
4
|
import { SUBCOMMANDS } from "#cli/subcommands.ts";
|
|
5
5
|
|
|
6
6
|
export type Command =
|
|
@@ -78,10 +78,7 @@ function commandFor(name: string, values: Values): Parsed {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export function parseCommand(args: readonly string[]): Parsed {
|
|
81
|
-
const result =
|
|
82
|
-
catch: (error) => (error instanceof Error ? error.message : String(error)),
|
|
83
|
-
try: () => parseArgs({ allowPositionals: true, args: [...args], options: OPTIONS, strict: true }),
|
|
84
|
-
});
|
|
81
|
+
const result = commandLine(args);
|
|
85
82
|
if (Result.isFailure(result)) {
|
|
86
83
|
return usage(result.failure);
|
|
87
84
|
}
|
|
@@ -29,9 +29,7 @@ export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
|
|
|
29
29
|
if (raw === undefined) {
|
|
30
30
|
return yield* new SetupFailure({ message: `no baseline at ${source} to migrate. Name it with --from <file>.` });
|
|
31
31
|
}
|
|
32
|
-
const legacy = source.endsWith(".jsonl")
|
|
33
|
-
? yield* validOrFail(source, yield* Effect.promise(() => decodeBaseline(raw)))
|
|
34
|
-
: yield* validOrFail(source, yield* Effect.promise(() => decodeLegacyBaseline(raw)));
|
|
32
|
+
const legacy = source.endsWith(".jsonl") ? yield* validOrFail(source, decodeBaseline(raw)) : yield* validOrFail(source, decodeLegacyBaseline(raw));
|
|
35
33
|
const entries = source.endsWith(".jsonl") ? legacy : convertLegacy(legacy, (yield* scan(config)).violations);
|
|
36
34
|
const fs = yield* FileSystem.FileSystem;
|
|
37
35
|
const written = Effect.andThen(saveShards(config, new Map(), entries), fs.remove(join(config.root, source)));
|
|
@@ -46,7 +46,7 @@ export const migrateExceptions = Effect.fnUntraced(function* (
|
|
|
46
46
|
if (from !== undefined && raw === undefined) {
|
|
47
47
|
return yield* new SetupFailure({ message: `${registryPath} does not exist. Pass an existing registry file with --from.` });
|
|
48
48
|
}
|
|
49
|
-
const registry = yield* validOrFail(registryPath,
|
|
49
|
+
const registry = yield* validOrFail(registryPath, decodeRegistry(raw));
|
|
50
50
|
const entries = merge([
|
|
51
51
|
...config.exceptions,
|
|
52
52
|
...registry.map(
|
|
@@ -59,7 +59,7 @@ export const migrateExceptions = Effect.fnUntraced(function* (
|
|
|
59
59
|
),
|
|
60
60
|
...config.biomeDeclarations.map(({ includes, reason, rule }): ExceptionDeclaration => ({ files: includes, reason, rules: [`biome/${rule}`] })),
|
|
61
61
|
]);
|
|
62
|
-
yield* validOrFail(config.file,
|
|
62
|
+
yield* validOrFail(config.file, decodeExceptions(entries));
|
|
63
63
|
const text = yield* readInput("", config.file);
|
|
64
64
|
const next = yield* Effect.try({
|
|
65
65
|
catch: (cause) => new SetupFailure({ cause, message: String(cause) }),
|
package/src/cli.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import process from "node:process";
|
|
3
|
+
import { runMain } from "#adapters/runMain.ts";
|
|
3
4
|
import { program } from "#cli/program.ts";
|
|
4
|
-
import { runMain } from "#cli/runMain.ts";
|
|
5
5
|
|
|
6
6
|
runMain(program(process.argv.slice(2), { cwd: process.cwd(), launch: { options: process.execArgv, script: process.argv[1] ?? "" } }));
|
package/src/config/decode.ts
CHANGED
|
@@ -38,6 +38,6 @@ const ConfigInput = Schema.Struct({
|
|
|
38
38
|
|
|
39
39
|
export type ConfigInput = typeof ConfigInput.Type;
|
|
40
40
|
|
|
41
|
-
export function decodeConfig(value: unknown):
|
|
41
|
+
export function decodeConfig(value: unknown): Decoded<ConfigInput> {
|
|
42
42
|
return decodeWith(ConfigInput, value);
|
|
43
43
|
}
|
package/src/config/load.ts
CHANGED
|
@@ -53,7 +53,7 @@ export const loadConfig = Effect.fn("Config.loadConfig")(function* (
|
|
|
53
53
|
const { dirname } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
54
54
|
|
|
55
55
|
const { file, loaded } = yield* readConfig(cwd, path);
|
|
56
|
-
const config = yield* validOrFail(file,
|
|
56
|
+
const config = yield* validOrFail(file, decodeConfig(loaded));
|
|
57
57
|
const rules = yield* validOrFail(file, yield* resolveRules(config));
|
|
58
58
|
return resolved(dirname(file), file, config, rules);
|
|
59
59
|
});
|
package/src/decoded.ts
CHANGED
|
@@ -4,13 +4,11 @@ import { SetupFailure } from "#failure.ts";
|
|
|
4
4
|
|
|
5
5
|
export type Decoded<TValue> = { readonly _tag: "Valid"; readonly value: TValue } | { readonly _tag: "Invalid"; readonly issues: readonly string[] };
|
|
6
6
|
|
|
7
|
-
export function decodeWith<TSchema extends Schema.ConstraintDecoder<unknown>>(schema: TSchema, value: unknown):
|
|
7
|
+
export function decodeWith<TSchema extends Schema.ConstraintDecoder<unknown>>(schema: TSchema, value: unknown): Decoded<TSchema["Type"]> {
|
|
8
8
|
const result = Schema.decodeUnknownResult(schema, { errors: "all", onExcessProperty: "error" })(value);
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
: { _tag: "Invalid", issues: SchemaIssue.makeFormatterStandardSchemaV1()(result.failure.issue).issues.map(describeIssue) },
|
|
13
|
-
);
|
|
9
|
+
return Result.isSuccess(result)
|
|
10
|
+
? { _tag: "Valid", value: result.success }
|
|
11
|
+
: { _tag: "Invalid", issues: SchemaIssue.makeFormatterStandardSchemaV1()(result.failure.issue).issues.map(describeIssue) };
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export function validOrFail<TValue>(file: string, decoded: Decoded<TValue>): Effect.Effect<TValue, SetupFailure> {
|
|
@@ -4,13 +4,14 @@ import { type DocumentedModule, documentedModule } from "#docs/documentedModule.
|
|
|
4
4
|
import { exportsName } from "#docs/exportsName.ts";
|
|
5
5
|
import { packageNameOf } from "#imports/packageName.ts";
|
|
6
6
|
import type { WorkspacePackage } from "#imports/workspace.ts";
|
|
7
|
-
import type {
|
|
7
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
8
|
+
import type { Finding, RuleInputs } from "#rule.ts";
|
|
8
9
|
|
|
9
10
|
export interface ImportContext {
|
|
10
11
|
readonly exports: ReadonlyMap<string, unknown>;
|
|
11
12
|
readonly owner: string | undefined;
|
|
12
13
|
readonly packages: ReadonlyMap<string, WorkspacePackage>;
|
|
13
|
-
readonly readText:
|
|
14
|
+
readonly readText: RuleInputs["readText"];
|
|
14
15
|
readonly root: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -25,7 +26,7 @@ function problem(
|
|
|
25
26
|
entry: DocumentedImport,
|
|
26
27
|
module: DocumentedModule,
|
|
27
28
|
owner: WorkspacePackage,
|
|
28
|
-
): Effect.Effect<string | undefined> {
|
|
29
|
+
): Effect.Effect<string | undefined, FilesystemFailure> {
|
|
29
30
|
if (module.kind === "missing") {
|
|
30
31
|
return Effect.succeed(`"${entry.specifier}" names no module of ${owner.name}. Use the path of a module its package.json "exports" maps.`);
|
|
31
32
|
}
|
|
@@ -38,7 +39,7 @@ function problem(
|
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
export function importFindings(context: ImportContext, file: string, markdown: string): Effect.Effect<readonly Finding[]> {
|
|
42
|
+
export function importFindings(context: ImportContext, file: string, markdown: string): Effect.Effect<readonly Finding[], FilesystemFailure> {
|
|
42
43
|
const entries = documentedImports(markdown, { owner: context.owner, packages: (name) => context.packages.has(name) });
|
|
43
44
|
const unique = [...new Map(entries.map((entry) => [`${entry.line} ${entry.specifier} ${entry.name ?? ""}`, entry])).values()];
|
|
44
45
|
return Effect.map(
|
package/src/docs/linkFindings.ts
CHANGED
|
@@ -4,10 +4,11 @@ import ts from "typescript";
|
|
|
4
4
|
import type { MarkdownLine } from "#docs/markdownLines.ts";
|
|
5
5
|
import { markdownLinks } from "#docs/markdownLinks.ts";
|
|
6
6
|
import { type Repository, repositoryLink } from "#docs/repositoryLink.ts";
|
|
7
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
7
8
|
import type { Finding } from "#rule.ts";
|
|
8
9
|
|
|
9
10
|
export interface LinkContext {
|
|
10
|
-
readonly anchors: (path: string) => Effect.Effect<ReadonlySet<string> | undefined>;
|
|
11
|
+
readonly anchors: (path: string) => Effect.Effect<ReadonlySet<string> | undefined, FilesystemFailure>;
|
|
11
12
|
readonly published: string | undefined;
|
|
12
13
|
readonly repository: Repository | undefined;
|
|
13
14
|
readonly root: string;
|
|
@@ -64,7 +65,7 @@ function placement(context: LinkContext, target: string, to: Destination): strin
|
|
|
64
65
|
return undefined;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
function problem(context: LinkContext, target: string, to: Destination): Effect.Effect<string | undefined> {
|
|
68
|
+
function problem(context: LinkContext, target: string, to: Destination): Effect.Effect<string | undefined, FilesystemFailure> {
|
|
68
69
|
const misplaced = placement(context, target, to);
|
|
69
70
|
const anchor = to.anchor;
|
|
70
71
|
if (misplaced !== undefined || anchor === undefined || anchor === "" || !to.path.endsWith(".md")) {
|
|
@@ -77,7 +78,11 @@ function problem(context: LinkContext, target: string, to: Destination): Effect.
|
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
export function linkFindings(
|
|
81
|
+
export function linkFindings(
|
|
82
|
+
context: LinkContext,
|
|
83
|
+
file: string,
|
|
84
|
+
lines: readonly MarkdownLine[],
|
|
85
|
+
): Effect.Effect<readonly Finding[], FilesystemFailure> {
|
|
81
86
|
return Effect.map(
|
|
82
87
|
Effect.forEach(markdownLinks(lines), (link) => {
|
|
83
88
|
const to = destination(file, link.target, context.repository);
|
|
@@ -26,7 +26,7 @@ export const readBaseline = Effect.fn("Engine.readBaseline")(function* (
|
|
|
26
26
|
if (raw === undefined) {
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
|
-
const entries = yield* validOrFail(path,
|
|
29
|
+
const entries = yield* validOrFail(path, decodeBaseline(raw));
|
|
30
30
|
for (const entry of entries) {
|
|
31
31
|
const expected = shardOf(entry.file, config.baseline);
|
|
32
32
|
if (expected !== path) {
|
package/src/engine/session.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
-
import { Effect, Path
|
|
2
|
+
import { Effect, Path } from "effect";
|
|
3
3
|
import { setManifestFiles } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
5
5
|
import { loadConfig, type ResolvedConfig } from "#config/load.ts";
|
|
@@ -30,7 +30,7 @@ function setup<TValue, TRequirements>(effect: Effect.Effect<TValue, Error, TRequ
|
|
|
30
30
|
|
|
31
31
|
export const scan = Effect.fn("Engine.scan")(function* (
|
|
32
32
|
config: ResolvedConfig,
|
|
33
|
-
): Effect.fn.Return<Pick<Session, "inventory" | "staleRegistry" | "violations">, SetupFailure, RuleServices
|
|
33
|
+
): Effect.fn.Return<Pick<Session, "inventory" | "staleRegistry" | "violations">, SetupFailure, RuleServices> {
|
|
34
34
|
const { relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
35
35
|
|
|
36
36
|
const inventory = yield* setup(collectInventory(config.root, config));
|
|
@@ -49,7 +49,7 @@ export const scan = Effect.fn("Engine.scan")(function* (
|
|
|
49
49
|
const violations = yield* runRules(config.active, inputs);
|
|
50
50
|
const staleRegistry = yield* setup(staleBiomeExceptions(inputs));
|
|
51
51
|
return { inventory, staleRegistry, violations };
|
|
52
|
-
}
|
|
52
|
+
});
|
|
53
53
|
|
|
54
54
|
export const openSession = Effect.fn("Engine.openSession")(function* (
|
|
55
55
|
cwd: string,
|
|
@@ -2,6 +2,7 @@ import { Effect } from "effect";
|
|
|
2
2
|
import { biomeReport } from "#biome/report.ts";
|
|
3
3
|
import { withoutEntryPointImports } from "#biome/withoutEntryPointImports.ts";
|
|
4
4
|
import type { StaleRegistryEntry } from "#exceptions/registry.ts";
|
|
5
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
5
6
|
import type { Finding, RuleInputs } from "#rule.ts";
|
|
6
7
|
|
|
7
8
|
export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")(function* (inputs: RuleInputs) {
|
|
@@ -9,7 +10,7 @@ export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")
|
|
|
9
10
|
const declared = declarations.flatMap(({ files, reason, rules }) =>
|
|
10
11
|
rules.filter((rule) => /^biome\/(?:lint|assist)\//u.test(rule)).flatMap((rule) => files.map((file) => ({ file, reason, rule }))),
|
|
11
12
|
);
|
|
12
|
-
const texts = yield* Effect.forEach(declared, ({ file }) =>
|
|
13
|
+
const texts = yield* Effect.forEach(declared, ({ file }) => inputs.readText(file), { concurrency: "unbounded" });
|
|
13
14
|
const entries = declared.filter((_, index) => texts[index] !== undefined);
|
|
14
15
|
if (entries.length === 0) {
|
|
15
16
|
return [];
|
|
@@ -29,8 +30,11 @@ export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")
|
|
|
29
30
|
);
|
|
30
31
|
});
|
|
31
32
|
|
|
32
|
-
const missingBiomeFile = Effect.fn("Exceptions.missingBiomeFile")(function* (
|
|
33
|
-
|
|
33
|
+
const missingBiomeFile = Effect.fn("Exceptions.missingBiomeFile")(function* (
|
|
34
|
+
inputs: RuleInputs,
|
|
35
|
+
file: string,
|
|
36
|
+
): Effect.fn.Return<readonly Finding[], FilesystemFailure> {
|
|
37
|
+
const text = yield* inputs.readText(file);
|
|
34
38
|
return text === undefined
|
|
35
39
|
? [{ file, message: `This Biome exception names a missing file. Remove it from exceptions in ${inputs.configFile ?? "quality.config.ts"}.` }]
|
|
36
40
|
: [];
|
|
@@ -33,6 +33,6 @@ export type ExceptionDeclaration = typeof ExceptionDeclaration.Type;
|
|
|
33
33
|
|
|
34
34
|
const ExceptionDeclarations = Schema.Array(ExceptionDeclaration);
|
|
35
35
|
|
|
36
|
-
export function decodeExceptions(value: unknown):
|
|
36
|
+
export function decodeExceptions(value: unknown): Decoded<readonly ExceptionDeclaration[]> {
|
|
37
37
|
return decodeWith(ExceptionDeclarations, value);
|
|
38
38
|
}
|
|
@@ -13,8 +13,8 @@ export type RegistryEntry = typeof RegistryEntry.Type;
|
|
|
13
13
|
|
|
14
14
|
const RegistryFile = Schema.fromJsonString(Schema.Array(RegistryEntry));
|
|
15
15
|
|
|
16
|
-
export function decodeRegistry(raw: string | undefined):
|
|
17
|
-
return raw === undefined ?
|
|
16
|
+
export function decodeRegistry(raw: string | undefined): Decoded<readonly RegistryEntry[]> {
|
|
17
|
+
return raw === undefined ? { _tag: "Valid", value: [] } : decodeWith(RegistryFile, raw);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface StaleRegistryEntry {
|
package/src/hooks/preCommit.ts
CHANGED
|
@@ -15,10 +15,10 @@ const commitScripts = Effect.fnUntraced(function* (root: string) {
|
|
|
15
15
|
|
|
16
16
|
const file = join(root, "package.json");
|
|
17
17
|
const readText = yield* manifestReader(root);
|
|
18
|
-
const manifest = yield* Effect.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const manifest = yield* Effect.mapError(
|
|
19
|
+
readPackageManifest(readText, file),
|
|
20
|
+
(cause) => new SetupFailure({ cause, message: `${file} is invalid: ${cause.message}` }),
|
|
21
|
+
);
|
|
22
22
|
if (manifest === undefined) {
|
|
23
23
|
return { manager: "npm", scripts: [] };
|
|
24
24
|
}
|
|
@@ -27,7 +27,7 @@ const commitScripts = Effect.fnUntraced(function* (root: string) {
|
|
|
27
27
|
return yield* new SetupFailure({ message: `${file}: unsupported packageManager "${manager}". Use npm, pnpm, yarn or bun.` });
|
|
28
28
|
}
|
|
29
29
|
return { manager, scripts: ["typecheck", "quality:commit"].filter((script) => manifest.scripts?.[script] !== undefined) };
|
|
30
|
-
}
|
|
30
|
+
});
|
|
31
31
|
|
|
32
32
|
const runScript = Effect.fnUntraced(
|
|
33
33
|
function* (root: string, manager: string, script: string) {
|
|
@@ -102,7 +102,7 @@ function superclassesOf(node: ts.HeritageClause): readonly ts.Expression[] {
|
|
|
102
102
|
return node.types.map((base) => base.expression);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
const globalsIn = Effect.fn("Imports.globalsIn")(function* (file: SourceFile, browser: ReadonlySet<string>) {
|
|
106
106
|
const parsed = parse(file);
|
|
107
107
|
if (parsed === undefined) {
|
|
108
108
|
return [];
|
|
@@ -123,7 +123,7 @@ export const browserGlobals = Effect.fn("Imports.browserGlobals")(function* (fil
|
|
|
123
123
|
}
|
|
124
124
|
const direct = globalName(node, checker);
|
|
125
125
|
const names = [...destructuredNames(node, checker), ...(direct === undefined ? [] : [direct])];
|
|
126
|
-
for (const name of names.filter((candidate) =>
|
|
126
|
+
for (const name of names.filter((candidate) => browser.has(candidate))) {
|
|
127
127
|
findings.push({
|
|
128
128
|
file: file.path,
|
|
129
129
|
line: source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1,
|
|
@@ -136,3 +136,9 @@ export const browserGlobals = Effect.fn("Imports.browserGlobals")(function* (fil
|
|
|
136
136
|
visit(source);
|
|
137
137
|
return findings;
|
|
138
138
|
}, Effect.provide(ImportCompiler.layer));
|
|
139
|
+
|
|
140
|
+
export const browserGlobals = Effect.fn("Imports.browserGlobals")(function* (files: readonly SourceFile[]) {
|
|
141
|
+
const browser = yield* browserNames();
|
|
142
|
+
const findings = yield* Effect.forEach(files, (file) => globalsIn(file, browser));
|
|
143
|
+
return findings.flat();
|
|
144
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
1
|
import { dirname, join } from "node:path";
|
|
2
|
+
import { Effect, type FileSystem } from "effect";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
+
import { type FilesystemFailure, readRequiredText } from "#inventory/filesystem.ts";
|
|
4
5
|
|
|
5
6
|
const portable = new Set([
|
|
6
7
|
"AbortController",
|
|
@@ -66,9 +67,8 @@ const portable = new Set([
|
|
|
66
67
|
"structuredClone",
|
|
67
68
|
]);
|
|
68
69
|
|
|
69
|
-
function namesInDom(): readonly string[] {
|
|
70
|
-
const
|
|
71
|
-
const source = ts.createSourceFile(path, readFileSync(path, "utf8"), ts.ScriptTarget.Latest, true);
|
|
70
|
+
function namesInDom(path: string, text: string): readonly string[] {
|
|
71
|
+
const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true);
|
|
72
72
|
return source.statements.flatMap((statement) => {
|
|
73
73
|
if (ts.isVariableStatement(statement)) {
|
|
74
74
|
return statement.declarationList.declarations.flatMap(({ name }) => (ts.isIdentifier(name) ? [name.text] : []));
|
|
@@ -77,4 +77,12 @@ function namesInDom(): readonly string[] {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export const browserNames
|
|
80
|
+
export const browserNames = Effect.fn("Imports.browserNames")(function* (): Effect.fn.Return<
|
|
81
|
+
ReadonlySet<string>,
|
|
82
|
+
FilesystemFailure,
|
|
83
|
+
FileSystem.FileSystem
|
|
84
|
+
> {
|
|
85
|
+
const path = join(dirname(ts.getDefaultLibFilePath({})), "lib.dom.d.ts");
|
|
86
|
+
const text = yield* readRequiredText(path);
|
|
87
|
+
return new Set(namesInDom(path, text).filter((name) => !portable.has(name)));
|
|
88
|
+
});
|
|
@@ -11,7 +11,7 @@ export interface Departure extends SpecifierSite {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const departures = Effect.fn("Imports.departures")(function* (inputs: RuleInputs) {
|
|
14
|
-
const packages = yield*
|
|
14
|
+
const packages = yield* workspacePackages(inputs);
|
|
15
15
|
const compiler = yield* ImportCompiler;
|
|
16
16
|
return yield* compiler.departures(inputs, packages);
|
|
17
17
|
}, Effect.provide(ImportCompiler.layer));
|
|
@@ -7,7 +7,7 @@ import type { RuleInputs } from "#rule.ts";
|
|
|
7
7
|
|
|
8
8
|
export const checkFences = Effect.fn("Imports.checkFences")(function* (inputs: RuleInputs, configured: readonly Fence[]) {
|
|
9
9
|
const graph = yield* importGraph(inputs);
|
|
10
|
-
const fences = [...configured, ...(yield*
|
|
10
|
+
const fences = [...configured, ...(yield* discoverFences(inputs, graph.packages))];
|
|
11
11
|
const policy = compilePolicy(fences, { files: inputs.files, packages: graph.packages });
|
|
12
12
|
return policy.flatMap((compiled) => compiled.evaluate(graph));
|
|
13
13
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { posix, resolve } from "node:path";
|
|
3
|
-
import {
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { contentHashedModule } from "#adapters/contentHashedModule.ts";
|
|
4
|
+
import { BoundaryFailure } from "#imports/fences/BoundaryFailure.ts";
|
|
4
5
|
import { decodeDeclarations } from "#imports/fences/declarations.ts";
|
|
5
6
|
import type { Fence } from "#imports/fences/model.ts";
|
|
6
7
|
import type { WorkspacePackage } from "#imports/workspace.ts";
|
|
@@ -8,30 +9,44 @@ import type { RuleInputs } from "#rule.ts";
|
|
|
8
9
|
|
|
9
10
|
const BOUNDARY_FILE = "quality.fences.config.ts";
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const text = await inputs.readText(file);
|
|
15
|
-
if (text === undefined) {
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
const url = pathToFileURL(resolve(inputs.root, file));
|
|
19
|
-
url.searchParams.set("content", createHash("sha256").update(text).digest("hex"));
|
|
20
|
-
const loaded: unknown = await import(url.href);
|
|
21
|
-
if (typeof loaded !== "object" || loaded === null || !("default" in loaded)) {
|
|
22
|
-
throw new Error("export an array of fence() declarations as the default export");
|
|
23
|
-
}
|
|
24
|
-
const decoded = await decodeDeclarations(loaded.default);
|
|
25
|
-
if (decoded._tag === "Invalid") {
|
|
26
|
-
throw new Error(`export an array of fence() declarations:\n${decoded.issues.join("\n")}`);
|
|
27
|
-
}
|
|
28
|
-
return decoded.value;
|
|
29
|
-
} catch (cause) {
|
|
30
|
-
throw new Error(`cannot load boundary at ${file}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
|
|
31
|
-
}
|
|
12
|
+
function messageOf(cause: unknown): string {
|
|
13
|
+
return cause instanceof Error ? cause.message : String(cause);
|
|
32
14
|
}
|
|
33
15
|
|
|
34
|
-
|
|
35
|
-
const
|
|
16
|
+
const boundaryAt = Effect.fn("Fences.boundaryAt")(function* (inputs: RuleInputs, file: string) {
|
|
17
|
+
const text = yield* inputs.readText(file);
|
|
18
|
+
if (text === undefined) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
const url = contentHashedModule(resolve(inputs.root, file), text);
|
|
22
|
+
const loaded: unknown = yield* Effect.tryPromise({
|
|
23
|
+
catch: (cause) => new BoundaryFailure({ cause, message: messageOf(cause) }),
|
|
24
|
+
try: () => import(url),
|
|
25
|
+
});
|
|
26
|
+
if (typeof loaded !== "object" || loaded === null || !("default" in loaded)) {
|
|
27
|
+
return yield* new BoundaryFailure({ message: "export an array of fence() declarations as the default export" });
|
|
28
|
+
}
|
|
29
|
+
const decoded = decodeDeclarations(loaded.default);
|
|
30
|
+
if (decoded._tag === "Invalid") {
|
|
31
|
+
return yield* new BoundaryFailure({ message: `export an array of fence() declarations:\n${decoded.issues.join("\n")}` });
|
|
32
|
+
}
|
|
33
|
+
return decoded.value;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const loadBoundary = Effect.fn("Fences.loadBoundary")(function* (
|
|
37
|
+
inputs: RuleInputs,
|
|
38
|
+
directory: string,
|
|
39
|
+
): Effect.fn.Return<readonly Fence[], BoundaryFailure> {
|
|
40
|
+
const file = posix.join(directory, BOUNDARY_FILE);
|
|
41
|
+
return yield* Effect.mapError(
|
|
42
|
+
boundaryAt(inputs, file),
|
|
43
|
+
(cause) => new BoundaryFailure({ cause, message: `cannot load boundary at ${file}: ${cause.message}` }),
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const discoverFences = Effect.fn("Fences.discoverFences")(function* (inputs: RuleInputs, packages: readonly WorkspacePackage[]) {
|
|
48
|
+
const boundaries = yield* Effect.forEach([".", ...packages.map((owner) => owner.directory)], (directory) => loadBoundary(inputs, directory), {
|
|
49
|
+
concurrency: "unbounded",
|
|
50
|
+
});
|
|
36
51
|
return boundaries.flat();
|
|
37
|
-
}
|
|
52
|
+
});
|