@shivaedev/quality 0.74.2 → 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 +26 -0
- package/README.md +17 -6
- 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/clientHandle.d.ts +3 -0
- package/dist/adapters/clientHandle.d.ts.map +1 -0
- package/dist/adapters/clientHandle.js +6 -0
- package/dist/adapters/clientHandle.js.map +1 -0
- 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/declarationTagParameter.d.ts +3 -0
- package/dist/adapters/declarationTagParameter.d.ts.map +1 -0
- package/dist/adapters/declarationTagParameter.js +125 -0
- package/dist/adapters/declarationTagParameter.js.map +1 -0
- package/dist/adapters/domEnvironment.config.d.ts.map +1 -0
- package/dist/adapters/domEnvironment.config.js.map +1 -0
- package/dist/adapters/frameworkCallback.d.ts +1 -0
- package/dist/adapters/frameworkCallback.d.ts.map +1 -1
- package/dist/adapters/frameworkCallback.js +1 -1
- package/dist/adapters/frameworkCallback.js.map +1 -1
- 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 +4 -1
- package/dist/adapters/outsideImportFindings.js.map +1 -1
- package/dist/adapters/plainFunction.d.ts +3 -0
- package/dist/adapters/plainFunction.d.ts.map +1 -0
- package/dist/adapters/plainFunction.js +19 -0
- package/dist/adapters/plainFunction.js.map +1 -0
- 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/serviceModelSyntax.d.ts +1 -0
- package/dist/adapters/serviceModelSyntax.d.ts.map +1 -1
- package/dist/adapters/serviceModelSyntax.js +1 -1
- package/dist/adapters/serviceModelSyntax.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/adapters/valueType.d.ts +3 -0
- package/dist/adapters/valueType.d.ts.map +1 -0
- package/dist/adapters/valueType.js +16 -0
- package/dist/adapters/valueType.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/adapterImports.js +1 -1
- package/dist/rules/effect/adapterImports.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/serviceCatalog.d.ts +1 -0
- package/dist/rules/effect/serviceCatalog.d.ts.map +1 -1
- package/dist/rules/effect/serviceFindings.d.ts.map +1 -1
- package/dist/rules/effect/serviceFindings.js +7 -1
- package/dist/rules/effect/serviceFindings.js.map +1 -1
- package/dist/rules/effect/serviceParameters.js +3 -3
- package/dist/rules/effect/serviceParameters.js.map +1 -1
- package/dist/rules/effect/serviceTypes.d.ts +1 -0
- package/dist/rules/effect/serviceTypes.d.ts.map +1 -1
- package/dist/rules/effect/serviceTypes.js +15 -19
- package/dist/rules/effect/serviceTypes.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 +5 -5
- 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/clientHandle.ts +11 -0
- package/src/adapters/commandLine.ts +10 -0
- package/src/adapters/contentHashedModule.ts +9 -0
- package/src/adapters/declarationTagParameter.ts +146 -0
- package/src/adapters/frameworkCallback.ts +1 -1
- 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 +8 -3
- package/src/adapters/plainFunction.ts +22 -0
- 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/serviceModelSyntax.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/adapters/valueType.ts +18 -0
- 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/adapterImports.ts +1 -1
- 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/serviceFindings.ts +7 -1
- package/src/rules/effect/serviceParameters.ts +3 -3
- package/src/rules/effect/serviceTypes.ts +15 -21
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
|
+
import { type ManifestReadFailure, readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import type { RuleInputs } from "#rule.ts";
|
|
5
5
|
|
|
6
6
|
export interface PackageLayout {
|
|
@@ -46,15 +46,15 @@ function runBy(directory: string, manifest: unknown): readonly string[] {
|
|
|
46
46
|
export const packageLayout = Effect.fn("Naming.packageLayout")(function* ({
|
|
47
47
|
files,
|
|
48
48
|
readText,
|
|
49
|
-
}: Pick<RuleInputs, "files" | "readText">): Effect.fn.Return<PackageLayout> {
|
|
49
|
+
}: Pick<RuleInputs, "files" | "readText">): Effect.fn.Return<PackageLayout, ManifestReadFailure> {
|
|
50
50
|
const directories = ["", ...files.filter((path) => posix.basename(path) === MANIFEST).map((path) => posix.dirname(path))];
|
|
51
51
|
const manifests = yield* Effect.forEach(
|
|
52
52
|
[...new Set(directories)],
|
|
53
53
|
(directory) =>
|
|
54
|
-
Effect.map(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
),
|
|
54
|
+
Effect.map(readPackageManifest(readText, directory === "" ? MANIFEST : `${directory}/${MANIFEST}`), (manifest) => ({
|
|
55
|
+
directory: directory === "." ? "" : directory,
|
|
56
|
+
manifest,
|
|
57
|
+
})),
|
|
58
58
|
{ concurrency: "unbounded" },
|
|
59
59
|
);
|
|
60
60
|
const present = manifests.filter((entry) => entry.manifest !== undefined);
|
|
@@ -5,8 +5,8 @@ import type { RuleInputs } from "#rule.ts";
|
|
|
5
5
|
|
|
6
6
|
export const packageTests = Effect.fn("Tests.packageTests")(function* (inputs: RuleInputs) {
|
|
7
7
|
const posix = yield* Path.Path.pipe(Effect.provide(Path.layer));
|
|
8
|
-
const packages = [...(yield*
|
|
9
|
-
if ((yield*
|
|
8
|
+
const packages = [...(yield* workspacePackages(inputs))];
|
|
9
|
+
if ((yield* readPackageManifest(inputs.readText, "package.json")) !== undefined) {
|
|
10
10
|
packages.push({ directory: ".", name: "." });
|
|
11
11
|
}
|
|
12
12
|
const withSource = new Set(
|
package/src/naming/testCode.ts
CHANGED
|
@@ -17,17 +17,14 @@ export const testCode = Effect.fn("Tests.testCode")(function* (inputs: RuleInput
|
|
|
17
17
|
return isTestCode(path) || trees.sourcePath(path) !== undefined;
|
|
18
18
|
}
|
|
19
19
|
const policies = yield* Effect.forEach(trees.packages, (owner) =>
|
|
20
|
-
Effect.map(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
scripts
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
),
|
|
29
|
-
}),
|
|
30
|
-
),
|
|
20
|
+
Effect.map(readPackageManifest(inputs.readText, posix.join(owner.directory, "package.json")), (manifest) => ({
|
|
21
|
+
owner,
|
|
22
|
+
private: manifest?.private === true && manifest.bin === undefined && owner.directory !== ".",
|
|
23
|
+
scripts: scriptPaths(
|
|
24
|
+
owner.directory,
|
|
25
|
+
Object.fromEntries(Object.entries(manifest?.scripts ?? {}).filter(([name]) => !/^test(?::|$)/u.test(name))),
|
|
26
|
+
),
|
|
27
|
+
})),
|
|
31
28
|
);
|
|
32
29
|
if (!(policies.some((policy) => policy.private) && inputs.sources.some((file) => /\.[cm]?[jt]sx?$/u.test(file.path)))) {
|
|
33
30
|
return testFile;
|
package/src/rule.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ChildProcessSpawner } from "effect/process";
|
|
|
3
3
|
import { configureWith, noOptions, type RuleCheckResult, ruleConfiguration } from "#adapters/rule.ts";
|
|
4
4
|
import type { StandardSchemaV1 } from "#adapters/standardSchema.ts";
|
|
5
5
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
6
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
6
7
|
|
|
7
8
|
export interface Finding {
|
|
8
9
|
readonly count?: number | undefined;
|
|
@@ -28,9 +29,8 @@ export interface RuleInputs {
|
|
|
28
29
|
readonly exceptions?: readonly ExceptionDeclaration[];
|
|
29
30
|
readonly files: readonly string[];
|
|
30
31
|
readonly nonEffectFolders?: readonly string[];
|
|
31
|
-
readonly readText: (path: string) =>
|
|
32
|
+
readonly readText: (path: string) => Effect.Effect<string | undefined, FilesystemFailure>;
|
|
32
33
|
readonly root: string;
|
|
33
|
-
readonly signal?: AbortSignal;
|
|
34
34
|
readonly sources: readonly SourceFile[];
|
|
35
35
|
}
|
|
36
36
|
|
package/src/rules/biome.ts
CHANGED
|
@@ -24,7 +24,7 @@ function findingOf(diagnostic: Diagnostic): Finding {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const presetFinding = Effect.fn("Biome.presetFinding")(function* (inputs: Pick<RuleInputs, "readText">) {
|
|
27
|
-
const { extendsPreset, path } = yield*
|
|
27
|
+
const { extendsPreset, path } = yield* rootConfig(inputs.readText);
|
|
28
28
|
return extendsPreset ? [] : [{ file: path, message: `Extend "${PRESET}" from the root Biome config.`, subject: "preset" }];
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -9,6 +9,7 @@ import { linkFindings } from "#docs/linkFindings.ts";
|
|
|
9
9
|
import { markdownLines } from "#docs/markdownLines.ts";
|
|
10
10
|
import { repositoryOf } from "#docs/repositoryLink.ts";
|
|
11
11
|
import { type WorkspacePackage, workspacePackages } from "#imports/workspace.ts";
|
|
12
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
12
13
|
import { defineRule, type Finding, type RuleInputs } from "#rule.ts";
|
|
13
14
|
|
|
14
15
|
function field(value: unknown, key: string): unknown {
|
|
@@ -21,11 +22,7 @@ function isLink(root: string, file: string): boolean {
|
|
|
21
22
|
return real(join(root, file)) !== join(real(root), file);
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
function
|
|
25
|
-
return (path) => Effect.promise(() => inputs.readText(path));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function anchorsReader(read: ReturnType<typeof reader>): (path: string) => Effect.Effect<ReadonlySet<string> | undefined> {
|
|
25
|
+
function anchorsReader(read: RuleInputs["readText"]): (path: string) => Effect.Effect<ReadonlySet<string> | undefined, FilesystemFailure> {
|
|
29
26
|
const known = new Map<string, ReadonlySet<string> | undefined>();
|
|
30
27
|
return (path) =>
|
|
31
28
|
known.has(path)
|
|
@@ -38,27 +35,23 @@ function anchorsReader(read: ReturnType<typeof reader>): (path: string) => Effec
|
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
const references = Effect.fn("Docs.references")(function* (inputs: RuleInputs) {
|
|
41
|
-
const
|
|
42
|
-
const packages: readonly WorkspacePackage[] = yield* Effect.promise(() => workspacePackages(inputs));
|
|
38
|
+
const packages: readonly WorkspacePackage[] = yield* workspacePackages(inputs);
|
|
43
39
|
const manifests = new Map(
|
|
44
40
|
yield* Effect.forEach(packages, (owner) =>
|
|
45
|
-
Effect.map(
|
|
46
|
-
Effect.promise(() => readPackageManifest(inputs.readText, posix.join(owner.directory, "package.json"))),
|
|
47
|
-
(manifest) => [owner.name, manifest] as const,
|
|
48
|
-
),
|
|
41
|
+
Effect.map(readPackageManifest(inputs.readText, posix.join(owner.directory, "package.json")), (manifest) => [owner.name, manifest] as const),
|
|
49
42
|
),
|
|
50
43
|
);
|
|
51
44
|
const shared = {
|
|
52
|
-
anchors: anchorsReader(
|
|
45
|
+
anchors: anchorsReader(inputs.readText),
|
|
53
46
|
exports: new Map([...manifests].map(([name, manifest]) => [name, field(manifest, "exports")])),
|
|
54
47
|
packages: new Map(packages.map((owner) => [owner.name, owner])),
|
|
55
|
-
readText:
|
|
56
|
-
repository: repositoryOf(yield*
|
|
48
|
+
readText: inputs.readText,
|
|
49
|
+
repository: repositoryOf(yield* readPackageManifest(inputs.readText, "package.json")),
|
|
57
50
|
root: inputs.root,
|
|
58
51
|
};
|
|
59
52
|
const documents = inputs.files.filter((file) => isDocument(file) && !isLink(inputs.root, file));
|
|
60
53
|
const findings = yield* Effect.forEach(documents, (file) =>
|
|
61
|
-
Effect.flatMap(
|
|
54
|
+
Effect.flatMap(inputs.readText(file), (text): Effect.Effect<readonly Finding[], FilesystemFailure> => {
|
|
62
55
|
if (text === undefined) {
|
|
63
56
|
return Effect.succeed([]);
|
|
64
57
|
}
|
|
@@ -37,10 +37,7 @@ function findingsIn(file: string, text: string): readonly Finding[] {
|
|
|
37
37
|
|
|
38
38
|
const unversionedInstalls = Effect.fn("Docs.unversionedInstalls")(function* (inputs: RuleInputs) {
|
|
39
39
|
const findings = yield* Effect.forEach(inputs.files.filter(isDocument), (file) =>
|
|
40
|
-
Effect.map(
|
|
41
|
-
Effect.promise(() => inputs.readText(file)),
|
|
42
|
-
(text) => (text === undefined ? [] : findingsIn(file, text)),
|
|
43
|
-
),
|
|
40
|
+
Effect.map(inputs.readText(file), (text) => (text === undefined ? [] : findingsIn(file, text))),
|
|
44
41
|
);
|
|
45
42
|
return findings.flat();
|
|
46
43
|
});
|
|
@@ -4,7 +4,7 @@ import { defineRule } from "#rule.ts";
|
|
|
4
4
|
export const adapterImports = defineRule({
|
|
5
5
|
check: outsideImportFindings,
|
|
6
6
|
description:
|
|
7
|
-
"Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, workspace modules, test-support/ kits, tool configs directly in a package's folder, Effect and @shivaedev packages, supported UI, routing and styling libraries in client/ folders, Vitest in tests and specs, and node:process in entry modules (cli/main/entry files, runMain callers and the import.meta.url === process.argv[1] guard) are accepted. Recharts is the stack's charting library, accepted in client/ folders; build charts with shadcn's Chart component (ChartContainer and friends) rather than raw recharts primitives where shadcn covers the case. Libraries that perform I/O or manage external state still need adapters/. Move integrations into adapters/ and expose Effect values. No config exceptions or inline suppressions; baseline existing debt.",
|
|
7
|
+
"Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, pure node:path calls (including node:path/posix and node:path/win32) anywhere, workspace modules, test-support/ kits, tool configs directly in a package's folder, Effect and @shivaedev packages, supported UI, routing and styling libraries in client/ folders, Vitest in tests and specs, and node:process in entry modules (cli/main/entry files, runMain callers and the import.meta.url === process.argv[1] guard) are accepted. Recharts is the stack's charting library, accepted in client/ folders; build charts with shadcn's Chart component (ChartContainer and friends) rather than raw recharts primitives where shadcn covers the case. Libraries that perform I/O or manage external state, and file-system and process builtins, still need adapters/. Move integrations into adapters/ and expose Effect values. No config exceptions or inline suppressions; baseline existing debt.",
|
|
8
8
|
id: "effect/adapter-imports",
|
|
9
9
|
registrable: false,
|
|
10
10
|
});
|
|
@@ -80,26 +80,23 @@ function checkBoundary(inputs: RuleInputs): readonly Finding[] {
|
|
|
80
80
|
|
|
81
81
|
export const effectBoundary = defineRule({
|
|
82
82
|
check: (inputs) =>
|
|
83
|
-
Effect.map(
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
const group = /^(?:packages|examples)\/[^/]+/u.exec(source.path)?.[0] ?? ".";
|
|
96
|
-
const sources = groups.get(group) ?? [];
|
|
97
|
-
sources.push(source);
|
|
98
|
-
groups.set(group, sources);
|
|
83
|
+
Effect.map(workspacePackages(inputs), (packages) => {
|
|
84
|
+
const groups = new Map<string, RuleInputs["sources"][number][]>();
|
|
85
|
+
for (const source of inputs.sources) {
|
|
86
|
+
if (
|
|
87
|
+
/(?:^|\/)(?:adapters|test-support)\//u.test(source.path)
|
|
88
|
+
|| !/\.[cm]?[jt]sx?$/u.test(source.path)
|
|
89
|
+
|| isPackageRootConfig(packageOf(packages, source.path)?.directory ?? ".", source.path)
|
|
90
|
+
) {
|
|
91
|
+
continue;
|
|
99
92
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
const group = /^(?:packages|examples)\/[^/]+/u.exec(source.path)?.[0] ?? ".";
|
|
94
|
+
const sources = groups.get(group) ?? [];
|
|
95
|
+
sources.push(source);
|
|
96
|
+
groups.set(group, sources);
|
|
97
|
+
}
|
|
98
|
+
return [...groups.values()].flatMap((sources) => checkBoundary({ ...inputs, sources }));
|
|
99
|
+
}),
|
|
103
100
|
description:
|
|
104
101
|
"Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Within Effect code, adapters/ and test-support/ folders and tool configs directly in a package's folder, which their tool loads from that fixed path, are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
|
|
105
102
|
id: "effect/boundary",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { effectName, type FailureOperation, failureOperations, fileSystemCall } from "#rules/effect/failureOperations.ts";
|
|
3
|
-
import { successRecovery } from "#rules/effect/successRecovery.ts";
|
|
3
|
+
import { successRecovery, translatesFailure } from "#rules/effect/successRecovery.ts";
|
|
4
4
|
|
|
5
5
|
interface FailureFinding {
|
|
6
6
|
readonly message: string;
|
|
@@ -30,7 +30,11 @@ function operationFailure(checker: ts.TypeChecker, operation: FailureOperation,
|
|
|
30
30
|
return undefined;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
function storyReadout(checker: ts.TypeChecker, name: string | undefined, handler: ts.Node, testSupport: boolean): boolean {
|
|
34
|
+
return testSupport && (name === "catch" || name === "catchAll") && translatesFailure(checker, handler);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function failureFindings(checker: ts.TypeChecker, node: ts.CallExpression, testSupport: boolean): readonly FailureFinding[] {
|
|
34
38
|
const findings: FailureFinding[] = [];
|
|
35
39
|
const name = effectName(checker, node.expression);
|
|
36
40
|
if (name === "retry" && unboundedRetry(node)) {
|
|
@@ -41,7 +45,12 @@ export function failureFindings(checker: ts.TypeChecker, node: ts.CallExpression
|
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
const handler = node.arguments.at(-1);
|
|
44
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
["catch", "catchAll", "catchCause", "catchAllCause"].includes(name ?? "")
|
|
50
|
+
&& handler !== undefined
|
|
51
|
+
&& successRecovery(checker, handler)
|
|
52
|
+
&& !storyReadout(checker, name, handler, testSupport)
|
|
53
|
+
) {
|
|
45
54
|
findings.push({
|
|
46
55
|
message:
|
|
47
56
|
"Catch turns every failure into success. Catch a named reason with catchTag or catchIf and re-fail the rest, or model an explicit unavailable state.",
|
|
@@ -9,6 +9,7 @@ function checkFailures(inputs: RuleInputs): readonly Finding[] {
|
|
|
9
9
|
const checker = program.getTypeChecker();
|
|
10
10
|
return inputs.sources.flatMap((file) => {
|
|
11
11
|
const source = program.getSourceFile(join(inputs.root, file.path));
|
|
12
|
+
const testSupport = /(?:^|\/)test-support\//u.test(file.path);
|
|
12
13
|
const findings: Finding[] = [];
|
|
13
14
|
const reported = new Set<string>();
|
|
14
15
|
function report(node: ts.Node, message: string): void {
|
|
@@ -20,7 +21,7 @@ function checkFailures(inputs: RuleInputs): readonly Finding[] {
|
|
|
20
21
|
}
|
|
21
22
|
function visit(node: ts.Node): void {
|
|
22
23
|
if (ts.isCallExpression(node)) {
|
|
23
|
-
for (const finding of failureFindings(checker, node)) {
|
|
24
|
+
for (const finding of failureFindings(checker, node, testSupport)) {
|
|
24
25
|
report(finding.node, finding.message);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -53,7 +54,7 @@ export const failureHonesty = defineRule({
|
|
|
53
54
|
return [...groups.values()].flatMap((sources) => checkFailures({ ...inputs, sources }));
|
|
54
55
|
},
|
|
55
56
|
description:
|
|
56
|
-
"Keep failures typed and observable: no forked forever/orDie loops, retry({ while }) without times or a pacing Schedule, blanket catch-to-success, or FileSystem option/orElseSucceed. Catch a named reason, use a Schedule that paces retries or model an explicit unavailable state. No config exceptions or inline suppressions; baseline existing debt.",
|
|
57
|
+
"Keep failures typed and observable: no forked forever/orDie loops, retry({ while }) without times or a pacing Schedule, blanket catch-to-success, or FileSystem option/orElseSucceed. Catch a named reason, use a Schedule that paces retries or model an explicit unavailable state. In test-support/, a blanket catch whose handler derives its value from the caught error is a readout translation and is accepted. No config exceptions or inline suppressions; baseline existing debt.",
|
|
57
58
|
id: "effect/failure-honesty",
|
|
58
59
|
registrable: false,
|
|
59
60
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
+
import { declarationTagParameter } from "#adapters/declarationTagParameter.ts";
|
|
3
4
|
import { foreignResources } from "#adapters/foreignResources.ts";
|
|
4
5
|
import { frameworkCallback, parameterSite } from "#adapters/frameworkCallback.ts";
|
|
5
6
|
import { localFunctions } from "#adapters/localFunctions.ts";
|
|
6
7
|
import { ownedServiceParameters } from "#adapters/ownedServiceParameters.ts";
|
|
8
|
+
import { plainFunction } from "#adapters/plainFunction.ts";
|
|
7
9
|
import { reactComponent, reactPropParameters } from "#adapters/reactComponent.ts";
|
|
8
10
|
import type { Finding } from "#rule.ts";
|
|
9
11
|
import { layerConstructor } from "#rules/effect/layerConstructor.ts";
|
|
@@ -33,12 +35,14 @@ export function serviceFindings(
|
|
|
33
35
|
const resource = foreignResources(checker, sources);
|
|
34
36
|
const owned = ownedServiceParameters(checker, sources);
|
|
35
37
|
const props = reactPropParameters(checker, sources);
|
|
38
|
+
const declarationTag = declarationTagParameter(checker, services.carries);
|
|
36
39
|
const findings = new Map<ts.ParameterDeclaration, Finding>();
|
|
37
40
|
const visited = new Set<ts.Type>();
|
|
38
41
|
const activeSignatures = new Set<NonNullable<ts.Signature["declaration"]>>();
|
|
39
42
|
const local = new Set(sources);
|
|
40
43
|
function parameterFinding(symbol: ts.Symbol, signature?: ts.Signature): void {
|
|
41
|
-
|
|
44
|
+
const type = checker.getTypeOfSymbol(symbol);
|
|
45
|
+
if (!services.carries(type)) {
|
|
42
46
|
return;
|
|
43
47
|
}
|
|
44
48
|
for (const parameter of symbol.declarations ?? []) {
|
|
@@ -47,6 +51,8 @@ export function serviceFindings(
|
|
|
47
51
|
|| implementationParameter(checker, parameter, services)
|
|
48
52
|
|| resource(parameter)
|
|
49
53
|
|| owned(parameter)
|
|
54
|
+
|| (plainFunction(checker, parameter.parent) && !services.carriesBeyondClientHandles(type))
|
|
55
|
+
|| declarationTag(parameter)
|
|
50
56
|
|| frameworkCallback(checker, parameter.parent, local)
|
|
51
57
|
|| reactComponent(checker, parameter.parent)
|
|
52
58
|
|| props.has(parameter)
|
|
@@ -9,8 +9,8 @@ import { serviceFindings } from "#rules/effect/serviceFindings.ts";
|
|
|
9
9
|
|
|
10
10
|
export const serviceParameters = defineRule({
|
|
11
11
|
check: Effect.fn("Services.check")(function* (inputs: RuleInputs) {
|
|
12
|
-
const packages = yield*
|
|
13
|
-
const root = yield*
|
|
12
|
+
const packages = yield* workspacePackages(inputs);
|
|
13
|
+
const root = yield* readPackageManifest(inputs.readText, "package.json");
|
|
14
14
|
const names = [...packages.map((owner) => owner.name), ...(root?.name === undefined ? [] : [root.name])];
|
|
15
15
|
const groups = new Map<string, RuleInputs["sources"][number][]>();
|
|
16
16
|
for (const source of inputs.sources) {
|
|
@@ -37,7 +37,7 @@ export const serviceParameters = defineRule({
|
|
|
37
37
|
return findings;
|
|
38
38
|
}),
|
|
39
39
|
description:
|
|
40
|
-
"Exported and local functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods, framework callbacks, module-level React components and their props, owned initializer state, foreign host callbacks in object literals and classes, owned foreign adapter resources
|
|
40
|
+
"Exported and local functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods, framework callbacks, module-level React components and their props, owned initializer state, foreign host callbacks in object literals and classes, owned foreign adapter resources, Layer constructors, registries and RPC clients held by plain functions outside Effect bodies, and tags only handed to middleware declarations or Context.pick are accepted. Within Effect code, test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
|
|
41
41
|
id: "effect/service-parameters",
|
|
42
42
|
registrable: false,
|
|
43
43
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { browserLibraryType } from "#adapters/browserLibraryType.ts";
|
|
3
2
|
import { callerContextData } from "#adapters/callerContextData.ts";
|
|
3
|
+
import { clientHandle } from "#adapters/clientHandle.ts";
|
|
4
4
|
import { nonEmptyContext } from "#adapters/nonEmptyContext.ts";
|
|
5
|
+
import { valueType } from "#adapters/valueType.ts";
|
|
5
6
|
|
|
6
7
|
const SERVICE = "~effect/Context/Service";
|
|
7
8
|
const CONTEXT = "~effect/Context";
|
|
@@ -86,26 +87,16 @@ export function serviceTypes(checker: ts.TypeChecker, initializerState = false)
|
|
|
86
87
|
function factoryService(type: ts.Type): boolean {
|
|
87
88
|
return !initializerState && type.getCallSignatures().some((signature) => serviceReturn(signature.getReturnType()));
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|| type.flags
|
|
95
|
-
& (ts.TypeFlags.Any
|
|
96
|
-
| ts.TypeFlags.Unknown
|
|
97
|
-
| ts.TypeFlags.Never
|
|
98
|
-
| ts.TypeFlags.StringLike
|
|
99
|
-
| ts.TypeFlags.NumberLike
|
|
100
|
-
| ts.TypeFlags.BooleanLike
|
|
101
|
-
| ts.TypeFlags.ESSymbolLike
|
|
102
|
-
| ts.TypeFlags.BigIntLike)
|
|
103
|
-
) {
|
|
90
|
+
function exempt(type: ts.Type, handles: boolean): boolean {
|
|
91
|
+
return contextData.has(type) || valueType(type) || (!handles && clientHandle(type));
|
|
92
|
+
}
|
|
93
|
+
function carries(type: ts.Type, handles: boolean, seen = new Set<ts.Type>()): boolean {
|
|
94
|
+
if (seen.has(type) || exempt(type, handles)) {
|
|
104
95
|
return false;
|
|
105
96
|
}
|
|
106
97
|
seen.add(type);
|
|
107
98
|
if (type.isUnionOrIntersection()) {
|
|
108
|
-
return type.types.some((part) => carries(part, seen));
|
|
99
|
+
return type.types.some((part) => carries(part, handles, seen));
|
|
109
100
|
}
|
|
110
101
|
if (type.getProperty(SERVICE) !== undefined) {
|
|
111
102
|
return true;
|
|
@@ -118,14 +109,16 @@ export function serviceTypes(checker: ts.TypeChecker, initializerState = false)
|
|
|
118
109
|
return false;
|
|
119
110
|
}
|
|
120
111
|
const constraint = checker.getBaseConstraintOfType(type);
|
|
121
|
-
if (constraint !== undefined && carries(constraint, seen)) {
|
|
112
|
+
if (constraint !== undefined && carries(constraint, handles, seen)) {
|
|
122
113
|
return true;
|
|
123
114
|
}
|
|
124
115
|
return (
|
|
125
116
|
implementation(type)
|
|
126
117
|
|| factoryService(type)
|
|
127
|
-
|| checker.getIndexInfosOfType(type).some((index) => carries(index.type, seen))
|
|
128
|
-
|| type
|
|
118
|
+
|| checker.getIndexInfosOfType(type).some((index) => carries(index.type, handles, seen))
|
|
119
|
+
|| type
|
|
120
|
+
.getProperties()
|
|
121
|
+
.some((property) => !(property.flags & ts.SymbolFlags.Method) && carries(checker.getTypeOfSymbol(property), handles, seen))
|
|
129
122
|
);
|
|
130
123
|
}
|
|
131
124
|
return {
|
|
@@ -134,10 +127,11 @@ export function serviceTypes(checker: ts.TypeChecker, initializerState = false)
|
|
|
134
127
|
if (known !== undefined) {
|
|
135
128
|
return known;
|
|
136
129
|
}
|
|
137
|
-
const result = carries(type);
|
|
130
|
+
const result = carries(type, true);
|
|
138
131
|
carried.set(type, result);
|
|
139
132
|
return result;
|
|
140
133
|
},
|
|
134
|
+
carriesBeyondClientHandles: (type: ts.Type) => carries(type, false),
|
|
141
135
|
computation,
|
|
142
136
|
implementation,
|
|
143
137
|
remember,
|
|
@@ -42,3 +42,29 @@ export function successRecovery(checker: ts.TypeChecker, handler: ts.Node, seen
|
|
|
42
42
|
return ts.isFunctionDeclaration(declaration) && successRecovery(checker, declaration, seen);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
function mentions(checker: ts.TypeChecker, node: ts.Node, symbol: ts.Symbol): boolean {
|
|
47
|
+
if (ts.isIdentifier(node) && checker.getSymbolAtLocation(node) === symbol) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return ts.forEachChild(node, (child) => mentions(checker, child, symbol) || undefined) ?? false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function derivesFrom(checker: ts.TypeChecker, value: ts.Node, error: ts.Symbol): boolean {
|
|
54
|
+
if (ts.isParenthesizedExpression(value)) {
|
|
55
|
+
return derivesFrom(checker, value.expression, error);
|
|
56
|
+
}
|
|
57
|
+
if (ts.isConditionalExpression(value)) {
|
|
58
|
+
return derivesFrom(checker, value.whenTrue, error) && derivesFrom(checker, value.whenFalse, error);
|
|
59
|
+
}
|
|
60
|
+
return ts.isCallExpression(value) && value.arguments.some((argument) => mentions(checker, argument, error));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function translatesFailure(checker: ts.TypeChecker, handler: ts.Node): boolean {
|
|
64
|
+
if (!(ts.isArrowFunction(handler) || ts.isFunctionExpression(handler))) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
const name = handler.parameters[0]?.name;
|
|
68
|
+
const error = name !== undefined && ts.isIdentifier(name) ? checker.getSymbolAtLocation(name) : undefined;
|
|
69
|
+
return error !== undefined && returnValues(handler).every((value) => value !== undefined && derivesFrom(checker, value, error));
|
|
70
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
|
+
import { type ManifestReadFailure, readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import type { RuleInputs } from "#rule.ts";
|
|
5
5
|
|
|
6
6
|
export type PackageImports = (importer: string, specifier: string) => string | undefined;
|
|
@@ -42,15 +42,12 @@ function matched(imports: unknown, specifier: string): readonly string[] {
|
|
|
42
42
|
export const packageImports = Effect.fn("Files.packageImports")(function* ({
|
|
43
43
|
files,
|
|
44
44
|
readText,
|
|
45
|
-
}: Pick<RuleInputs, "files" | "readText">): Effect.fn.Return<PackageImports> {
|
|
45
|
+
}: Pick<RuleInputs, "files" | "readText">): Effect.fn.Return<PackageImports, ManifestReadFailure> {
|
|
46
46
|
const directories = files.filter((path) => posix.basename(path) === MANIFEST).map((path) => posix.dirname(path));
|
|
47
47
|
const manifests = yield* Effect.forEach(
|
|
48
48
|
directories,
|
|
49
49
|
(directory) =>
|
|
50
|
-
Effect.map(
|
|
51
|
-
Effect.promise(() => readPackageManifest(readText, posix.join(directory, MANIFEST))),
|
|
52
|
-
(manifest) => ({ directory, imports: manifest?.imports }),
|
|
53
|
-
),
|
|
50
|
+
Effect.map(readPackageManifest(readText, posix.join(directory, MANIFEST)), (manifest) => ({ directory, imports: manifest?.imports })),
|
|
54
51
|
{ concurrency: "unbounded" },
|
|
55
52
|
);
|
|
56
53
|
const deepestFirst = manifests.toSorted((left, right) => right.directory.length - left.directory.length);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import ts from "typescript";
|
|
4
|
+
import type { ManifestReadFailure } from "#adapters/manifestInventory.ts";
|
|
4
5
|
import type { RuleInputs, SourceFile } from "#rule.ts";
|
|
5
6
|
import { type PackageImports, packageImports } from "#rules/files/packageImports.ts";
|
|
6
7
|
import { parse } from "#rules/parse.ts";
|
|
@@ -44,16 +45,12 @@ function resolver(aliases: PackageImports, present: ReadonlySet<string>, fromSty
|
|
|
44
45
|
|
|
45
46
|
export const stylesheetImporters = Effect.fn("Files.stylesheetImporters")(function* (
|
|
46
47
|
inputs: Pick<RuleInputs, "files" | "readText" | "sources">,
|
|
47
|
-
): Effect.fn.Return<ReadonlyMap<string, readonly string[]
|
|
48
|
+
): Effect.fn.Return<ReadonlyMap<string, readonly string[]>, ManifestReadFailure> {
|
|
48
49
|
const present = new Set(inputs.files);
|
|
49
50
|
const aliases = yield* packageImports(inputs);
|
|
50
51
|
const stylesheets = yield* Effect.forEach(
|
|
51
52
|
inputs.files.filter((path) => STYLESHEET.test(path)),
|
|
52
|
-
(path) =>
|
|
53
|
-
Effect.map(
|
|
54
|
-
Effect.promise(() => inputs.readText(path)),
|
|
55
|
-
(text) => ({ path, text: text ?? "" }),
|
|
56
|
-
),
|
|
53
|
+
(path) => Effect.map(inputs.readText(path), (text) => ({ path, text: text ?? "" })),
|
|
57
54
|
{ concurrency: "unbounded" },
|
|
58
55
|
);
|
|
59
56
|
const fromModule = resolver(aliases, present, false);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import {
|
|
3
|
+
import { builtinName } from "#adapters/builtinName.ts";
|
|
4
|
+
import { type ManifestReadFailure, readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
5
|
import { type ImportGraph, importGraph } from "#imports/graph.ts";
|
|
5
6
|
import { isTooling } from "#imports/isTooling.ts";
|
|
6
|
-
import { builtinName } from "#imports/packageName.ts";
|
|
7
7
|
import { packageOf, type WorkspacePackage } from "#imports/workspace.ts";
|
|
8
8
|
import { dependencyNames, type EntryPoint, entryPointsOf, isApplication, provider, SHIPPED_FIELDS } from "#manifests/entryPoints.ts";
|
|
9
9
|
import { developmentCode } from "#naming/developmentCode.ts";
|
|
@@ -40,9 +40,9 @@ const manifestDependencies = Effect.fn("Imports.manifestDependencies")(function*
|
|
|
40
40
|
graph: ImportGraph,
|
|
41
41
|
workspace: ReadonlyMap<string, string>,
|
|
42
42
|
isTestCode: (path: string) => boolean,
|
|
43
|
-
): Effect.fn.Return<ManifestDependencies> {
|
|
43
|
+
): Effect.fn.Return<ManifestDependencies, ManifestReadFailure> {
|
|
44
44
|
const path = posix.join(owner.directory, "package.json");
|
|
45
|
-
const manifest = yield*
|
|
45
|
+
const manifest = yield* readPackageManifest(inputs.readText, path);
|
|
46
46
|
if (manifest === undefined) {
|
|
47
47
|
return yield* Effect.die(new Error("the manifest is missing"));
|
|
48
48
|
}
|
|
@@ -50,7 +50,7 @@ const manifestDependencies = Effect.fn("Imports.manifestDependencies")(function*
|
|
|
50
50
|
...bundleInputs(graph, owner, manifest, (candidate) => developmentFile(owner, candidate, isTestCode)),
|
|
51
51
|
application: isApplication(manifest),
|
|
52
52
|
development: new Set(dependencyNames(manifest, "devDependencies")),
|
|
53
|
-
entryPoints: yield*
|
|
53
|
+
entryPoints: yield* entryPointsOf(inputs, owner.directory, manifest, workspace),
|
|
54
54
|
private: Reflect.get(manifest, "private") === true,
|
|
55
55
|
shipped: new Set(SHIPPED_FIELDS.flatMap((field) => dependencyNames(manifest, field))),
|
|
56
56
|
};
|
|
@@ -102,7 +102,7 @@ export const importsManifest = defineRule({
|
|
|
102
102
|
return testFile(path) || tooling(path);
|
|
103
103
|
}
|
|
104
104
|
const root: WorkspacePackage | undefined =
|
|
105
|
-
(yield*
|
|
105
|
+
(yield* readPackageManifest(inputs.readText, "package.json")) === undefined ? undefined : { directory: ".", name: "." };
|
|
106
106
|
const owners = [...graph.packages, ...(root === undefined ? [] : [root])];
|
|
107
107
|
const workspace = new Map(graph.packages.map((owner) => [owner.name, owner.directory]));
|
|
108
108
|
const policies = new Map(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
+
import { builtinName } from "#adapters/builtinName.ts";
|
|
2
3
|
import { type ImportGraph, importGraph } from "#imports/graph.ts";
|
|
3
4
|
import { nodePlatformBarrels } from "#imports/nodePlatformBarrels.ts";
|
|
4
|
-
import { builtinName } from "#imports/packageName.ts";
|
|
5
5
|
import { type Runtime, runtimeDeclarationProblems, runtimeOf } from "#imports/runtime.ts";
|
|
6
6
|
import { isTestCode } from "#naming/testName.ts";
|
|
7
7
|
import { defineRule } from "#rule.ts";
|
|
@@ -52,8 +52,7 @@ export const importsRuntime = defineRule({
|
|
|
52
52
|
return [...imports, ...declarations];
|
|
53
53
|
}
|
|
54
54
|
const { browserGlobals } = yield* Effect.promise(() => import("#imports/browserGlobals.ts"));
|
|
55
|
-
|
|
56
|
-
return [...imports, ...declarations, ...globals.flat()];
|
|
55
|
+
return [...imports, ...declarations, ...(yield* browserGlobals(shared))];
|
|
57
56
|
}),
|
|
58
57
|
description:
|
|
59
58
|
"Runtime folders define client, server and shared code. A manifest's quality.runtime declares a single-runtime package whole; executable packages without runtime folders and package-root tooling are server code. Production imports use @effect/platform-node module subpaths so its barrel does not load optional integrations.",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { dirname, posix, relative, resolve, sep } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
|
+
import { type ManifestReadFailure, readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { pnpmWorkspaceList } from "#imports/pnpmWorkspacePatterns.ts";
|
|
5
5
|
import { workspacePackages } from "#imports/workspace.ts";
|
|
6
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
6
7
|
import { DEPENDENCY_FIELDS, dependencyNames, entryPointsOf, isApplication, PLATFORM } from "#manifests/entryPoints.ts";
|
|
7
8
|
import { defineRule, type Finding, type RuleInputs } from "#rule.ts";
|
|
8
9
|
|
|
@@ -28,7 +29,7 @@ function ancestors(root: string, directory: string): readonly string[] {
|
|
|
28
29
|
const nearestWorkspace = Effect.fn("Manifests.nearestWorkspace")(function* (inputs: Pick<RuleInputs, "readText" | "root">, directory: string) {
|
|
29
30
|
for (const candidate of ancestors(inputs.root, directory)) {
|
|
30
31
|
const path = posix.join(relative(inputs.root, candidate).split(sep).join("/") || ".", "pnpm-workspace.yaml");
|
|
31
|
-
const text = yield*
|
|
32
|
+
const text = yield* inputs.readText(path);
|
|
32
33
|
if (text !== undefined) {
|
|
33
34
|
return { path, text };
|
|
34
35
|
}
|
|
@@ -40,7 +41,7 @@ const hoistFindings = Effect.fn("Manifests.hoistFindings")(function* (
|
|
|
40
41
|
inputs: Pick<RuleInputs, "readText" | "root">,
|
|
41
42
|
manifestPath: string,
|
|
42
43
|
directory: string,
|
|
43
|
-
): Effect.fn.Return<readonly Finding[]> {
|
|
44
|
+
): Effect.fn.Return<readonly Finding[], FilesystemFailure> {
|
|
44
45
|
const workspace = yield* nearestWorkspace(inputs, directory);
|
|
45
46
|
const target = workspace?.path ?? posix.join(directory, "pnpm-workspace.yaml");
|
|
46
47
|
const repair = `Add \`${HOIST_LINE}\` to ${target} so the pieces platform brings resolve by their own names.`;
|
|
@@ -69,10 +70,8 @@ const duplicateFindings = Effect.fn("Manifests.duplicateFindings")(function* (
|
|
|
69
70
|
directory: string,
|
|
70
71
|
manifest: unknown,
|
|
71
72
|
workspace: ReadonlyMap<string, string>,
|
|
72
|
-
): Effect.fn.Return<readonly Finding[]> {
|
|
73
|
-
const entryPoints = (yield*
|
|
74
|
-
(entry) => entry.declared !== undefined,
|
|
75
|
-
);
|
|
73
|
+
): Effect.fn.Return<readonly Finding[], ManifestReadFailure> {
|
|
74
|
+
const entryPoints = (yield* entryPointsOf(inputs, directory, manifest, workspace)).filter((entry) => entry.declared !== undefined);
|
|
76
75
|
return DEPENDENCY_FIELDS.flatMap((field) =>
|
|
77
76
|
dependencyNames(manifest, field).flatMap((name) => {
|
|
78
77
|
const entry = entryPoints.find((candidate) => candidate.provides.has(name));
|
|
@@ -92,7 +91,7 @@ const duplicateFindings = Effect.fn("Manifests.duplicateFindings")(function* (
|
|
|
92
91
|
export const manifestsApplication = defineRule({
|
|
93
92
|
check: (inputs) =>
|
|
94
93
|
Effect.gen(function* () {
|
|
95
|
-
const packages = yield*
|
|
94
|
+
const packages = yield* workspacePackages(inputs);
|
|
96
95
|
const workspace = new Map(packages.map((owner) => [owner.name, owner.directory]));
|
|
97
96
|
const directories = [".", ...packages.map((owner) => owner.directory)];
|
|
98
97
|
const findings = yield* Effect.forEach(
|
|
@@ -100,7 +99,7 @@ export const manifestsApplication = defineRule({
|
|
|
100
99
|
(directory) =>
|
|
101
100
|
Effect.gen(function* () {
|
|
102
101
|
const manifestPath = posix.join(directory, "package.json");
|
|
103
|
-
const manifest = yield*
|
|
102
|
+
const manifest = yield* readPackageManifest(inputs.readText, manifestPath);
|
|
104
103
|
if (!isApplication(manifest)) {
|
|
105
104
|
return [];
|
|
106
105
|
}
|