@shivaedev/quality 0.55.0 → 0.57.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 +42 -0
- package/README.md +76 -17
- package/biome/plugins/effect-test-bodies.grit +1 -1
- package/dist/adapters/ImportCompiler.d.ts +21 -0
- package/dist/adapters/ImportCompiler.d.ts.map +1 -0
- package/dist/adapters/ImportCompiler.js +22 -0
- package/dist/adapters/ImportCompiler.js.map +1 -0
- package/dist/{rules/suppressions → adapters}/biome/configs.d.ts +2 -2
- package/dist/adapters/biome/configs.d.ts.map +1 -0
- package/dist/{rules/suppressions → adapters}/biome/configs.js +2 -2
- package/dist/adapters/biome/configs.js.map +1 -0
- package/dist/adapters/biome/presetConfig.d.ts +21 -0
- package/dist/adapters/biome/presetConfig.d.ts.map +1 -0
- package/dist/adapters/biome/presetConfig.js +32 -0
- package/dist/adapters/biome/presetConfig.js.map +1 -0
- package/dist/adapters/biome/relocateConfig.d.ts.map +1 -0
- package/dist/adapters/biome/relocateConfig.js.map +1 -0
- package/dist/adapters/biome/resolvePackage.d.ts.map +1 -0
- package/dist/adapters/biome/resolvePackage.js.map +1 -0
- package/dist/adapters/biome/rootConfig.d.ts +9 -0
- package/dist/adapters/biome/rootConfig.d.ts.map +1 -0
- package/dist/adapters/biome/rootConfig.js +11 -0
- package/dist/adapters/biome/rootConfig.js.map +1 -0
- package/dist/adapters/biome/run.js +1 -1
- package/dist/adapters/biome/run.js.map +1 -1
- package/dist/adapters/biome/syntaxOf.d.ts +3 -0
- package/dist/adapters/biome/syntaxOf.d.ts.map +1 -0
- package/dist/adapters/biome/syntaxOf.js +11 -0
- package/dist/adapters/biome/syntaxOf.js.map +1 -0
- package/dist/adapters/biome/withExceptionConfig.d.ts +8 -0
- package/dist/adapters/biome/withExceptionConfig.d.ts.map +1 -0
- package/dist/adapters/biome/withExceptionConfig.js +38 -0
- package/dist/adapters/biome/withExceptionConfig.js.map +1 -0
- package/dist/adapters/changeKeyApi.d.ts +4 -0
- package/dist/adapters/changeKeyApi.d.ts.map +1 -0
- package/dist/adapters/changeKeyApi.js +58 -0
- package/dist/adapters/changeKeyApi.js.map +1 -0
- package/dist/adapters/changeKeyFindings.d.ts +4 -0
- package/dist/adapters/changeKeyFindings.d.ts.map +1 -0
- package/dist/adapters/changeKeyFindings.js +87 -0
- package/dist/adapters/changeKeyFindings.js.map +1 -0
- package/dist/adapters/changeKeyLiterals.d.ts +3 -0
- package/dist/adapters/changeKeyLiterals.d.ts.map +1 -0
- package/dist/adapters/changeKeyLiterals.js +56 -0
- package/dist/adapters/changeKeyLiterals.js.map +1 -0
- package/dist/adapters/ignore.d.ts +10 -0
- package/dist/adapters/ignore.d.ts.map +1 -0
- package/dist/adapters/ignore.js +10 -0
- package/dist/adapters/ignore.js.map +1 -0
- package/dist/adapters/imports/browserChecker.d.ts +3 -0
- package/dist/adapters/imports/browserChecker.d.ts.map +1 -0
- package/dist/adapters/imports/browserChecker.js +8 -0
- package/dist/adapters/imports/browserChecker.js.map +1 -0
- package/dist/adapters/imports/departures.d.ts +5 -0
- package/dist/adapters/imports/departures.d.ts.map +1 -0
- package/dist/adapters/imports/departures.js +61 -0
- package/dist/adapters/imports/departures.js.map +1 -0
- package/dist/adapters/imports/fakeReferences.d.ts +14 -0
- package/dist/adapters/imports/fakeReferences.d.ts.map +1 -0
- package/dist/adapters/imports/fakeReferences.js +103 -0
- package/dist/adapters/imports/fakeReferences.js.map +1 -0
- package/dist/adapters/imports/fakeTargets.d.ts +13 -0
- package/dist/adapters/imports/fakeTargets.d.ts.map +1 -0
- package/dist/adapters/imports/fakeTargets.js +14 -0
- package/dist/adapters/imports/fakeTargets.js.map +1 -0
- package/dist/adapters/imports/graph.d.ts +4 -0
- package/dist/adapters/imports/graph.d.ts.map +1 -0
- package/dist/adapters/imports/graph.js +44 -0
- package/dist/adapters/imports/graph.js.map +1 -0
- package/dist/adapters/imports/projects.d.ts.map +1 -0
- package/dist/adapters/imports/projects.js.map +1 -0
- package/dist/{imports → adapters/imports}/resolve.d.ts +3 -10
- package/dist/adapters/imports/resolve.d.ts.map +1 -0
- package/dist/{imports → adapters/imports}/resolve.js +1 -1
- package/dist/adapters/imports/resolve.js.map +1 -0
- package/dist/adapters/knip/entryPointFindings.d.ts +2 -1
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/knip/entryPointFindings.js +7 -6
- 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 +1 -1
- package/dist/adapters/knip/run.js.map +1 -1
- package/dist/adapters/outsideImportFindings.d.ts +5 -0
- package/dist/adapters/outsideImportFindings.d.ts.map +1 -0
- package/dist/adapters/outsideImportFindings.js +78 -0
- package/dist/adapters/outsideImportFindings.js.map +1 -0
- package/dist/adapters/queueReadoutFindings.d.ts +8 -0
- package/dist/adapters/queueReadoutFindings.d.ts.map +1 -0
- package/dist/adapters/queueReadoutFindings.js +30 -0
- package/dist/adapters/queueReadoutFindings.js.map +1 -0
- package/dist/adapters/queueTestingOrigin.d.ts +5 -0
- package/dist/adapters/queueTestingOrigin.d.ts.map +1 -0
- package/dist/adapters/queueTestingOrigin.js +95 -0
- package/dist/adapters/queueTestingOrigin.js.map +1 -0
- package/dist/adapters/readConfig.d.ts +7 -0
- package/dist/adapters/readConfig.d.ts.map +1 -0
- package/dist/adapters/readConfig.js +40 -0
- package/dist/adapters/readConfig.js.map +1 -0
- package/dist/adapters/rule.d.ts +9 -0
- package/dist/adapters/rule.d.ts.map +1 -0
- package/dist/adapters/rule.js +35 -0
- package/dist/adapters/rule.js.map +1 -0
- package/dist/adapters/serviceIdFindings.d.ts +4 -0
- package/dist/adapters/serviceIdFindings.d.ts.map +1 -0
- package/dist/adapters/serviceIdFindings.js +65 -0
- package/dist/adapters/serviceIdFindings.js.map +1 -0
- package/dist/adapters/sharedErrorFindings.d.ts +4 -0
- package/dist/adapters/sharedErrorFindings.d.ts.map +1 -0
- package/dist/adapters/sharedErrorFindings.js +71 -0
- package/dist/adapters/sharedErrorFindings.js.map +1 -0
- package/dist/adapters/sharedErrorModules.d.ts +7 -0
- package/dist/adapters/sharedErrorModules.d.ts.map +1 -0
- package/dist/adapters/sharedErrorModules.js +66 -0
- package/dist/adapters/sharedErrorModules.js.map +1 -0
- package/dist/adapters/standardSchema.d.ts.map +1 -0
- package/dist/adapters/standardSchema.js.map +1 -0
- package/dist/adapters/testProjects.d.ts.map +1 -1
- package/dist/adapters/testProjects.js +18 -2
- package/dist/adapters/testProjects.js.map +1 -1
- package/dist/appTestConfig.d.ts +1 -1
- package/dist/appTestConfig.d.ts.map +1 -1
- package/dist/appTestConfig.js.map +1 -1
- package/dist/biome/exceptionConfig.d.ts +0 -7
- package/dist/biome/exceptionConfig.d.ts.map +1 -1
- package/dist/biome/exceptionConfig.js +0 -36
- package/dist/biome/exceptionConfig.js.map +1 -1
- package/dist/biome/recognizeDiagnostics.d.ts.map +1 -1
- package/dist/biome/recognizeDiagnostics.js +2 -1
- package/dist/biome/recognizeDiagnostics.js.map +1 -1
- package/dist/biome/syntax.d.ts +0 -1
- package/dist/biome/syntax.d.ts.map +1 -1
- package/dist/biome/syntax.js +0 -9
- package/dist/biome/syntax.js.map +1 -1
- package/dist/biome/withoutEntryPointImports.d.ts +32 -2
- package/dist/biome/withoutEntryPointImports.d.ts.map +1 -1
- package/dist/biome/withoutEntryPointImports.js +12 -10
- package/dist/biome/withoutEntryPointImports.js.map +1 -1
- package/dist/cli/fixRule.js +1 -1
- package/dist/cli/fixRule.js.map +1 -1
- package/dist/config/decode.d.ts +2 -2
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +3 -2
- package/dist/config/decode.js.map +1 -1
- package/dist/config/globs.d.ts.map +1 -1
- package/dist/config/globs.js +1 -5
- package/dist/config/globs.js.map +1 -1
- package/dist/config/load.d.ts +2 -2
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +5 -36
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts +2 -2
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +2 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/config.d.ts +5 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/decoded.d.ts.map +1 -1
- package/dist/decoded.js +1 -1
- package/dist/decoded.js.map +1 -1
- package/dist/domEnvironment.config.js +1 -1
- package/dist/domEnvironment.config.js.map +1 -1
- package/dist/exceptions/biomeFindings.d.ts +1 -1
- package/dist/exceptions/biomeFindings.d.ts.map +1 -1
- package/dist/exceptions/biomeFindings.js +10 -6
- package/dist/exceptions/biomeFindings.js.map +1 -1
- package/dist/imports/Endpoint.d.ts +9 -0
- package/dist/imports/Endpoint.d.ts.map +1 -0
- package/dist/imports/Endpoint.js +2 -0
- package/dist/imports/Endpoint.js.map +1 -0
- package/dist/imports/browserGlobals.d.ts +2 -1
- package/dist/imports/browserGlobals.d.ts.map +1 -1
- package/dist/imports/browserGlobals.js +6 -9
- package/dist/imports/browserGlobals.js.map +1 -1
- package/dist/imports/departures.d.ts +3 -2
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/departures.js +8 -61
- package/dist/imports/departures.js.map +1 -1
- package/dist/imports/fences/check.d.ts +3 -2
- package/dist/imports/fences/check.d.ts.map +1 -1
- package/dist/imports/fences/check.js +5 -4
- package/dist/imports/fences/check.js.map +1 -1
- package/dist/imports/fences/compilePolicy.js.map +1 -1
- package/dist/imports/fences/match.d.ts +1 -1
- package/dist/imports/fences/match.d.ts.map +1 -1
- package/dist/imports/fences/match.js.map +1 -1
- package/dist/imports/fences/reach.d.ts +1 -1
- package/dist/imports/fences/reach.d.ts.map +1 -1
- package/dist/imports/fences/vocabulary.d.ts +1 -1
- package/dist/imports/fences/vocabulary.d.ts.map +1 -1
- package/dist/imports/graph.d.ts +4 -3
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/imports/graph.js +17 -55
- package/dist/imports/graph.js.map +1 -1
- package/dist/inventory/collect.js +2 -2
- package/dist/inventory/collect.js.map +1 -1
- package/dist/inventory/ignoreScope.d.ts +2 -2
- package/dist/inventory/ignoreScope.d.ts.map +1 -1
- package/dist/inventory/ignoreScope.js +2 -2
- package/dist/inventory/ignoreScope.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 -6
- package/dist/naming/packageLayout.js.map +1 -1
- package/dist/naming/testName.d.ts +1 -1
- package/dist/naming/testName.d.ts.map +1 -1
- package/dist/naming/testName.js +1 -1
- package/dist/naming/testName.js.map +1 -1
- package/dist/rule.d.ts +12 -8
- package/dist/rule.d.ts.map +1 -1
- package/dist/rule.js +8 -31
- package/dist/rule.js.map +1 -1
- package/dist/rules/biome.d.ts +1 -8
- package/dist/rules/biome.d.ts.map +1 -1
- package/dist/rules/biome.js +6 -15
- package/dist/rules/biome.js.map +1 -1
- package/dist/rules/builtIn.d.ts +2 -2
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +12 -0
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/effect/adapterImports.d.ts +2 -0
- package/dist/rules/effect/adapterImports.d.ts.map +1 -0
- package/dist/rules/effect/adapterImports.js +9 -0
- package/dist/rules/effect/adapterImports.js.map +1 -0
- package/dist/rules/effect/program.d.ts +1 -1
- package/dist/rules/effect/program.d.ts.map +1 -1
- package/dist/rules/effect/program.js +3 -3
- package/dist/rules/effect/program.js.map +1 -1
- package/dist/rules/effect/serviceIds.d.ts +2 -0
- package/dist/rules/effect/serviceIds.d.ts.map +1 -0
- package/dist/rules/effect/serviceIds.js +9 -0
- package/dist/rules/effect/serviceIds.js.map +1 -0
- package/dist/rules/effect/sharedErrorClasses.d.ts +2 -0
- package/dist/rules/effect/sharedErrorClasses.d.ts.map +1 -0
- package/dist/rules/effect/sharedErrorClasses.js +9 -0
- package/dist/rules/effect/sharedErrorClasses.js.map +1 -0
- package/dist/rules/files/folderNames.d.ts.map +1 -1
- package/dist/rules/files/folderNames.js +7 -7
- package/dist/rules/files/folderNames.js.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +6 -6
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/files/otherNames.d.ts.map +1 -1
- package/dist/rules/files/otherNames.js +7 -7
- package/dist/rules/files/otherNames.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 +4 -3
- 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 +5 -4
- package/dist/rules/files/stylesheetImporters.js.map +1 -1
- package/dist/rules/imports/adminPaths.js +1 -1
- package/dist/rules/imports/adminPaths.js.map +1 -1
- package/dist/rules/imports/aliased.d.ts.map +1 -1
- package/dist/rules/imports/aliased.js +3 -2
- package/dist/rules/imports/aliased.js.map +1 -1
- package/dist/rules/imports/cycles.d.ts.map +1 -1
- package/dist/rules/imports/cycles.js +4 -3
- package/dist/rules/imports/cycles.js.map +1 -1
- package/dist/rules/imports/manifest.d.ts.map +1 -1
- package/dist/rules/imports/manifest.js +6 -5
- package/dist/rules/imports/manifest.js.map +1 -1
- package/dist/rules/imports/noTestCode.d.ts.map +1 -1
- package/dist/rules/imports/noTestCode.js +3 -2
- package/dist/rules/imports/noTestCode.js.map +1 -1
- package/dist/rules/imports/resolvable.js +1 -1
- package/dist/rules/imports/resolvable.js.map +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +3 -2
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/manifestsApplication.d.ts.map +1 -1
- package/dist/rules/manifestsApplication.js +22 -22
- package/dist/rules/manifestsApplication.js.map +1 -1
- package/dist/rules/manifestsExportsShape.d.ts.map +1 -1
- package/dist/rules/manifestsExportsShape.js +32 -8
- package/dist/rules/manifestsExportsShape.js.map +1 -1
- package/dist/rules/manifestsSorted.d.ts.map +1 -1
- package/dist/rules/manifestsSorted.js +6 -5
- package/dist/rules/manifestsSorted.js.map +1 -1
- package/dist/rules/manifestsSourceFirst.d.ts.map +1 -1
- package/dist/rules/manifestsSourceFirst.js +6 -5
- package/dist/rules/manifestsSourceFirst.js.map +1 -1
- package/dist/rules/stories/adapterOnlyFakes.d.ts +2 -0
- package/dist/rules/stories/adapterOnlyFakes.d.ts.map +1 -0
- package/dist/rules/stories/adapterOnlyFakes.js +63 -0
- package/dist/rules/stories/adapterOnlyFakes.js.map +1 -0
- package/dist/rules/stories/engine.d.ts.map +1 -1
- package/dist/rules/stories/engine.js +5 -4
- package/dist/rules/stories/engine.js.map +1 -1
- package/dist/rules/stories/engineOf.d.ts +1 -1
- package/dist/rules/stories/engineOf.d.ts.map +1 -1
- package/dist/rules/stories/fakeImplementation.d.ts +4 -0
- package/dist/rules/stories/fakeImplementation.d.ts.map +1 -0
- package/dist/rules/stories/fakeImplementation.js +22 -0
- package/dist/rules/stories/fakeImplementation.js.map +1 -0
- package/dist/rules/stories/fakeReplacements.d.ts +4 -0
- package/dist/rules/stories/fakeReplacements.d.ts.map +1 -0
- package/dist/rules/stories/fakeReplacements.js +71 -0
- package/dist/rules/stories/fakeReplacements.js.map +1 -0
- package/dist/rules/stories/globalRetries.js +1 -1
- package/dist/rules/stories/globalRetries.js.map +1 -1
- package/dist/rules/stories/importOrigin.js +2 -2
- package/dist/rules/stories/importOrigin.js.map +1 -1
- package/dist/rules/stories/importedChangeKeys.d.ts +2 -0
- package/dist/rules/stories/importedChangeKeys.d.ts.map +1 -0
- package/dist/rules/stories/importedChangeKeys.js +9 -0
- package/dist/rules/stories/importedChangeKeys.js.map +1 -0
- package/dist/rules/stories/noExpect.d.ts.map +1 -1
- package/dist/rules/stories/noExpect.js +4 -3
- package/dist/rules/stories/noExpect.js.map +1 -1
- package/dist/rules/stories/pureNetImport.d.ts +4 -0
- package/dist/rules/stories/pureNetImport.d.ts.map +1 -0
- package/dist/rules/stories/pureNetImport.js +23 -0
- package/dist/rules/stories/pureNetImport.js.map +1 -0
- package/dist/rules/stories/queueReadouts.d.ts +2 -0
- package/dist/rules/stories/queueReadouts.d.ts.map +1 -0
- package/dist/rules/stories/queueReadouts.js +9 -0
- package/dist/rules/stories/queueReadouts.js.map +1 -0
- package/dist/rules/stories/sources.d.ts +1 -1
- 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.d.ts.map +1 -1
- package/dist/rules/stories/specs.js +5 -4
- package/dist/rules/stories/specs.js.map +1 -1
- package/dist/rules/stories/unitTests.d.ts.map +1 -1
- package/dist/rules/stories/unitTests.js +4 -3
- package/dist/rules/stories/unitTests.js.map +1 -1
- package/dist/rules/suppressions/biome/weakenings.d.ts +1 -1
- package/dist/rules/suppressions/biome/weakenings.d.ts.map +1 -1
- package/dist/rules/suppressions/biomeOverrides.d.ts.map +1 -1
- package/dist/rules/suppressions/biomeOverrides.js +5 -5
- package/dist/rules/suppressions/biomeOverrides.js.map +1 -1
- package/dist/rules/suppressions/biomeRecommended.d.ts +1 -1
- package/dist/rules/suppressions/biomeRecommended.d.ts.map +1 -1
- package/dist/rules/suppressions/biomeRecommended.js +12 -30
- package/dist/rules/suppressions/biomeRecommended.js.map +1 -1
- package/dist/rules/test-names/colocated.js +2 -2
- package/dist/rules/test-names/colocated.js.map +1 -1
- package/dist/rules/test-names/follow.js +4 -4
- package/dist/rules/test-names/follow.js.map +1 -1
- package/dist/testing/adapters/cli.d.ts +21 -0
- package/dist/testing/adapters/cli.d.ts.map +1 -0
- package/dist/testing/adapters/cli.js +85 -0
- package/dist/testing/adapters/cli.js.map +1 -0
- package/dist/testing/adapters/git.d.ts +14 -0
- package/dist/testing/adapters/git.d.ts.map +1 -0
- package/dist/testing/adapters/git.js +52 -0
- package/dist/testing/adapters/git.js.map +1 -0
- package/dist/testing/adapters/hookPath.d.ts +2 -0
- package/dist/testing/adapters/hookPath.d.ts.map +1 -0
- package/dist/testing/adapters/hookPath.js +6 -0
- package/dist/testing/adapters/hookPath.js.map +1 -0
- package/dist/testing/adapters/hookRepository.d.ts +25 -0
- package/dist/testing/adapters/hookRepository.d.ts.map +1 -0
- package/dist/testing/adapters/hookRepository.js +96 -0
- package/dist/testing/adapters/hookRepository.js.map +1 -0
- package/dist/testing/adapters/imports.d.ts +5 -0
- package/dist/testing/adapters/imports.d.ts.map +1 -0
- package/dist/testing/adapters/imports.js +29 -0
- package/dist/testing/adapters/imports.js.map +1 -0
- package/dist/testing/adapters/packageExports.d.ts +15 -0
- package/dist/testing/adapters/packageExports.d.ts.map +1 -0
- package/dist/testing/adapters/packageExports.js +29 -0
- package/dist/testing/adapters/packageExports.js.map +1 -0
- package/dist/testing/adapters/qualityTree.d.ts +4 -0
- package/dist/testing/adapters/qualityTree.d.ts.map +1 -0
- package/dist/testing/adapters/qualityTree.js +21 -0
- package/dist/testing/adapters/qualityTree.js.map +1 -0
- package/dist/testing/adapters/run.d.ts +4 -0
- package/dist/testing/adapters/run.d.ts.map +1 -0
- package/dist/testing/adapters/run.js +6 -0
- package/dist/testing/adapters/run.js.map +1 -0
- package/dist/testing/adapters/storySpecFiles.d.ts +7 -0
- package/dist/testing/adapters/storySpecFiles.d.ts.map +1 -0
- package/dist/testing/adapters/storySpecFiles.js +48 -0
- package/dist/testing/adapters/storySpecFiles.js.map +1 -0
- package/dist/testing/adapters/tree.d.ts +13 -0
- package/dist/testing/adapters/tree.d.ts.map +1 -0
- package/dist/testing/adapters/tree.js +42 -0
- package/dist/testing/adapters/tree.js.map +1 -0
- package/dist/testing/adapters/writePackageExports.d.ts +2 -0
- package/dist/testing/adapters/writePackageExports.d.ts.map +1 -0
- package/dist/testing/adapters/writePackageExports.js +9 -0
- package/dist/testing/adapters/writePackageExports.js.map +1 -0
- package/dist/testing/ruleStory.d.ts +28 -0
- package/dist/testing/ruleStory.d.ts.map +1 -0
- package/dist/testing/ruleStory.js +115 -0
- package/dist/testing/ruleStory.js.map +1 -0
- package/dist/unitIoGuard.config.js +1 -1
- package/dist/unitIoGuard.config.js.map +1 -1
- package/package.json +8 -3
- package/src/adapters/ImportCompiler.ts +30 -0
- package/src/{rules/suppressions → adapters}/biome/configs.ts +2 -2
- package/src/adapters/biome/presetConfig.ts +34 -0
- package/src/adapters/biome/rootConfig.ts +19 -0
- package/src/adapters/biome/run.ts +1 -1
- package/src/adapters/biome/syntaxOf.ts +12 -0
- package/src/adapters/biome/withExceptionConfig.ts +45 -0
- package/src/adapters/changeKeyApi.ts +62 -0
- package/src/adapters/changeKeyFindings.ts +96 -0
- package/src/adapters/changeKeyLiterals.ts +60 -0
- package/src/adapters/ignore.ts +16 -0
- package/src/adapters/imports/browserChecker.ts +8 -0
- package/src/adapters/imports/departures.ts +82 -0
- package/src/adapters/imports/fakeReferences.ts +115 -0
- package/src/adapters/imports/fakeTargets.ts +21 -0
- package/src/adapters/imports/graph.ts +48 -0
- package/src/{imports → adapters/imports}/resolve.ts +4 -7
- package/src/adapters/knip/entryPointFindings.ts +12 -9
- package/src/adapters/knip/run.ts +1 -1
- package/src/adapters/outsideImportFindings.ts +98 -0
- package/src/adapters/queueReadoutFindings.ts +37 -0
- package/src/adapters/queueTestingOrigin.ts +113 -0
- package/src/adapters/readConfig.ts +42 -0
- package/src/adapters/rule.ts +53 -0
- package/src/adapters/serviceIdFindings.ts +80 -0
- package/src/adapters/sharedErrorFindings.ts +84 -0
- package/src/adapters/sharedErrorModules.ts +81 -0
- package/src/adapters/testProjects.ts +18 -2
- package/src/appTestConfig.ts +1 -1
- package/src/biome/exceptionConfig.ts +0 -43
- package/src/biome/recognizeDiagnostics.ts +2 -1
- package/src/biome/syntax.ts +0 -10
- package/src/biome/withoutEntryPointImports.ts +15 -10
- package/src/cli/fixRule.ts +1 -1
- package/src/config/decode.ts +5 -4
- package/src/config/globs.ts +1 -6
- package/src/config/load.ts +6 -38
- package/src/config/resolve.ts +7 -6
- package/src/config.ts +5 -5
- package/src/decoded.ts +1 -1
- package/src/domEnvironment.config.ts +1 -1
- package/src/exceptions/biomeFindings.ts +11 -10
- package/src/imports/Endpoint.ts +3 -0
- package/src/imports/browserGlobals.ts +6 -10
- package/src/imports/departures.ts +9 -80
- package/src/imports/fences/check.ts +6 -5
- package/src/imports/fences/compilePolicy.ts +1 -1
- package/src/imports/fences/match.ts +1 -1
- package/src/imports/fences/reach.ts +1 -1
- package/src/imports/fences/vocabulary.ts +1 -1
- package/src/imports/graph.ts +25 -61
- package/src/inventory/collect.ts +2 -2
- package/src/inventory/ignoreScope.ts +3 -3
- package/src/naming/packageLayout.ts +14 -7
- package/src/naming/testName.ts +1 -1
- package/src/rule.ts +20 -52
- package/src/rules/biome.ts +6 -23
- package/src/rules/builtIn.ts +12 -0
- package/src/rules/effect/adapterImports.ts +10 -0
- package/src/rules/effect/program.ts +3 -3
- package/src/rules/effect/serviceIds.ts +10 -0
- package/src/rules/effect/sharedErrorClasses.ts +10 -0
- package/src/rules/files/folderNames.ts +19 -18
- package/src/rules/files/namedAfterExport.ts +10 -9
- package/src/rules/files/otherNames.ts +17 -16
- package/src/rules/files/packageImports.ts +14 -4
- package/src/rules/files/stylesheetImporters.ts +13 -6
- package/src/rules/imports/adminPaths.ts +1 -1
- package/src/rules/imports/aliased.ts +10 -7
- package/src/rules/imports/cycles.ts +4 -3
- package/src/rules/imports/manifest.ts +8 -5
- package/src/rules/imports/noTestCode.ts +12 -9
- package/src/rules/imports/resolvable.ts +1 -1
- package/src/rules/imports/runtime.ts +3 -2
- package/src/rules/manifestsApplication.ts +44 -33
- package/src/rules/manifestsExportsShape.ts +45 -15
- package/src/rules/manifestsSorted.ts +16 -11
- package/src/rules/manifestsSourceFirst.ts +22 -17
- package/src/rules/stories/adapterOnlyFakes.ts +66 -0
- package/src/rules/stories/engine.ts +5 -4
- package/src/rules/stories/engineOf.ts +1 -1
- package/src/rules/stories/fakeImplementation.ts +23 -0
- package/src/rules/stories/fakeReplacements.ts +74 -0
- package/src/rules/stories/globalRetries.ts +1 -1
- package/src/rules/stories/importOrigin.ts +2 -2
- package/src/rules/stories/importedChangeKeys.ts +10 -0
- package/src/rules/stories/noExpect.ts +4 -3
- package/src/rules/stories/pureNetImport.ts +29 -0
- package/src/rules/stories/queueReadouts.ts +9 -0
- package/src/rules/stories/sources.ts +1 -1
- package/src/rules/stories/specs.ts +5 -4
- package/src/rules/stories/unitTests.ts +6 -3
- package/src/rules/suppressions/biome/weakenings.ts +1 -1
- package/src/rules/suppressions/biomeOverrides.ts +17 -16
- package/src/rules/suppressions/biomeRecommended.ts +13 -32
- package/src/rules/test-names/colocated.ts +2 -2
- package/src/rules/test-names/follow.ts +4 -4
- package/src/testing/adapters/cli.ts +105 -0
- package/src/testing/adapters/git.ts +62 -0
- package/src/testing/adapters/hookPath.ts +6 -0
- package/src/testing/adapters/hookRepository.ts +134 -0
- package/src/testing/adapters/imports.ts +35 -0
- package/src/testing/adapters/packageExports.ts +37 -0
- package/src/testing/adapters/qualityTree.ts +26 -0
- package/src/testing/adapters/run.ts +7 -0
- package/src/testing/adapters/storySpecFiles.ts +54 -0
- package/src/testing/adapters/tree.ts +55 -0
- package/src/testing/adapters/writePackageExports.ts +9 -0
- package/src/testing/ruleStory.ts +139 -0
- package/src/unitIoGuard.config.ts +1 -1
- package/dist/biome/relocateConfig.d.ts.map +0 -1
- package/dist/biome/relocateConfig.js.map +0 -1
- package/dist/imports/projects.d.ts.map +0 -1
- package/dist/imports/projects.js.map +0 -1
- package/dist/imports/resolve.d.ts.map +0 -1
- package/dist/imports/resolve.js.map +0 -1
- package/dist/rules/suppressions/biome/configs.d.ts.map +0 -1
- package/dist/rules/suppressions/biome/configs.js.map +0 -1
- package/dist/rules/suppressions/biome/resolvePackage.d.ts.map +0 -1
- package/dist/rules/suppressions/biome/resolvePackage.js.map +0 -1
- package/dist/standardSchema.d.ts.map +0 -1
- package/dist/standardSchema.js.map +0 -1
- /package/dist/{biome → adapters/biome}/relocateConfig.d.ts +0 -0
- /package/dist/{biome → adapters/biome}/relocateConfig.js +0 -0
- /package/dist/{rules/suppressions → adapters}/biome/resolvePackage.d.ts +0 -0
- /package/dist/{rules/suppressions → adapters}/biome/resolvePackage.js +0 -0
- /package/dist/{imports → adapters/imports}/projects.d.ts +0 -0
- /package/dist/{imports → adapters/imports}/projects.js +0 -0
- /package/dist/{standardSchema.d.ts → adapters/standardSchema.d.ts} +0 -0
- /package/dist/{standardSchema.js → adapters/standardSchema.js} +0 -0
- /package/src/{biome → adapters/biome}/relocateConfig.ts +0 -0
- /package/src/{rules/suppressions → adapters}/biome/resolvePackage.ts +0 -0
- /package/src/{imports → adapters/imports}/projects.ts +0 -0
- /package/src/{standardSchema.ts → adapters/standardSchema.ts} +0 -0
|
@@ -18,7 +18,7 @@ export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")
|
|
|
18
18
|
entry.rules.includes("biome/files/includes") ? [{ ...entry, rules: ["biome/files/includes"] as const }] : [],
|
|
19
19
|
);
|
|
20
20
|
const report = yield* biomeReport(inputs.root, ["check", "--no-errors-on-unmatched"], exclusions, [...new Set(entries.map(({ file }) => file))]);
|
|
21
|
-
const diagnostics = yield*
|
|
21
|
+
const diagnostics = yield* withoutEntryPointImports(inputs, report.diagnostics);
|
|
22
22
|
return entries
|
|
23
23
|
.filter(({ file, rule }) => !diagnostics.some((diagnostic) => diagnostic.location.path === file && `biome/${diagnostic.category}` === rule))
|
|
24
24
|
.map(
|
|
@@ -29,19 +29,20 @@ export const staleBiomeExceptions = Effect.fn("Exceptions.staleBiomeExceptions")
|
|
|
29
29
|
);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const missingBiomeFile = Effect.fn("Exceptions.missingBiomeFile")(function* (inputs: RuleInputs, file: string): Effect.fn.Return<readonly Finding[]> {
|
|
33
|
+
const text = yield* Effect.promise(() => inputs.readText(file));
|
|
34
|
+
return text === undefined
|
|
35
|
+
? [{ file, message: `This Biome exception names a missing file. Remove it from exceptions in ${inputs.configFile ?? "quality.config.ts"}.` }]
|
|
36
|
+
: [];
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const missingBiomeFiles = Effect.fn("Exceptions.missingBiomeFiles")(function* (inputs: RuleInputs) {
|
|
33
40
|
const paths = (inputs.exceptions ?? [])
|
|
34
41
|
.filter((entry) => entry.rules.some((rule) => rule.startsWith("biome/") && rule !== "biome/files/includes"))
|
|
35
42
|
.flatMap((entry) => entry.files);
|
|
36
|
-
const checked =
|
|
37
|
-
[...new Set(paths)].map(async (file) =>
|
|
38
|
-
(await inputs.readText(file)) === undefined
|
|
39
|
-
? [{ file, message: `This Biome exception names a missing file. Remove it from exceptions in ${inputs.configFile ?? "quality.config.ts"}.` }]
|
|
40
|
-
: [],
|
|
41
|
-
),
|
|
42
|
-
);
|
|
43
|
+
const checked = yield* Effect.forEach([...new Set(paths)], (file) => missingBiomeFile(inputs, file), { concurrency: "unbounded" });
|
|
43
44
|
return checked.flat();
|
|
44
|
-
}
|
|
45
|
+
});
|
|
45
46
|
|
|
46
47
|
export function biomeExceptionHint(files: readonly string[], rule: string, config = "quality.config.ts"): string {
|
|
47
48
|
const entry = { files, reason: "Explain why this exception is permanent.", rules: [`biome/${rule}`] };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
1
2
|
import ts from "typescript";
|
|
3
|
+
import { ImportCompiler } from "#adapters/ImportCompiler.ts";
|
|
2
4
|
import type { Finding, SourceFile } from "#rule.ts";
|
|
3
5
|
import { parse } from "#rules/parse.ts";
|
|
4
6
|
import { browserNames } from "./browserNames.ts";
|
|
5
7
|
|
|
6
|
-
function checkerOf(source: ts.SourceFile): ts.TypeChecker {
|
|
7
|
-
const options: ts.CompilerOptions = { allowJs: true, noLib: true, noResolve: true };
|
|
8
|
-
const host = ts.createCompilerHost(options);
|
|
9
|
-
host.getSourceFile = (path) => (path === source.fileName ? source : undefined);
|
|
10
|
-
return ts.createProgram([source.fileName], options, host).getTypeChecker();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
8
|
function unbound(checker: ts.TypeChecker, node: ts.Identifier): boolean {
|
|
14
9
|
return (checker.getSymbolAtLocation(node)?.declarations ?? []).length === 0;
|
|
15
10
|
}
|
|
@@ -107,13 +102,14 @@ function superclassesOf(node: ts.HeritageClause): readonly ts.Expression[] {
|
|
|
107
102
|
return node.types.map((base) => base.expression);
|
|
108
103
|
}
|
|
109
104
|
|
|
110
|
-
export
|
|
105
|
+
export const browserGlobals = Effect.fn("Imports.browserGlobals")(function* (file: SourceFile) {
|
|
111
106
|
const parsed = parse(file);
|
|
112
107
|
if (parsed === undefined) {
|
|
113
108
|
return [];
|
|
114
109
|
}
|
|
115
110
|
const source = parsed;
|
|
116
|
-
const
|
|
111
|
+
const compiler = yield* ImportCompiler;
|
|
112
|
+
const checker = yield* compiler.browserChecker(source);
|
|
117
113
|
const findings: Finding[] = [];
|
|
118
114
|
function visit(node: ts.Node): void {
|
|
119
115
|
if (ts.isHeritageClause(node)) {
|
|
@@ -139,4 +135,4 @@ export function browserGlobals(file: SourceFile): readonly Finding[] {
|
|
|
139
135
|
}
|
|
140
136
|
visit(source);
|
|
141
137
|
return findings;
|
|
142
|
-
}
|
|
138
|
+
}, Effect.provide(ImportCompiler.layer));
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { moduleRoot } from "#naming/moduleRoot.ts";
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ImportCompiler } from "#adapters/ImportCompiler.ts";
|
|
4
3
|
import type { RuleInputs } from "#rule.ts";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { type Project, projectsFor } from "./projects.ts";
|
|
8
|
-
import { resolveImport } from "./resolve.ts";
|
|
9
|
-
import { type SpecifierSite, specifierSites } from "./specifiers.ts";
|
|
10
|
-
import { packageOf, type WorkspacePackage, workspacePackages } from "./workspace.ts";
|
|
4
|
+
import type { SpecifierSite } from "./specifiers.ts";
|
|
5
|
+
import { workspacePackages } from "./workspace.ts";
|
|
11
6
|
|
|
12
7
|
export interface Departure extends SpecifierSite {
|
|
13
8
|
readonly file: string;
|
|
@@ -15,74 +10,8 @@ export interface Departure extends SpecifierSite {
|
|
|
15
10
|
readonly workspace: string | undefined;
|
|
16
11
|
}
|
|
17
12
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const TRAILING_SLASHES = /\/+$/u;
|
|
25
|
-
|
|
26
|
-
function noAmbient(): boolean {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function leavesLexically(path: string): boolean {
|
|
31
|
-
const normal = posix.normalize(path).replace(TRAILING_SLASHES, "");
|
|
32
|
-
return normal === ".." || normal.startsWith("../") || normal.includes("/");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface FileContext {
|
|
36
|
-
readonly from: string;
|
|
37
|
-
readonly packages: readonly WorkspacePackage[];
|
|
38
|
-
readonly path: string;
|
|
39
|
-
readonly project: Project;
|
|
40
|
-
readonly root: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function registersAdmin(from: string, specifier: string, target: string | undefined): boolean {
|
|
44
|
-
const root = moduleRoot(from);
|
|
45
|
-
const folder = posix.dirname(from);
|
|
46
|
-
return (
|
|
47
|
-
root !== undefined
|
|
48
|
-
&& (folder === `${root}/client` || folder === `${root}/server`)
|
|
49
|
-
&& /^registration\.[cm]?[jt]sx?$/u.test(posix.basename(from))
|
|
50
|
-
&& specifier.startsWith("./admin/")
|
|
51
|
-
&& target?.startsWith(`${folder}/admin/`) === true
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// A relative import leaves its folder when its path climbs or descends, or when it names a folder whose index file lies below.
|
|
56
|
-
function departureAt(context: FileContext, site: SpecifierSite): Departure | undefined {
|
|
57
|
-
const path = site.specifier.replace(QUERY, "");
|
|
58
|
-
if (!RELATIVE.test(path)) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const request: ImportRequest = { kind: "import", line: site.line, specifier: site.specifier, type: site.type };
|
|
62
|
-
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
63
|
-
const local = target?.kind === "file" ? target.path : undefined;
|
|
64
|
-
if (registersAdmin(context.path, path, local)) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
if (!(leavesLexically(path) || (local !== undefined && posix.dirname(local) !== posix.dirname(context.path)))) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
const owner = local === undefined ? undefined : packageOf(context.packages, local);
|
|
71
|
-
const workspace = owner !== undefined && owner !== packageOf(context.packages, context.path) ? owner.name : undefined;
|
|
72
|
-
return { ...site, file: context.path, installed: target?.kind === "external" ? target.package : undefined, workspace };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export async function departures(inputs: RuleInputs): Promise<readonly Departure[]> {
|
|
76
|
-
const root = realpathSync(inputs.root);
|
|
77
|
-
const projectOf = projectsFor(root);
|
|
78
|
-
const packages = await workspacePackages(inputs);
|
|
79
|
-
return inputs.sources.flatMap((file) => {
|
|
80
|
-
const syntax = MAY_BE_RELATIVE.test(file.text) ? parse(file) : undefined;
|
|
81
|
-
if (syntax === undefined) {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
const from = posix.join(root, file.path);
|
|
85
|
-
const context = { from, packages, path: file.path, project: projectOf(from), root };
|
|
86
|
-
return specifierSites(syntax).flatMap((site) => departureAt(context, site) ?? []);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
13
|
+
export const departures = Effect.fn("Imports.departures")(function* (inputs: RuleInputs) {
|
|
14
|
+
const packages = yield* Effect.promise(() => workspacePackages(inputs));
|
|
15
|
+
const compiler = yield* ImportCompiler;
|
|
16
|
+
return yield* compiler.departures(inputs, packages);
|
|
17
|
+
}, Effect.provide(ImportCompiler.layer));
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
1
2
|
import { importGraph } from "#imports/graph.ts";
|
|
2
|
-
import type {
|
|
3
|
+
import type { RuleInputs } from "#rule.ts";
|
|
3
4
|
import { compilePolicy } from "./compilePolicy.ts";
|
|
4
5
|
import { discoverFences } from "./discover.ts";
|
|
5
6
|
import type { Fence } from "./model.ts";
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
const graph =
|
|
9
|
-
const fences = [...configured, ...(
|
|
8
|
+
export const checkFences = Effect.fn("Imports.checkFences")(function* (inputs: RuleInputs, configured: readonly Fence[]) {
|
|
9
|
+
const graph = yield* importGraph(inputs);
|
|
10
|
+
const fences = [...configured, ...(yield* Effect.promise(() => discoverFences(inputs, graph.packages)))];
|
|
10
11
|
const policy = compilePolicy(fences, { files: inputs.files, packages: graph.packages });
|
|
11
12
|
return policy.flatMap((compiled) => compiled.evaluate(graph));
|
|
12
|
-
}
|
|
13
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Endpoint } from "#imports/Endpoint.ts";
|
|
1
2
|
import type { ImportEdge } from "#imports/graph.ts";
|
|
2
3
|
import { packageNameOf } from "#imports/packageName.ts";
|
|
3
|
-
import type { Endpoint } from "#imports/resolve.ts";
|
|
4
4
|
import { type CompiledFence, compileFence, type FenceGraph } from "./evaluate.ts";
|
|
5
5
|
import type { PolicyScope } from "./match.ts";
|
|
6
6
|
import type { Chain, ExampleStep, Fence } from "./model.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Endpoint } from "#imports/Endpoint.ts";
|
|
1
2
|
import { builtinName, packageNameOf } from "#imports/packageName.ts";
|
|
2
|
-
import type { Endpoint } from "#imports/resolve.ts";
|
|
3
3
|
import { packageOf, type WorkspacePackage } from "#imports/workspace.ts";
|
|
4
4
|
import type { Selector } from "./model.ts";
|
|
5
5
|
|
package/src/imports/graph.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import ts from "typescript";
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ImportCompiler } from "#adapters/ImportCompiler.ts";
|
|
4
3
|
import type { Findings, RuleInputs, SourceFile } from "#rule.ts";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { type ImportKind, type ImportRequest, importsOf } from "./extract.ts";
|
|
8
|
-
import { type Project, projectsFor } from "./projects.ts";
|
|
9
|
-
import { type Endpoint, isDeclarationFile, presumedTarget, resolveImport } from "./resolve.ts";
|
|
4
|
+
import type { Endpoint } from "./Endpoint.ts";
|
|
5
|
+
import type { ImportKind } from "./extract.ts";
|
|
10
6
|
import { type WorkspacePackage, workspacePackages } from "./workspace.ts";
|
|
11
7
|
|
|
12
8
|
export interface ImportEdge {
|
|
@@ -28,61 +24,29 @@ export interface ImportGraph {
|
|
|
28
24
|
readonly unresolved: readonly UnresolvedImport[];
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
"the import graph covers no modules: the sources hold no TypeScript or JavaScript module. Point `sources` at the TypeScript or JavaScript code.";
|
|
35
|
-
|
|
36
|
-
function relativeTarget(from: string, request: ImportRequest): string | undefined {
|
|
37
|
-
const relative = request.kind === "path-reference" || request.specifier.startsWith("./") || request.specifier.startsWith("../");
|
|
38
|
-
return relative ? posix.join(posix.dirname(from), request.specifier.replace(QUERY, "")) : undefined;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// A relative import or a package import of a missing file still names a path, so fences see it before its generator writes it.
|
|
42
|
-
function missingTarget(root: string, from: string, request: ImportRequest, project: Project): string | undefined {
|
|
43
|
-
const target = presumedTarget(root, request, join(root, from), project) ?? relativeTarget(from, request);
|
|
44
|
-
return target === undefined || target.startsWith("../") ? undefined : target;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function walk(inputs: RuleInputs, root: string): Pick<ImportGraph, "configFindings" | "edges" | "modules" | "unresolved"> {
|
|
48
|
-
const projectOf = projectsFor(root);
|
|
49
|
-
const parsed = inputs.sources.flatMap((file) => {
|
|
50
|
-
const syntax = parse(file);
|
|
51
|
-
return syntax === undefined ? [] : [{ file, path: join(root, file.path), syntax }];
|
|
52
|
-
});
|
|
53
|
-
const ambient = ambientModules(parsed);
|
|
54
|
-
const edges: ImportEdge[] = [];
|
|
55
|
-
const unresolved: UnresolvedImport[] = [];
|
|
56
|
-
for (const { file, path, syntax } of parsed) {
|
|
57
|
-
const project = projectOf(path);
|
|
58
|
-
syntax.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, undefined, ts.sys, project.options);
|
|
59
|
-
for (const request of importsOf(syntax, isDeclarationFile(file.path), project.options)) {
|
|
60
|
-
const to = resolveImport(root, ambient, request, path, project);
|
|
61
|
-
if (to === undefined) {
|
|
62
|
-
const missing = missingTarget(root, file.path, request, project);
|
|
63
|
-
unresolved.push({ ...request, from: file.path, missing });
|
|
64
|
-
edges.push(...(missing === undefined ? [] : [{ ...request, from: file.path, to: { kind: "file" as const, path: missing } }]));
|
|
65
|
-
} else {
|
|
66
|
-
edges.push({ ...request, from: file.path, to });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return { configFindings: projectOf.findings, edges, modules: parsed.map(({ file }) => file.path), unresolved };
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async function build(inputs: RuleInputs): Promise<ImportGraph> {
|
|
74
|
-
const walked = walk(inputs, realpathSync(inputs.root));
|
|
27
|
+
const build = Effect.fn("Imports.build")(function* (inputs: RuleInputs) {
|
|
28
|
+
const compiler = yield* ImportCompiler;
|
|
29
|
+
const walked = yield* compiler.graph(inputs);
|
|
75
30
|
if (walked.modules.length === 0) {
|
|
76
|
-
|
|
31
|
+
return yield* Effect.die(
|
|
32
|
+
new Error(
|
|
33
|
+
"the import graph covers no modules: the sources hold no TypeScript or JavaScript module. Point `sources` at the TypeScript or JavaScript code.",
|
|
34
|
+
),
|
|
35
|
+
);
|
|
77
36
|
}
|
|
78
|
-
return { ...walked, packages:
|
|
79
|
-
}
|
|
37
|
+
return { ...walked, packages: yield* Effect.promise(() => workspacePackages(inputs)) };
|
|
38
|
+
});
|
|
80
39
|
|
|
81
|
-
|
|
40
|
+
type Graph = ReturnType<typeof build>;
|
|
41
|
+
const graphs = new WeakMap<readonly SourceFile[], Effect.Effect<ImportGraph, Effect.Error<Graph>>>();
|
|
82
42
|
|
|
83
43
|
// Import rules run on one scan, so they share the graph built from its sources.
|
|
84
|
-
export
|
|
85
|
-
const known = graphs.get(inputs.sources)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
44
|
+
export const importGraph = Effect.fn("Imports.importGraph")(function* (inputs: RuleInputs) {
|
|
45
|
+
const known = graphs.get(inputs.sources);
|
|
46
|
+
if (known !== undefined) {
|
|
47
|
+
return yield* known;
|
|
48
|
+
}
|
|
49
|
+
const graph = yield* Effect.cached(build(inputs).pipe(Effect.provide(ImportCompiler.layer)));
|
|
50
|
+
graphs.set(inputs.sources, graph);
|
|
51
|
+
return yield* graph;
|
|
52
|
+
});
|
package/src/inventory/collect.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, relative } from "node:path";
|
|
2
2
|
import { Effect, FileSystem } from "effect";
|
|
3
|
-
import
|
|
3
|
+
import { ignorePatterns } from "#adapters/ignore.ts";
|
|
4
4
|
import type { SetupFailure } from "#failure.ts";
|
|
5
5
|
import { manifestsIn } from "#manifests/sorted.ts";
|
|
6
6
|
import type { RuleServices, SourceFile } from "#rule.ts";
|
|
@@ -48,7 +48,7 @@ export const collectInventory = Effect.fn("Inventory.collectInventory")(function
|
|
|
48
48
|
root: string,
|
|
49
49
|
scope: InventoryScope,
|
|
50
50
|
): Effect.fn.Return<Inventory, FilesystemFailure | SetupFailure, RuleServices> {
|
|
51
|
-
const excluded =
|
|
51
|
+
const excluded = ignorePatterns([...scope.exclude]);
|
|
52
52
|
const toolOwned = new Set(yield* shadcnFiles(root));
|
|
53
53
|
const zones = yield* Effect.forEach(scope.sources, (zone) => zoneFiles(root, zone), { concurrency: READ_CONCURRENCY });
|
|
54
54
|
const relativePaths = zones.flat().map((absolute) => posix(relative(root, absolute)));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { dirname, relative, resolve } from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import { ignorePatterns } from "#adapters/ignore.ts";
|
|
3
3
|
|
|
4
4
|
export type Verdict = "ignored" | "kept" | "unknown";
|
|
5
5
|
|
|
6
6
|
interface IgnoreMatcher {
|
|
7
7
|
readonly base: string;
|
|
8
|
-
readonly rules: ReturnType<typeof
|
|
8
|
+
readonly rules: ReturnType<typeof ignorePatterns>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface IgnoreScope {
|
|
@@ -23,7 +23,7 @@ export function posix(path: string): string {
|
|
|
23
23
|
export function withIgnoreFile(scope: IgnoreScope, base: string, contents: string): IgnoreScope {
|
|
24
24
|
return {
|
|
25
25
|
boundary: scope.boundary,
|
|
26
|
-
matchers: [...scope.matchers, { base, rules:
|
|
26
|
+
matchers: [...scope.matchers, { base, rules: ignorePatterns(contents) }],
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -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 { RuleInputs } from "#rule.ts";
|
|
4
5
|
|
|
@@ -42,13 +43,19 @@ function runBy(directory: string, manifest: unknown): readonly string[] {
|
|
|
42
43
|
return [...commands, ...bins].map((target) => posix.join(directory, target));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
export
|
|
46
|
+
export const packageLayout = Effect.fn("Naming.packageLayout")(function* ({
|
|
47
|
+
files,
|
|
48
|
+
readText,
|
|
49
|
+
}: Pick<RuleInputs, "files" | "readText">): Effect.fn.Return<PackageLayout> {
|
|
46
50
|
const directories = ["", ...files.filter((path) => posix.basename(path) === MANIFEST).map((path) => posix.dirname(path))];
|
|
47
|
-
const manifests =
|
|
48
|
-
[...new Set(directories)]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const manifests = yield* Effect.forEach(
|
|
52
|
+
[...new Set(directories)],
|
|
53
|
+
(directory) =>
|
|
54
|
+
Effect.map(
|
|
55
|
+
Effect.promise(() => readPackageManifest(readText, directory === "" ? MANIFEST : `${directory}/${MANIFEST}`)),
|
|
56
|
+
(manifest) => ({ directory: directory === "." ? "" : directory, manifest }),
|
|
57
|
+
),
|
|
58
|
+
{ concurrency: "unbounded" },
|
|
52
59
|
);
|
|
53
60
|
const present = manifests.filter((entry) => entry.manifest !== undefined);
|
|
54
61
|
const roots = present.map((entry) => entry.directory).toSorted((left, right) => right.length - left.length);
|
|
@@ -62,4 +69,4 @@ export async function packageLayout({ files, readText }: Pick<RuleInputs, "files
|
|
|
62
69
|
names,
|
|
63
70
|
scripts: new Set(present.flatMap(({ directory, manifest }) => runBy(directory, manifest))),
|
|
64
71
|
};
|
|
65
|
-
}
|
|
72
|
+
});
|
package/src/naming/testName.ts
CHANGED
package/src/rule.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Effect,
|
|
1
|
+
import type { Effect, FileSystem } from "effect";
|
|
2
2
|
import type { ChildProcessSpawner } from "effect/process";
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
3
|
+
import { configureWith, noOptions, type RuleCheckResult, ruleConfiguration } from "#adapters/rule.ts";
|
|
4
|
+
import type { StandardSchemaV1 } from "#adapters/standardSchema.ts";
|
|
5
5
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
6
|
-
import { describeIssue, type StandardSchemaV1 } from "./standardSchema.ts";
|
|
7
6
|
|
|
8
7
|
export interface Finding {
|
|
9
8
|
readonly count?: number | undefined;
|
|
@@ -44,21 +43,25 @@ export type Configured<TServices = RuleServices> =
|
|
|
44
43
|
| { readonly _tag: "Invalid"; readonly issues: readonly string[] }
|
|
45
44
|
| { readonly _tag: "Ready"; readonly check: RuleCheck<TServices> };
|
|
46
45
|
|
|
47
|
-
export interface
|
|
48
|
-
// Bivariance keeps rules with different options in one list; configure validates its input at runtime.
|
|
49
|
-
configure: Bivariant<(options: TInput | undefined) => Promise<Configured<TServices>>>;
|
|
46
|
+
export interface RegisteredRule<TServices = RuleServices> {
|
|
50
47
|
readonly description: string;
|
|
51
48
|
readonly family?: boolean;
|
|
52
|
-
readonly id:
|
|
49
|
+
readonly id: string;
|
|
53
50
|
readonly registrable?: boolean;
|
|
51
|
+
readonly [ruleConfiguration]: (options: unknown) => Promise<Configured<TServices>>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Rule<TId extends string = string, TInput = unknown, TServices = RuleServices> extends RegisteredRule<TServices> {
|
|
55
|
+
readonly configure: (options: TInput | undefined) => Promise<Configured<TServices>>;
|
|
56
|
+
readonly id: TId;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
interface RuleDefinition<TId extends string, TOptions, TServices> {
|
|
57
|
-
readonly check: (context: RuleContext<TOptions
|
|
60
|
+
readonly check: (context: RuleContext<NoInfer<TOptions>>) => RuleCheckResult<TServices>;
|
|
58
61
|
readonly description: string;
|
|
59
62
|
readonly id: TId;
|
|
60
63
|
readonly registrable?: false;
|
|
61
|
-
readonly validate?: (context: RuleContext<TOptions
|
|
64
|
+
readonly validate?: (context: RuleContext<NoInfer<TOptions>>) => readonly string[];
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
interface RuleDefinitionWithOptions<TId extends string, TInput, TOptions, TServices> extends RuleDefinition<TId, TOptions, TServices> {
|
|
@@ -69,47 +72,6 @@ interface RuleDefinitionWithoutOptions<TId extends string, TServices> extends Ru
|
|
|
69
72
|
readonly options?: undefined;
|
|
70
73
|
}
|
|
71
74
|
|
|
72
|
-
const noOptions: StandardSchemaV1<undefined, undefined> = {
|
|
73
|
-
"~standard": {
|
|
74
|
-
validate: (value) => (value === undefined ? { value: undefined } : { issues: [{ message: "this rule takes no options" }] }),
|
|
75
|
-
vendor: "@shivaedev/quality",
|
|
76
|
-
version: 1,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
function configureWith<TInput, TOptions, TServices>(
|
|
81
|
-
schema: StandardSchemaV1<TInput, TOptions>,
|
|
82
|
-
check: RuleDefinition<string, TOptions, TServices>["check"],
|
|
83
|
-
id: string,
|
|
84
|
-
absent: unknown,
|
|
85
|
-
validate?: RuleDefinition<string, TOptions, TServices>["validate"],
|
|
86
|
-
) {
|
|
87
|
-
return async (options: unknown): Promise<Configured<TServices>> => {
|
|
88
|
-
const result = await schema["~standard"].validate(options ?? absent);
|
|
89
|
-
if (result.issues !== undefined) {
|
|
90
|
-
return { _tag: "Invalid", issues: result.issues.map(describeIssue) };
|
|
91
|
-
}
|
|
92
|
-
const value = result.value;
|
|
93
|
-
return {
|
|
94
|
-
_tag: "Ready",
|
|
95
|
-
check: (inputs) =>
|
|
96
|
-
Effect.scoped(
|
|
97
|
-
Effect.gen(function* () {
|
|
98
|
-
const context = { ...inputs, options: value };
|
|
99
|
-
const issues = validate?.(context).map((issue) => `rules.${id}.options: ${issue}`) ?? [];
|
|
100
|
-
yield* validOrFail(
|
|
101
|
-
inputs.configFile ?? "quality.config.ts",
|
|
102
|
-
issues.length === 0 ? { _tag: "Valid", value: undefined } : { _tag: "Invalid", issues },
|
|
103
|
-
);
|
|
104
|
-
const signal = yield* Effect.abortSignal;
|
|
105
|
-
const checked = check({ ...inputs, options: value, signal });
|
|
106
|
-
return yield* Effect.isEffect(checked) ? checked : Effect.promise(() => Promise.resolve(checked));
|
|
107
|
-
}),
|
|
108
|
-
),
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
75
|
export function defineRule<const TId extends string, TInput, TOptions, TServices = never>(
|
|
114
76
|
definition: RuleDefinitionWithOptions<TId, TInput, TOptions, TServices>,
|
|
115
77
|
): Rule<TId, TInput, TServices>;
|
|
@@ -123,5 +85,11 @@ export function defineRule<const TId extends string, TInput, TOptions, TServices
|
|
|
123
85
|
definition.options === undefined
|
|
124
86
|
? configureWith(noOptions, definition.check, definition.id, undefined, definition.validate)
|
|
125
87
|
: configureWith(definition.options, definition.check, definition.id, {}, definition.validate);
|
|
126
|
-
return {
|
|
88
|
+
return {
|
|
89
|
+
[ruleConfiguration]: configure,
|
|
90
|
+
configure,
|
|
91
|
+
description: definition.description,
|
|
92
|
+
id: definition.id,
|
|
93
|
+
registrable: definition.registrable ?? true,
|
|
94
|
+
};
|
|
127
95
|
}
|
package/src/rules/biome.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
+
import { PRESET, rootConfig } from "#adapters/biome/rootConfig.ts";
|
|
2
3
|
import { biomeReport, type Diagnostic, FAILING } from "#biome/report.ts";
|
|
3
4
|
import { withoutEntryPointImports } from "#biome/withoutEntryPointImports.ts";
|
|
4
5
|
import { defineRule, type Finding, type Rule, type RuleInputs } from "#rule.ts";
|
|
5
|
-
import { itemsOf, member, parseJsonc, textOf } from "#rules/suppressions/biome/json.ts";
|
|
6
|
-
|
|
7
|
-
export const PRESET = "@shivaedev/quality/biome/preset.json";
|
|
8
|
-
|
|
9
|
-
const ROOT_CONFIGS: readonly string[] = ["biome.json", "biome.jsonc"];
|
|
10
6
|
|
|
11
7
|
function messageOf(diagnostic: Diagnostic): string {
|
|
12
8
|
return diagnostic.category === "format" && diagnostic.message.startsWith("Formatter would have printed")
|
|
@@ -24,32 +20,19 @@ function findingOf(diagnostic: Diagnostic): Finding {
|
|
|
24
20
|
};
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
readonly path: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function rootConfig(readText: RuleInputs["readText"]): Promise<RootConfig> {
|
|
33
|
-
const texts = await Promise.all(ROOT_CONFIGS.map(async (path) => ({ path, text: await readText(path) })));
|
|
34
|
-
const found = texts.find((candidate) => candidate.text !== undefined);
|
|
35
|
-
const parsed = found?.text === undefined ? undefined : parseJsonc(found.path, found.text);
|
|
36
|
-
const extended = parsed?._tag === "Parsed" ? itemsOf(member(parsed.json, "extends")).map(textOf) : [];
|
|
37
|
-
return { extendsPreset: extended.includes(PRESET), path: found?.path ?? "biome.json" };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function presetFinding(readText: RuleInputs["readText"]): Promise<readonly Finding[]> {
|
|
41
|
-
const { extendsPreset, path } = await rootConfig(readText);
|
|
23
|
+
const presetFinding = Effect.fn("Biome.presetFinding")(function* (inputs: Pick<RuleInputs, "readText">) {
|
|
24
|
+
const { extendsPreset, path } = yield* Effect.promise(() => rootConfig(inputs.readText));
|
|
42
25
|
return extendsPreset ? [] : [{ file: path, message: `Extend "${PRESET}" from the root Biome config.`, subject: "preset" }];
|
|
43
|
-
}
|
|
26
|
+
});
|
|
44
27
|
|
|
45
28
|
const bridge = defineRule({
|
|
46
29
|
check: ({ exceptions, readText, root }) =>
|
|
47
30
|
Effect.gen(function* () {
|
|
48
|
-
const [preset, report] = yield* Effect.all([
|
|
31
|
+
const [preset, report] = yield* Effect.all([presetFinding({ readText }), biomeReport(root, ["check"], exceptions)], {
|
|
49
32
|
concurrency: "unbounded",
|
|
50
33
|
});
|
|
51
34
|
const failing = report.diagnostics.filter((diagnostic) => FAILING.has(diagnostic.severity));
|
|
52
|
-
return [...preset, ...(yield*
|
|
35
|
+
return [...preset, ...(yield* withoutEntryPointImports({ readText }, failing)).map(findingOf)];
|
|
53
36
|
}),
|
|
54
37
|
description:
|
|
55
38
|
"Biome's lint, format and assist findings under the shared preset, except undeclared-dependency findings for a piece that an application's entry point brings. `quality fix` applies Biome's lint fixes, unsafe ones included, its assist actions and formatting.",
|
package/src/rules/builtIn.ts
CHANGED
|
@@ -7,9 +7,12 @@ import { noPrReference } from "#rules/comments/noPrReference.ts";
|
|
|
7
7
|
import { noTodo } from "#rules/comments/noTodo.ts";
|
|
8
8
|
import { docsReferences } from "#rules/docs/references.ts";
|
|
9
9
|
import { docsUnversionedInstalls } from "#rules/docs/unversionedInstalls.ts";
|
|
10
|
+
import { adapterImports } from "#rules/effect/adapterImports.ts";
|
|
10
11
|
import { effectBoundary } from "#rules/effect/boundary.ts";
|
|
11
12
|
import { failureHonesty } from "#rules/effect/failureHonesty.ts";
|
|
13
|
+
import { serviceIds } from "#rules/effect/serviceIds.ts";
|
|
12
14
|
import { serviceParameters } from "#rules/effect/serviceParameters.ts";
|
|
15
|
+
import { sharedErrorClasses } from "#rules/effect/sharedErrorClasses.ts";
|
|
13
16
|
import { distinctCase } from "#rules/files/distinctCase.ts";
|
|
14
17
|
import { folderNames } from "#rules/files/folderNames.ts";
|
|
15
18
|
import { namedAfterExport } from "#rules/files/namedAfterExport.ts";
|
|
@@ -23,15 +26,18 @@ import { noTestCode } from "#rules/imports/noTestCode.ts";
|
|
|
23
26
|
import { importsResolvable } from "#rules/imports/resolvable.ts";
|
|
24
27
|
import { importsRuntime } from "#rules/imports/runtime.ts";
|
|
25
28
|
import { jsxConditionals } from "#rules/react/jsxConditionals.ts";
|
|
29
|
+
import { adapterOnlyFakes } from "#rules/stories/adapterOnlyFakes.ts";
|
|
26
30
|
import { authSql } from "#rules/stories/authSql.ts";
|
|
27
31
|
import { domainOutcomes } from "#rules/stories/domainOutcomes.ts";
|
|
28
32
|
import { storyEngine } from "#rules/stories/engine.ts";
|
|
29
33
|
import { globalRetries } from "#rules/stories/globalRetries.ts";
|
|
30
34
|
import { groupedOutcomes } from "#rules/stories/groupedOutcomes.ts";
|
|
31
35
|
import { httpStatus } from "#rules/stories/httpStatus.ts";
|
|
36
|
+
import { importedChangeKeys } from "#rules/stories/importedChangeKeys.ts";
|
|
32
37
|
import { namedValues } from "#rules/stories/namedValues.ts";
|
|
33
38
|
import { noExpect } from "#rules/stories/noExpect.ts";
|
|
34
39
|
import { noLimitImports } from "#rules/stories/noLimitImports.ts";
|
|
40
|
+
import { queueReadouts } from "#rules/stories/queueReadouts.ts";
|
|
35
41
|
import { queueSql } from "#rules/stories/queueSql.ts";
|
|
36
42
|
import { storySetup } from "#rules/stories/setup.ts";
|
|
37
43
|
import { specHelpers } from "#rules/stories/specHelpers.ts";
|
|
@@ -57,9 +63,12 @@ import { unusedCode } from "./unusedCode.ts";
|
|
|
57
63
|
|
|
58
64
|
export const builtInRules = [
|
|
59
65
|
unusedCode,
|
|
66
|
+
adapterImports,
|
|
60
67
|
effectBoundary,
|
|
61
68
|
failureHonesty,
|
|
69
|
+
serviceIds,
|
|
62
70
|
serviceParameters,
|
|
71
|
+
sharedErrorClasses,
|
|
63
72
|
jsxConditionals,
|
|
64
73
|
maxLines,
|
|
65
74
|
maxDepth,
|
|
@@ -100,9 +109,12 @@ export const builtInRules = [
|
|
|
100
109
|
testsColocated,
|
|
101
110
|
storySetup,
|
|
102
111
|
storySpecs,
|
|
112
|
+
adapterOnlyFakes,
|
|
103
113
|
globalRetries,
|
|
104
114
|
storyEngine,
|
|
105
115
|
queueSql,
|
|
116
|
+
queueReadouts,
|
|
117
|
+
importedChangeKeys,
|
|
106
118
|
authSql,
|
|
107
119
|
noExpect,
|
|
108
120
|
specHelpers,
|