@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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
2
3
|
import { resolvePackage } from "#adapters/biome/resolvePackage.ts";
|
|
4
|
+
import type { ManifestFailure } from "#adapters/manifestInventory.ts";
|
|
5
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
3
6
|
import type { Finding, RuleInputs } from "#rule.ts";
|
|
4
7
|
import { type Declaration, decodeShipped, PRESET_DECLARATIONS } from "#rules/suppressions/biome/declarations.ts";
|
|
5
8
|
import { itemsOf, type Json, member, type Parsed, parseJsonc, textOf } from "#rules/suppressions/biome/json.ts";
|
|
@@ -39,70 +42,84 @@ function directoryOf(path: string): string {
|
|
|
39
42
|
return posix.dirname(path) === "." ? "" : posix.dirname(path);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
const text =
|
|
45
|
+
const read = Effect.fn("Biome.read")(function* (readText: ReadText, path: string): Effect.fn.Return<Parsed, FilesystemFailure> {
|
|
46
|
+
const text = yield* readText(path);
|
|
44
47
|
return text === undefined ? { _tag: "Unreadable", reason: "the file does not exist" } : parseJsonc(path, text);
|
|
45
|
-
}
|
|
48
|
+
});
|
|
46
49
|
|
|
47
50
|
function problem(file: string, message: string, line?: number): Loaded {
|
|
48
51
|
return { layers: [], problems: [{ file, line, message }] };
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
const parsed =
|
|
54
|
+
const local = Effect.fn("Biome.local")(function* (readText: ReadText, path: string): Effect.fn.Return<Loaded, FilesystemFailure> {
|
|
55
|
+
const parsed = yield* read(readText, path);
|
|
53
56
|
return parsed._tag === "Parsed"
|
|
54
57
|
? { layers: [{ json: parsed.json, path, preset: undefined }], problems: [] }
|
|
55
58
|
: problem(path, `Cannot read this Biome config: ${parsed.reason}.`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const fromPackage = Effect.fn("Biome.fromPackage")(function* (
|
|
62
|
+
readText: ReadText,
|
|
63
|
+
from: string,
|
|
64
|
+
entry: Json,
|
|
65
|
+
specifier: string,
|
|
66
|
+
): Effect.fn.Return<Loaded, FilesystemFailure | ManifestFailure> {
|
|
67
|
+
const target = yield* resolvePackage(readText, specifier);
|
|
60
68
|
if (target === undefined) {
|
|
61
69
|
return problem(from, `Cannot resolve the Biome config "${specifier}" from node_modules.`, entry.line);
|
|
62
70
|
}
|
|
63
|
-
const parsed =
|
|
71
|
+
const parsed = yield* read(readText, target);
|
|
64
72
|
if (parsed._tag === "Unreadable") {
|
|
65
73
|
return problem(from, `Cannot read the Biome config "${specifier}" at ${target}: ${parsed.reason}.`, entry.line);
|
|
66
74
|
}
|
|
67
75
|
const shipped = posix.join(posix.dirname(target), PRESET_DECLARATIONS);
|
|
68
|
-
const declared =
|
|
76
|
+
const declared = decodeShipped(yield* readText(shipped));
|
|
69
77
|
if (declared._tag === "Invalid") {
|
|
70
78
|
return problem(from, `Cannot read the declarations shipped with "${specifier}" at ${shipped}: ${declared.issues.join("; ")}.`, entry.line);
|
|
71
79
|
}
|
|
72
80
|
const preset = { declared: declared.value, file: from, line: entry.line, specifier };
|
|
73
81
|
return { layers: [{ json: parsed.json, path: target, preset }], problems: [] };
|
|
74
|
-
}
|
|
82
|
+
});
|
|
75
83
|
|
|
76
|
-
|
|
84
|
+
const extended = Effect.fn("Biome.extended")(function* (
|
|
85
|
+
readText: ReadText,
|
|
86
|
+
from: string,
|
|
87
|
+
entry: Json,
|
|
88
|
+
): Effect.fn.Return<Loaded, FilesystemFailure | ManifestFailure> {
|
|
77
89
|
const specifier = textOf(entry);
|
|
78
90
|
if (specifier === undefined || specifier === "//") {
|
|
79
91
|
return { layers: [], problems: [] };
|
|
80
92
|
}
|
|
81
93
|
if (RELATIVE.test(specifier)) {
|
|
82
|
-
return local(readText, posix.join(posix.dirname(from), specifier));
|
|
94
|
+
return yield* local(readText, posix.join(posix.dirname(from), specifier));
|
|
83
95
|
}
|
|
84
96
|
const relative = posix.normalize(specifier);
|
|
85
|
-
return (
|
|
86
|
-
}
|
|
97
|
+
return yield* (yield* readText(relative)) === undefined ? fromPackage(readText, from, entry, specifier) : local(readText, relative);
|
|
98
|
+
});
|
|
87
99
|
|
|
88
100
|
function extendsOf(json: Json): readonly Json[] {
|
|
89
101
|
return itemsOf(member(json, "extends"));
|
|
90
102
|
}
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
const chainOf = Effect.fn("Biome.chainOf")(function* (
|
|
105
|
+
readText: ReadText,
|
|
106
|
+
path: string,
|
|
107
|
+
): Effect.fn.Return<Loaded, FilesystemFailure | ManifestFailure> {
|
|
108
|
+
const own = yield* local(readText, path);
|
|
94
109
|
const [layer] = own.layers;
|
|
95
110
|
if (layer === undefined) {
|
|
96
111
|
return own;
|
|
97
112
|
}
|
|
98
|
-
const parents =
|
|
113
|
+
const parents = yield* Effect.forEach(extendsOf(layer.json), (entry) => extended(readText, path, entry), { concurrency: "unbounded" });
|
|
99
114
|
return { layers: [...parents.flatMap((parent) => parent.layers), layer], problems: parents.flatMap((parent) => parent.problems) };
|
|
100
|
-
}
|
|
115
|
+
});
|
|
101
116
|
|
|
102
|
-
|
|
103
|
-
const present =
|
|
117
|
+
const rootConfigPath = Effect.fn("Biome.rootConfigPath")(function* (readText: ReadText) {
|
|
118
|
+
const present = yield* Effect.forEach(ROOT_CONFIGS, (path) => Effect.map(readText(path), (text) => (text === undefined ? [] : [path])), {
|
|
119
|
+
concurrency: "unbounded",
|
|
120
|
+
});
|
|
104
121
|
return present.flat()[0];
|
|
105
|
-
}
|
|
122
|
+
});
|
|
106
123
|
|
|
107
124
|
export interface BiomeConfigs {
|
|
108
125
|
readonly chains: readonly Chain[];
|
|
@@ -110,16 +127,21 @@ export interface BiomeConfigs {
|
|
|
110
127
|
readonly root: string;
|
|
111
128
|
}
|
|
112
129
|
|
|
113
|
-
export
|
|
114
|
-
|
|
115
|
-
|
|
130
|
+
export const biomeConfigs = Effect.fn("Biome.biomeConfigs")(function* ({
|
|
131
|
+
files,
|
|
132
|
+
readText,
|
|
133
|
+
}: RuleInputs): Effect.fn.Return<BiomeConfigs, FilesystemFailure | ManifestFailure> {
|
|
134
|
+
const root = yield* rootConfigPath(readText);
|
|
135
|
+
const rootChain = root === undefined ? { layers: [], problems: [] } : yield* chainOf(readText, root);
|
|
116
136
|
const loaded = new Set(rootChain.layers.map((layer) => layer.path));
|
|
117
137
|
const nested = files.filter((path) => NESTED.test(path) && path !== root && !loaded.has(path));
|
|
118
|
-
const below =
|
|
138
|
+
const below = yield* Effect.forEach(nested, (path) => Effect.map(chainOf(readText, path), (chain) => ({ base: directoryOf(path), ...chain })), {
|
|
139
|
+
concurrency: "unbounded",
|
|
140
|
+
});
|
|
119
141
|
const all = [{ base: "", ...rootChain }, ...below];
|
|
120
142
|
return {
|
|
121
143
|
chains: all.filter((chain) => chain.layers.length > 0).map(({ base, layers }) => ({ base, layers })),
|
|
122
144
|
problems: all.flatMap((chain) => chain.problems),
|
|
123
145
|
root: root ?? "biome.json",
|
|
124
146
|
};
|
|
125
|
-
}
|
|
147
|
+
});
|
|
@@ -11,22 +11,22 @@ function problem(file: string, message: string): { readonly _tag: "Problem"; rea
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const presetConfig = Effect.fn("Biome.presetConfig")(function* (readText: RuleInputs["readText"]) {
|
|
14
|
-
const root = yield*
|
|
14
|
+
const root = yield* rootConfig(readText);
|
|
15
15
|
if (!root.extendsPreset) {
|
|
16
16
|
return { _tag: "Skipped" } as const;
|
|
17
17
|
}
|
|
18
|
-
const path = yield*
|
|
18
|
+
const path = yield* resolvePackage(readText, PRESET);
|
|
19
19
|
if (path === undefined) {
|
|
20
20
|
return problem(root.path, `Cannot resolve "${PRESET}" from node_modules. Install @shivaedev/quality at the repository root.`);
|
|
21
21
|
}
|
|
22
|
-
const text = yield*
|
|
22
|
+
const text = yield* readText(path);
|
|
23
23
|
const parsed = text === undefined ? undefined : parseJsonc(path, text);
|
|
24
24
|
if (parsed?._tag !== "Parsed") {
|
|
25
25
|
return problem(path, `Cannot read the preset "${PRESET}": ${parsed?.reason ?? "the file does not exist"}.`);
|
|
26
26
|
}
|
|
27
27
|
const declarationsPath = posix.join(posix.dirname(path), PRESET_DECLARATIONS);
|
|
28
|
-
const declarationText = yield*
|
|
29
|
-
const declarations =
|
|
28
|
+
const declarationText = yield* readText(declarationsPath);
|
|
29
|
+
const declarations = decodeShipped(declarationText);
|
|
30
30
|
if (declarations._tag === "Invalid") {
|
|
31
31
|
return problem(declarationsPath, `Cannot read the declarations shipped with "${PRESET}": ${declarations.issues.join("; ")}.`);
|
|
32
32
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
2
3
|
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
4
|
import type { PackageManifest } from "#PackageManifest.ts";
|
|
4
5
|
import type { RuleInputs } from "#rule.ts";
|
|
@@ -60,16 +61,16 @@ function fromDependency(directory: string, manifest: PackageManifest, subpath: s
|
|
|
60
61
|
return subpath === "" ? undefined : posix.join(directory, subpath);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
export
|
|
64
|
+
export const resolvePackage = Effect.fn("Biome.resolvePackage")(function* (readText: RuleInputs["readText"], specifier: string) {
|
|
64
65
|
const { name, subpath = "" } = SPECIFIER.exec(specifier)?.groups ?? {};
|
|
65
66
|
if (name === undefined) {
|
|
66
67
|
return undefined;
|
|
67
68
|
}
|
|
68
|
-
const own =
|
|
69
|
+
const own = yield* readPackageManifest(readText, "package.json");
|
|
69
70
|
if (own?.name === name && own.exports !== undefined && subpath !== "") {
|
|
70
71
|
return inPackage("", exported(own.exports, subpath));
|
|
71
72
|
}
|
|
72
73
|
const directory = posix.join("node_modules", name);
|
|
73
|
-
const manifest =
|
|
74
|
+
const manifest = yield* readPackageManifest(readText, posix.join(directory, "package.json"));
|
|
74
75
|
return manifest === undefined ? undefined : fromDependency(directory, manifest, subpath);
|
|
75
|
-
}
|
|
76
|
+
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
1
3
|
import type { RuleInputs } from "#rule.ts";
|
|
2
4
|
import { itemsOf, member, parseJsonc, textOf } from "#rules/suppressions/biome/json.ts";
|
|
3
5
|
|
|
@@ -10,10 +12,12 @@ interface RootConfig {
|
|
|
10
12
|
readonly path: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
+
export const rootConfig = Effect.fn("Biome.rootConfig")(function* (
|
|
16
|
+
readText: RuleInputs["readText"],
|
|
17
|
+
): Effect.fn.Return<RootConfig, FilesystemFailure> {
|
|
18
|
+
const texts = yield* Effect.forEach(ROOT_CONFIGS, (path) => Effect.map(readText(path), (text) => ({ path, text })), { concurrency: "unbounded" });
|
|
15
19
|
const found = texts.find((candidate) => candidate.text !== undefined);
|
|
16
20
|
const parsed = found?.text === undefined ? undefined : parseJsonc(found.path, found.text);
|
|
17
21
|
const extended = parsed?._tag === "Parsed" ? itemsOf(member(parsed.json, "extends")).map(textOf) : [];
|
|
18
22
|
return { extendsPreset: extended.includes(PRESET), path: found?.path ?? "biome.json" };
|
|
19
|
-
}
|
|
23
|
+
});
|
|
@@ -22,10 +22,9 @@ export const toolContractDefaults = Effect.fn("Biome.toolContractDefaults")(func
|
|
|
22
22
|
}
|
|
23
23
|
const readText = yield* manifestReader(root);
|
|
24
24
|
const contracts = yield* Effect.forEach([...directories], (directory) =>
|
|
25
|
-
Effect.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}),
|
|
25
|
+
Effect.map(readPackageManifest(readText, join(directory, "package.json")), (manifest) =>
|
|
26
|
+
vitestContractPaths(directory, manifest?.scripts ?? {}).map((path) => resolve(root, path)),
|
|
27
|
+
),
|
|
29
28
|
);
|
|
30
29
|
return new Set(contracts.flat());
|
|
31
|
-
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isBuiltin } from "node:module";
|
|
2
|
+
|
|
3
|
+
const NODE_PREFIX = "node:";
|
|
4
|
+
|
|
5
|
+
export function builtinName(specifier: string): string | undefined {
|
|
6
|
+
if (!isBuiltin(specifier)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return specifier.startsWith(NODE_PREFIX) ? specifier : `${NODE_PREFIX}${specifier}`;
|
|
10
|
+
}
|
|
@@ -6,7 +6,7 @@ export const catalogWorkspace = Effect.fn("Manifests.catalogWorkspace")(function
|
|
|
6
6
|
let directory = root;
|
|
7
7
|
for (;;) {
|
|
8
8
|
const file = relative(root, join(directory, "pnpm-workspace.yaml")).split(sep).join("/");
|
|
9
|
-
const text = yield*
|
|
9
|
+
const text = yield* readText(file);
|
|
10
10
|
if (text !== undefined) {
|
|
11
11
|
return { file, text };
|
|
12
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { parseArgs } from "node:util";
|
|
2
|
+
import { Result } from "effect";
|
|
3
|
+
import { OPTIONS } from "#cli/misplaced.ts";
|
|
4
|
+
|
|
5
|
+
export function commandLine(args: readonly string[]) {
|
|
6
|
+
return Result.try({
|
|
7
|
+
catch: (error) => (error instanceof Error ? error.message : String(error)),
|
|
8
|
+
try: () => parseArgs({ allowPositionals: true, args: [...args], options: OPTIONS, strict: true }),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
|
|
4
|
+
// Node caches a loaded module by URL, so an edited file only reloads under a URL its content changes.
|
|
5
|
+
export function contentHashedModule(path: string, text: string): string {
|
|
6
|
+
const url = pathToFileURL(path);
|
|
7
|
+
url.searchParams.set("content", createHash("sha256").update(text).digest("hex"));
|
|
8
|
+
return url.href;
|
|
9
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
function unparenthesized(node: ts.Expression): ts.Expression {
|
|
4
|
+
return ts.isParenthesizedExpression(node) ? unparenthesized(node.expression) : node;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function enclosingFunction(node: ts.Node): ts.Node | undefined {
|
|
8
|
+
for (let parent = node.parent; parent !== undefined; parent = parent.parent) {
|
|
9
|
+
if (ts.isFunctionLike(parent)) {
|
|
10
|
+
return parent;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function earlierWrite(node: ts.Identifier): boolean {
|
|
17
|
+
const call = node.parent;
|
|
18
|
+
return (
|
|
19
|
+
ts.isCallExpression(call)
|
|
20
|
+
&& call.arguments[0] === node
|
|
21
|
+
&& ts.isPropertyAccessExpression(call.expression)
|
|
22
|
+
&& call.expression.expression.getText() === "Object"
|
|
23
|
+
&& ["assign", "defineProperty"].includes(call.expression.name.text)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function usedBefore(checker: ts.TypeChecker, declaration: ts.VariableDeclaration, write: ts.Node): boolean {
|
|
28
|
+
const symbol = checker.getSymbolAtLocation(declaration.name);
|
|
29
|
+
function visit(node: ts.Node): boolean {
|
|
30
|
+
if (node.pos >= write.pos) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (ts.isIdentifier(node) && node !== declaration.name) {
|
|
34
|
+
const referred = ts.isShorthandPropertyAssignment(node.parent)
|
|
35
|
+
? checker.getShorthandAssignmentValueSymbol(node.parent)
|
|
36
|
+
: checker.getSymbolAtLocation(node);
|
|
37
|
+
if (referred === symbol && !earlierWrite(node)) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return ts.forEachChild(node, visit) ?? false;
|
|
42
|
+
}
|
|
43
|
+
return visit(declaration.getSourceFile());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function freshObject(checker: ts.TypeChecker, write: ts.Node, target: ts.Expression): boolean {
|
|
47
|
+
const value = unparenthesized(target);
|
|
48
|
+
if (ts.isNewExpression(value)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
const declaration = ts.isIdentifier(value) ? checker.getSymbolAtLocation(value)?.valueDeclaration : undefined;
|
|
52
|
+
return (
|
|
53
|
+
declaration !== undefined
|
|
54
|
+
&& ts.isVariableDeclaration(declaration)
|
|
55
|
+
&& (ts.getCombinedNodeFlags(declaration) & ts.NodeFlags.Const) !== 0
|
|
56
|
+
&& declaration.initializer !== undefined
|
|
57
|
+
&& ts.isNewExpression(unparenthesized(declaration.initializer))
|
|
58
|
+
&& enclosingFunction(declaration) === enclosingFunction(write)
|
|
59
|
+
&& !usedBefore(checker, declaration, write)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -2,11 +2,12 @@ import { realpathSync } from "node:fs";
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { dirname, join, relative } from "node:path";
|
|
4
4
|
import ts from "typescript";
|
|
5
|
+
import { builtinName } from "#adapters/builtinName.ts";
|
|
5
6
|
import type { Project } from "#adapters/imports/projects.ts";
|
|
6
7
|
import type { Ambient } from "#imports/ambient.ts";
|
|
7
8
|
import type { Endpoint } from "#imports/Endpoint.ts";
|
|
8
9
|
import type { ImportRequest } from "#imports/extract.ts";
|
|
9
|
-
import {
|
|
10
|
+
import { nameAt, packageNameOf } from "#imports/packageName.ts";
|
|
10
11
|
import { posix } from "#inventory/ignoreScope.ts";
|
|
11
12
|
|
|
12
13
|
const NODE_MODULES = "/node_modules/";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { globSync, statSync } from "node:fs";
|
|
2
2
|
import { join, posix } from "node:path";
|
|
3
|
+
import { Effect } from "effect";
|
|
3
4
|
import { isToolConfig } from "#adapters/isToolConfig.ts";
|
|
4
5
|
import { KNIP_ISSUES } from "#adapters/knip/findings.ts";
|
|
5
6
|
import { mockEntries } from "#adapters/knip/mockEntries.ts";
|
|
@@ -47,18 +48,21 @@ function externalDependencies(manifest: PackageManifest, externals: ReadonlySet<
|
|
|
47
48
|
return dependencies.filter((name) => externals.has(name));
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export
|
|
51
|
+
export const knipConfiguration = Effect.fn("Knip.knipConfiguration")(function* (
|
|
51
52
|
inputs: RuleInputs,
|
|
52
53
|
toolOwned: readonly string[] = [],
|
|
53
54
|
builds: ReachableBuilds = { entries: new Set(), externals: new Map() },
|
|
54
55
|
declared: readonly string[] = declaredEntries(inputs),
|
|
55
56
|
) {
|
|
56
|
-
const packages =
|
|
57
|
-
const manifests =
|
|
58
|
-
[".", ...packages.map(({ directory }) => directory)]
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const packages = yield* workspacePackages(inputs);
|
|
58
|
+
const manifests = yield* Effect.forEach(
|
|
59
|
+
[".", ...packages.map(({ directory }) => directory)],
|
|
60
|
+
(directory) =>
|
|
61
|
+
Effect.map(readPackageManifest(inputs.readText, posix.join(directory, "package.json")), (manifest) => ({
|
|
62
|
+
directory,
|
|
63
|
+
manifest: manifest ?? {},
|
|
64
|
+
})),
|
|
65
|
+
{ concurrency: "unbounded" },
|
|
62
66
|
);
|
|
63
67
|
const scripted = new Set(manifests.flatMap(({ directory, manifest }) => scriptPaths(directory, manifest.scripts ?? {})));
|
|
64
68
|
const mocked = new Set(mockEntries(inputs));
|
|
@@ -124,4 +128,4 @@ export async function knipConfiguration(
|
|
|
124
128
|
tags: [],
|
|
125
129
|
workspaces: Object.fromEntries(workspaces),
|
|
126
130
|
};
|
|
127
|
-
}
|
|
131
|
+
});
|
|
@@ -29,13 +29,13 @@ export const entryPointFindings = Effect.fn("Knip.entryPointFindings")(function*
|
|
|
29
29
|
const workspace = new Map(graph.packages.map(({ name, directory }) => [name, directory]));
|
|
30
30
|
const directories = [".", ...graph.packages.map(({ directory }) => directory)];
|
|
31
31
|
const policies = new Map(
|
|
32
|
-
yield* Effect.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
yield* Effect.forEach(
|
|
33
|
+
directories,
|
|
34
|
+
Effect.fnUntraced(function* (directory) {
|
|
35
|
+
const manifest = yield* readPackageManifest(inputs.readText, posix.join(directory, "package.json"));
|
|
36
|
+
return [directory, isApplication(manifest) ? yield* entryPointsOf(inputs, directory, manifest, workspace) : []] as const;
|
|
37
|
+
}),
|
|
38
|
+
{ concurrency: "unbounded" },
|
|
39
39
|
),
|
|
40
40
|
);
|
|
41
41
|
function owner(path: string) {
|
package/src/adapters/knip/run.ts
CHANGED
|
@@ -23,13 +23,13 @@ import(api).then(() => { process.chdir(root); return import(entry); })
|
|
|
23
23
|
.catch(error => { console.error(error); process.exitCode = 1; });
|
|
24
24
|
`;
|
|
25
25
|
export const runKnip = Effect.fn("Knip.runKnip")(function* (inputs: RuleInputs) {
|
|
26
|
-
if ((yield*
|
|
26
|
+
if ((yield* readPackageManifest(inputs.readText, "package.json")) === undefined) {
|
|
27
27
|
return [];
|
|
28
28
|
}
|
|
29
29
|
const files = yield* toolOwnedFiles(inputs.root);
|
|
30
30
|
const builds = yield* programmaticBuilds(inputs);
|
|
31
31
|
const declared = declaredEntries(inputs);
|
|
32
|
-
const configuration = yield*
|
|
32
|
+
const configuration = yield* knipConfiguration(inputs, files, builds, declared);
|
|
33
33
|
const checked = new Set([
|
|
34
34
|
...inputs.files,
|
|
35
35
|
...declared,
|
|
@@ -10,9 +10,7 @@ export const sourceConfig = Effect.fn("Knip.sourceConfig")(function* (inputs: Ru
|
|
|
10
10
|
yield* fs.makeDirectory(folder, { recursive: true });
|
|
11
11
|
yield* Effect.addFinalizer(() => fs.remove(folder, { recursive: true }).pipe(Effect.orDie));
|
|
12
12
|
const parents = yield* Effect.forEach(["tsconfig.json", "tsconfig.build.json"], (file) =>
|
|
13
|
-
Effect.
|
|
14
|
-
Effect.map((text) => (text === undefined ? [] : [resolve(inputs.root, directory, file)])),
|
|
15
|
-
),
|
|
13
|
+
inputs.readText(posix.join(directory, file)).pipe(Effect.map((text) => (text === undefined ? [] : [resolve(inputs.root, directory, file)]))),
|
|
16
14
|
);
|
|
17
15
|
yield* fs.writeFileString(join(folder, "tsconfig.json"), JSON.stringify({ extends: parents.flat(), files: [] }));
|
|
18
16
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
|
-
import { Data, Result, Schema } from "effect";
|
|
2
|
+
import { Data, Effect, Result, Schema } from "effect";
|
|
3
|
+
import type { FilesystemFailure } from "#inventory/filesystem.ts";
|
|
3
4
|
import { PackageManifest } from "#PackageManifest.ts";
|
|
4
5
|
import type { RuleInputs } from "#rule.ts";
|
|
5
6
|
|
|
@@ -10,13 +11,15 @@ export class ManifestFailure extends Data.TaggedError("ManifestFailure")<{
|
|
|
10
11
|
readonly path: string;
|
|
11
12
|
}> {}
|
|
12
13
|
|
|
14
|
+
export type ManifestReadFailure = FilesystemFailure | ManifestFailure;
|
|
15
|
+
|
|
13
16
|
export interface ManifestEntry {
|
|
14
17
|
readonly manifest: PackageManifest;
|
|
15
18
|
readonly text: string;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
interface ManifestInventory {
|
|
19
|
-
readonly entries: Map<string,
|
|
22
|
+
readonly entries: Map<string, Effect.Effect<ManifestEntry | undefined, ManifestReadFailure>>;
|
|
20
23
|
files?: readonly string[];
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -34,33 +37,40 @@ function inventoryFor(readText: ReadText): ManifestInventory {
|
|
|
34
37
|
return inventory;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
const decode = Effect.fn("Manifests.decode")(function* (
|
|
41
|
+
readText: ReadText,
|
|
42
|
+
path: string,
|
|
43
|
+
): Effect.fn.Return<ManifestEntry | undefined, ManifestReadFailure> {
|
|
44
|
+
const text = yield* readText(path);
|
|
39
45
|
if (text === undefined) {
|
|
40
46
|
return undefined;
|
|
41
47
|
}
|
|
42
48
|
const decoded = decodeManifest(text);
|
|
43
49
|
if (Result.isFailure(decoded)) {
|
|
44
|
-
|
|
50
|
+
return yield* new ManifestFailure({ message: `Invalid package manifest: ${decoded.failure.message}`, path });
|
|
45
51
|
}
|
|
46
52
|
return { manifest: decoded.success, text };
|
|
47
|
-
}
|
|
53
|
+
});
|
|
48
54
|
|
|
49
|
-
export
|
|
55
|
+
export const manifestEntry = Effect.fn("Manifests.manifestEntry")(function* (readText: ReadText, path: string) {
|
|
50
56
|
const inventory = inventoryFor(readText);
|
|
51
57
|
const normalized = posix.normalize(path);
|
|
52
|
-
const
|
|
58
|
+
const known = inventory.entries.get(normalized);
|
|
59
|
+
if (known !== undefined) {
|
|
60
|
+
return yield* known;
|
|
61
|
+
}
|
|
62
|
+
const entry = yield* Effect.cached(decode(readText, normalized));
|
|
53
63
|
inventory.entries.set(normalized, entry);
|
|
54
|
-
return entry;
|
|
55
|
-
}
|
|
64
|
+
return yield* entry;
|
|
65
|
+
});
|
|
56
66
|
|
|
57
|
-
export
|
|
58
|
-
return (
|
|
59
|
-
}
|
|
67
|
+
export const readPackageManifest = Effect.fn("Manifests.readPackageManifest")(function* (readText: ReadText, path: string) {
|
|
68
|
+
return (yield* manifestEntry(readText, path))?.manifest;
|
|
69
|
+
});
|
|
60
70
|
|
|
61
|
-
export
|
|
62
|
-
return (
|
|
63
|
-
}
|
|
71
|
+
export const manifestText = Effect.fn("Manifests.manifestText")(function* (readText: ReadText, path: string) {
|
|
72
|
+
return (yield* manifestEntry(readText, path))?.text;
|
|
73
|
+
});
|
|
64
74
|
|
|
65
75
|
export function manifestFiles(inputs: Pick<RuleInputs, "readText" | "files">): readonly string[] {
|
|
66
76
|
return inventoryFor(inputs.readText).files ?? inputs.files.filter((file) => posix.basename(file) === "package.json");
|
|
@@ -70,20 +80,15 @@ export function setManifestFiles(readText: ReadText, files: readonly string[]):
|
|
|
70
80
|
inventoryFor(readText).files = files;
|
|
71
81
|
}
|
|
72
82
|
|
|
73
|
-
|
|
83
|
+
const manifestFailure = Effect.fn("Manifests.manifestFailure")(
|
|
84
|
+
function* (readText: ReadText, file: string) {
|
|
85
|
+
const entry = yield* manifestEntry(readText, file);
|
|
86
|
+
return entry === undefined ? [new ManifestFailure({ message: `required input is missing: ${file}`, path: file })] : [];
|
|
87
|
+
},
|
|
88
|
+
Effect.catchTag("ManifestFailure", (failure) => Effect.succeed([failure])),
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
export const loadPackageManifests = Effect.fn("Manifests.loadPackageManifests")(function* (readText: ReadText, files: readonly string[]) {
|
|
74
92
|
inventoryFor(readText).files = files;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
try {
|
|
78
|
-
if ((await manifestEntry(readText, file)) === undefined) {
|
|
79
|
-
throw new ManifestFailure({ message: `required input is missing: ${file}`, path: file });
|
|
80
|
-
}
|
|
81
|
-
} catch (cause) {
|
|
82
|
-
if (!(cause instanceof ManifestFailure)) {
|
|
83
|
-
throw cause;
|
|
84
|
-
}
|
|
85
|
-
failures.push(cause);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return failures;
|
|
89
|
-
}
|
|
93
|
+
return (yield* Effect.forEach(files, (file) => manifestFailure(readText, file))).flat();
|
|
94
|
+
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import { Effect,
|
|
2
|
+
import { Effect, FileSystem } from "effect";
|
|
3
3
|
import { readOptionalText } from "#inventory/filesystem.ts";
|
|
4
4
|
import type { RuleInputs } from "#rule.ts";
|
|
5
5
|
|
|
6
6
|
export const manifestReader = Effect.fn("Manifests.manifestReader")(function* (
|
|
7
7
|
root: string,
|
|
8
|
-
): Effect.fn.Return<RuleInputs["readText"], never, FileSystem.FileSystem
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
return (path) => Effect.runPromiseWith(services)(readOptionalText(resolve(root, path)), { signal });
|
|
8
|
+
): Effect.fn.Return<RuleInputs["readText"], never, FileSystem.FileSystem> {
|
|
9
|
+
const fs = yield* FileSystem.FileSystem;
|
|
10
|
+
return (path) => Effect.provideService(readOptionalText(resolve(root, path)), FileSystem.FileSystem, fs);
|
|
12
11
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { sortPackageJson } from "sort-package-json";
|
|
2
|
+
|
|
3
|
+
export type Sorting = { readonly _tag: "Sorted" } | { readonly _tag: "Unsorted"; readonly sorted: string };
|
|
4
|
+
|
|
5
|
+
export function sortingOf(text: string): Sorting {
|
|
6
|
+
const sorted = sortPackageJson(text);
|
|
7
|
+
return sorted === text ? { _tag: "Sorted" } : { _tag: "Unsorted", sorted };
|
|
8
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type { ImportAnalysisFailure } from "#adapters/ImportAnalysisFailure.ts";
|
|
3
|
-
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
|
+
import { type ManifestReadFailure, readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
|
+
import type { GlobFailure } from "#imports/globMatcher.ts";
|
|
4
5
|
import { importGraph } from "#imports/graph.ts";
|
|
5
6
|
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
6
7
|
import { packageNameOf } from "#imports/packageName.ts";
|
|
@@ -41,7 +42,7 @@ function exempt(directory: string, path: string, name: string): boolean {
|
|
|
41
42
|
|
|
42
43
|
export const outsideImportFindings = Effect.fn("Imports.outsideImportFindings")(function* (
|
|
43
44
|
inputs: RuleInputs,
|
|
44
|
-
): Effect.fn.Return<readonly Finding[], ImportAnalysisFailure> {
|
|
45
|
+
): Effect.fn.Return<readonly Finding[], GlobFailure | ImportAnalysisFailure | ManifestReadFailure> {
|
|
45
46
|
const graph = yield* importGraph(inputs);
|
|
46
47
|
const owners = [...graph.packages.map((owner) => owner.directory), "."];
|
|
47
48
|
const runtime = new Map(
|
|
@@ -49,7 +50,7 @@ export const outsideImportFindings = Effect.fn("Imports.outsideImportFindings")(
|
|
|
49
50
|
owners,
|
|
50
51
|
(directory) =>
|
|
51
52
|
Effect.gen(function* () {
|
|
52
|
-
const manifest = yield*
|
|
53
|
+
const manifest = yield* readPackageManifest(inputs.readText, `${directory}/package.json`);
|
|
53
54
|
return [
|
|
54
55
|
directory,
|
|
55
56
|
new Set(Object.keys({ ...manifest?.dependencies, ...manifest?.peerDependencies, ...manifest?.optionalDependencies })),
|
|
@@ -15,7 +15,7 @@ const MESSAGE =
|
|
|
15
15
|
|
|
16
16
|
export const queueReadoutFindings = Effect.fn("Stories.queueReadoutFindings")(function* (inputs: RuleInputs) {
|
|
17
17
|
const graph = yield* importGraph(inputs);
|
|
18
|
-
const root = yield*
|
|
18
|
+
const root = yield* readPackageManifest(inputs.readText, "package.json");
|
|
19
19
|
const program = storyProgram(inputs, graph);
|
|
20
20
|
const origin = queueTestingOrigin(program.getTypeChecker());
|
|
21
21
|
return inputs.sources.flatMap((file) => {
|
|
@@ -48,7 +48,7 @@ export const repositoryPathFindings = Effect.fn("Docs.repositoryPathFindings")(f
|
|
|
48
48
|
const roots = new Set(files.map((file) => file.split("/")[0]));
|
|
49
49
|
const findings: Finding[] = [];
|
|
50
50
|
for (const file of files.filter((path) => isDocument(path) && posix.basename(path) !== "CLAUDE.md")) {
|
|
51
|
-
const text = yield*
|
|
51
|
+
const text = yield* readText(file);
|
|
52
52
|
for (const reference of references(text ?? "")) {
|
|
53
53
|
const { path, span, line } = reference;
|
|
54
54
|
if (!(path.startsWith("./") || path.startsWith("../") || roots.has(path.split("/")[0]))) {
|