@shivaedev/quality 0.56.0 → 0.57.1
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 +41 -0
- package/README.md +63 -4
- package/biome/plugins/effect-test-bodies.grit +1 -1
- 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/executable.d.ts +3 -0
- package/dist/adapters/executable.d.ts.map +1 -0
- package/dist/adapters/executable.js +14 -0
- package/dist/adapters/executable.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/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/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/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/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/baseline/cleanupMergeFiles.d.ts.map +1 -1
- package/dist/baseline/cleanupMergeFiles.js +3 -2
- package/dist/baseline/cleanupMergeFiles.js.map +1 -1
- package/dist/baseline/shards.d.ts.map +1 -1
- package/dist/baseline/shards.js +4 -2
- package/dist/baseline/shards.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/recommendedRules.d.ts.map +1 -1
- package/dist/biome/recommendedRules.js +3 -2
- package/dist/biome/recommendedRules.js.map +1 -1
- package/dist/biome/report.d.ts.map +1 -1
- package/dist/biome/report.js +3 -2
- package/dist/biome/report.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/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +3 -2
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +3 -2
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/fixRule.d.ts.map +1 -1
- package/dist/cli/fixRule.js +4 -3
- package/dist/cli/fixRule.js.map +1 -1
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +2 -2
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/migrateBaseline.d.ts.map +1 -1
- package/dist/cli/migrateBaseline.js +3 -2
- package/dist/cli/migrateBaseline.js.map +1 -1
- package/dist/cli/migrateExceptions.d.ts.map +1 -1
- package/dist/cli/migrateExceptions.js +3 -2
- package/dist/cli/migrateExceptions.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 +6 -36
- package/dist/config/load.js.map +1 -1
- package/dist/domEnvironment.config.js +1 -1
- package/dist/domEnvironment.config.js.map +1 -1
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +3 -2
- package/dist/engine/session.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/hooks/install.d.ts.map +1 -1
- package/dist/hooks/install.js +4 -2
- package/dist/hooks/install.js.map +1 -1
- package/dist/hooks/location.d.ts.map +1 -1
- package/dist/hooks/location.js +3 -2
- package/dist/hooks/location.js.map +1 -1
- package/dist/hooks/preCommit.d.ts.map +1 -1
- package/dist/hooks/preCommit.js +3 -2
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/hooks/setup.d.ts.map +1 -1
- package/dist/hooks/setup.js +3 -2
- package/dist/hooks/setup.js.map +1 -1
- package/dist/hooks/status.d.ts.map +1 -1
- package/dist/hooks/status.js +5 -15
- package/dist/hooks/status.js.map +1 -1
- package/dist/hooks/uninstall.d.ts.map +1 -1
- package/dist/hooks/uninstall.js +3 -2
- package/dist/hooks/uninstall.js.map +1 -1
- package/dist/inventory/collect.js +2 -2
- package/dist/inventory/collect.js.map +1 -1
- package/dist/inventory/filesystem.d.ts.map +1 -1
- package/dist/inventory/filesystem.js +3 -2
- package/dist/inventory/filesystem.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/inventory/shadcnFolders.d.ts.map +1 -1
- package/dist/inventory/shadcnFolders.js +4 -2
- package/dist/inventory/shadcnFolders.js.map +1 -1
- package/dist/inventory/trackedPaths.d.ts.map +1 -1
- package/dist/inventory/trackedPaths.js +4 -2
- package/dist/inventory/trackedPaths.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/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 +2 -2
- 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/manifest.d.ts.map +1 -1
- package/dist/rules/imports/manifest.js +9 -6
- package/dist/rules/imports/manifest.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/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/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/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/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/suppressions/noIgnoreDeprecations.d.ts.map +1 -1
- package/dist/rules/suppressions/noIgnoreDeprecations.js +3 -2
- package/dist/rules/suppressions/noIgnoreDeprecations.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/assertThat.d.ts +5 -0
- package/dist/testing/adapters/assertThat.d.ts.map +1 -0
- package/dist/testing/adapters/assertThat.js +9 -0
- package/dist/testing/adapters/assertThat.js.map +1 -0
- 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 -2
- 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/executable.ts +14 -0
- package/src/adapters/ignore.ts +16 -0
- package/src/adapters/imports/fakeReferences.ts +115 -0
- package/src/adapters/imports/fakeTargets.ts +21 -0
- 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/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/baseline/cleanupMergeFiles.ts +4 -2
- package/src/baseline/shards.ts +6 -2
- package/src/biome/exceptionConfig.ts +0 -43
- package/src/biome/recognizeDiagnostics.ts +2 -1
- package/src/biome/recommendedRules.ts +4 -2
- package/src/biome/report.ts +4 -2
- package/src/biome/syntax.ts +0 -10
- package/src/biome/withoutEntryPointImports.ts +15 -10
- package/src/cli/baseline.ts +4 -2
- package/src/cli/fix.ts +4 -2
- package/src/cli/fixRule.ts +5 -3
- package/src/cli/lint.ts +3 -2
- package/src/cli/migrateBaseline.ts +4 -2
- package/src/cli/migrateExceptions.ts +4 -2
- package/src/config/globs.ts +1 -6
- package/src/config/load.ts +8 -38
- package/src/domEnvironment.config.ts +1 -1
- package/src/engine/session.ts +4 -2
- package/src/exceptions/biomeFindings.ts +11 -10
- package/src/hooks/install.ts +6 -2
- package/src/hooks/location.ts +4 -2
- package/src/hooks/preCommit.ts +4 -2
- package/src/hooks/setup.ts +4 -2
- package/src/hooks/status.ts +7 -15
- package/src/hooks/uninstall.ts +4 -2
- package/src/inventory/collect.ts +2 -2
- package/src/inventory/filesystem.ts +4 -2
- package/src/inventory/ignoreScope.ts +3 -3
- package/src/inventory/shadcnFolders.ts +6 -2
- package/src/inventory/trackedPaths.ts +6 -2
- package/src/naming/packageLayout.ts +14 -7
- package/src/naming/testName.ts +1 -1
- 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 +2 -2
- 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/manifest.ts +14 -8
- 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/fakeImplementation.ts +23 -0
- package/src/rules/stories/fakeReplacements.ts +74 -0
- package/src/rules/stories/importOrigin.ts +2 -2
- package/src/rules/stories/importedChangeKeys.ts +10 -0
- package/src/rules/stories/pureNetImport.ts +29 -0
- package/src/rules/stories/queueReadouts.ts +9 -0
- 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/suppressions/noIgnoreDeprecations.ts +4 -2
- package/src/rules/test-names/colocated.ts +2 -2
- package/src/rules/test-names/follow.ts +4 -4
- package/src/testing/adapters/assertThat.ts +12 -0
- 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/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/{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/src/{biome → adapters/biome}/relocateConfig.ts +0 -0
- /package/src/{rules/suppressions → adapters}/biome/resolvePackage.ts +0 -0
package/src/config/load.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, type FileSystem, Path, Schema } from "effect";
|
|
3
|
+
import { readConfig } from "#adapters/readConfig.ts";
|
|
4
4
|
import { validOrFail } from "#decoded.ts";
|
|
5
5
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
6
|
-
import { SetupFailure } from "#failure.ts";
|
|
6
|
+
import type { SetupFailure } from "#failure.ts";
|
|
7
7
|
import type { InventoryScope } from "#inventory/collect.ts";
|
|
8
8
|
import { ConsumerDeclaration } from "#rules/suppressions/biome/ConsumerDeclaration.ts";
|
|
9
9
|
import type { Declaration } from "#rules/suppressions/biome/declarations.ts";
|
|
10
|
-
import {
|
|
10
|
+
import { DEFAULT_EXTENSIONS } from "./constants.ts";
|
|
11
11
|
import { type ConfigInput, decodeConfig } from "./decode.ts";
|
|
12
12
|
import { type ResolvedRules, resolveRules } from "./resolve.ts";
|
|
13
13
|
|
|
@@ -20,23 +20,6 @@ export interface ResolvedConfig extends ResolvedRules, InventoryScope {
|
|
|
20
20
|
readonly root: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function messageOf(cause: unknown): string {
|
|
24
|
-
return cause instanceof Error ? cause.message : String(cause);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function importDefault(file: string): Effect.Effect<unknown, SetupFailure> {
|
|
28
|
-
return Effect.flatMap(
|
|
29
|
-
Effect.tryPromise({
|
|
30
|
-
catch: (cause) => new SetupFailure({ cause, message: `cannot load ${file}: ${messageOf(cause)}` }),
|
|
31
|
-
try: async (): Promise<unknown> => import(pathToFileURL(file).href),
|
|
32
|
-
}),
|
|
33
|
-
(loaded) =>
|
|
34
|
-
typeof loaded === "object" && loaded !== null && "default" in loaded
|
|
35
|
-
? Effect.succeed(loaded.default)
|
|
36
|
-
: Effect.fail(new SetupFailure({ message: `${file} has no default export. Export defineConfig({ ... }) as the default.` })),
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
23
|
const LegacyOptions = Schema.Struct({ declared: Schema.Array(ConsumerDeclaration) });
|
|
41
24
|
function biomeDeclarations(config: ConfigInput): readonly Declaration[] {
|
|
42
25
|
const setting = config.rules?.["suppressions/biome-overrides"];
|
|
@@ -63,22 +46,9 @@ export const loadConfig = Effect.fn("Config.loadConfig")(function* (
|
|
|
63
46
|
cwd: string,
|
|
64
47
|
path: string | undefined,
|
|
65
48
|
): Effect.fn.Return<ResolvedConfig, SetupFailure, FileSystem.FileSystem> {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
.readDirectory(dirname(file))
|
|
70
|
-
.pipe(
|
|
71
|
-
Effect.catchTag("PlatformError", (error) =>
|
|
72
|
-
error.reason._tag === "NotFound"
|
|
73
|
-
? Effect.succeed<string[]>([])
|
|
74
|
-
: Effect.fail(new SetupFailure({ cause: error, message: `cannot inspect ${file}: ${error.message}` })),
|
|
75
|
-
),
|
|
76
|
-
);
|
|
77
|
-
const present = entries.includes(basename(file));
|
|
78
|
-
if (!present && path !== undefined) {
|
|
79
|
-
return yield* new SetupFailure({ message: `no config at ${file}. Check the --config path.` });
|
|
80
|
-
}
|
|
81
|
-
const loaded = present ? yield* importDefault(file) : {};
|
|
49
|
+
const { dirname } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
50
|
+
|
|
51
|
+
const { file, loaded } = yield* readConfig(cwd, path);
|
|
82
52
|
const config = yield* validOrFail(file, yield* Effect.promise(() => decodeConfig(loaded)));
|
|
83
53
|
const rules = yield* validOrFail(file, yield* resolveRules(config));
|
|
84
54
|
return resolved(dirname(file), file, config, rules);
|
|
@@ -7,7 +7,7 @@ import type { Environment } from "vitest/runtime";
|
|
|
7
7
|
// Resolve the DOM plugin from the consumer; depending on test-story would cycle through its Quality tooling.
|
|
8
8
|
const consumer = createRequire(join(process.cwd(), "package.json"));
|
|
9
9
|
const { default: environment }: { readonly default: Environment } = await import(
|
|
10
|
-
pathToFileURL(consumer.resolve("@shivaedev/test-story/server/domEnvironment.config.ts")).href
|
|
10
|
+
pathToFileURL(consumer.resolve("@shivaedev/test-story/server/adapters/domEnvironment.config.ts")).href
|
|
11
11
|
);
|
|
12
12
|
|
|
13
13
|
export default environment;
|
package/src/engine/session.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect, type Scope } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, Path, type Scope } from "effect";
|
|
3
3
|
import { setManifestFiles } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
5
5
|
import { loadConfig, type ResolvedConfig } from "#config/load.ts";
|
|
@@ -31,6 +31,8 @@ function setup<TValue, TRequirements>(effect: Effect.Effect<TValue, Error, TRequ
|
|
|
31
31
|
export const scan = Effect.fn("Engine.scan")(function* (
|
|
32
32
|
config: ResolvedConfig,
|
|
33
33
|
): Effect.fn.Return<Pick<Session, "inventory" | "staleRegistry" | "violations">, SetupFailure, RuleServices | Scope.Scope> {
|
|
34
|
+
const { relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
35
|
+
|
|
34
36
|
const inventory = yield* setup(collectInventory(config.root, config));
|
|
35
37
|
const readText = yield* manifestReader(config.root);
|
|
36
38
|
setManifestFiles(readText, inventory.manifestFiles);
|
|
@@ -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}`] };
|
package/src/hooks/install.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Console, Effect, FileSystem } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Console, Effect, FileSystem, Path } from "effect";
|
|
3
3
|
import { CONFIG_FILE } from "#config/constants.ts";
|
|
4
4
|
import { loadConfig } from "#config/load.ts";
|
|
5
5
|
import { SetupFailure } from "#failure.ts";
|
|
@@ -28,6 +28,8 @@ const realPath = Effect.fnUntraced(function* (path: string) {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
const write = Effect.fnUntraced(function* (file: string, text: string) {
|
|
31
|
+
const { dirname } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
32
|
+
|
|
31
33
|
const fs = yield* FileSystem.FileSystem;
|
|
32
34
|
yield* fs.makeDirectory(dirname(file), { recursive: true }).pipe(
|
|
33
35
|
Effect.andThen(fs.writeFileString(file, text)),
|
|
@@ -37,6 +39,8 @@ const write = Effect.fnUntraced(function* (file: string, text: string) {
|
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
export const installHook = Effect.fn("Hooks.installHook")(function* (install: HookInstall) {
|
|
42
|
+
const { basename, dirname, join, relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
43
|
+
|
|
40
44
|
const config = yield* loadConfig(install.cwd, install.config);
|
|
41
45
|
const location = yield* hookLocation(config.root);
|
|
42
46
|
const root = yield* realPath(config.root);
|
package/src/hooks/location.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, Path } from "effect";
|
|
3
3
|
import { SetupFailure } from "#failure.ts";
|
|
4
4
|
import { run } from "#git/command.ts";
|
|
5
5
|
|
|
@@ -11,6 +11,8 @@ export interface HookLocation {
|
|
|
11
11
|
|
|
12
12
|
// Hooks live in the common git directory, which every worktree of the repository shares.
|
|
13
13
|
export const hookLocation = Effect.fn("Hooks.hookLocation")(function* (cwd: string) {
|
|
14
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
15
|
+
|
|
14
16
|
const paths = yield* run(cwd, ["rev-parse", "--path-format=absolute", "--show-toplevel", "--git-common-dir"]);
|
|
15
17
|
const [toplevel, common] = paths.stdout.trim().split("\n");
|
|
16
18
|
if (paths.code !== 0 || toplevel === undefined || common === undefined) {
|
package/src/hooks/preCommit.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Console, Effect } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Console, Effect, Path } from "effect";
|
|
3
3
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
4
|
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
5
5
|
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
@@ -11,6 +11,8 @@ const COMMIT_AGAIN =
|
|
|
11
11
|
"help: fix what the output above reports, then commit again; `quality hooks pre-commit` repeats these checks without committing.";
|
|
12
12
|
|
|
13
13
|
const commitScripts = Effect.fnUntraced(function* (root: string) {
|
|
14
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
15
|
+
|
|
14
16
|
const file = join(root, "package.json");
|
|
15
17
|
const readText = yield* manifestReader(root);
|
|
16
18
|
const manifest = yield* Effect.tryPromise({
|
package/src/hooks/setup.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect, FileSystem } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, FileSystem, Path } from "effect";
|
|
3
3
|
import { type HookInstall, installHook } from "./install.ts";
|
|
4
4
|
|
|
5
5
|
export const setupHook = Effect.fn("Hooks.setupHook")(function* (options: Omit<HookInstall, "force">) {
|
|
6
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
7
|
+
|
|
6
8
|
const fs = yield* FileSystem.FileSystem;
|
|
7
9
|
if (yield* fs.exists(join(options.cwd, ".git"))) {
|
|
8
10
|
yield* installHook({ ...options, force: false });
|
package/src/hooks/status.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Console, Effect } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Console, Effect, Path } from "effect";
|
|
3
|
+
import { executable } from "#adapters/executable.ts";
|
|
5
4
|
import { GateFailed, SetupFailure } from "#failure.ts";
|
|
6
5
|
import { gitOrFail } from "#git/command.ts";
|
|
7
6
|
import { readOptionalText } from "#inventory/filesystem.ts";
|
|
@@ -9,18 +8,9 @@ import { forwardingPath, globalHooksPath } from "./forwarding.ts";
|
|
|
9
8
|
import { type HookLocation, hookLocation } from "./location.ts";
|
|
10
9
|
import { isHookShim } from "./shim.ts";
|
|
11
10
|
|
|
12
|
-
function executable(file: string) {
|
|
13
|
-
return Effect.promise(async () => {
|
|
14
|
-
try {
|
|
15
|
-
await access(file, constants.X_OK);
|
|
16
|
-
return await realpath(file);
|
|
17
|
-
} catch {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
11
|
export const globalHookStatus = Effect.fn("Hooks.globalHookStatus")(function* (location: HookLocation) {
|
|
12
|
+
const { resolve } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
13
|
+
|
|
24
14
|
const path = yield* globalHooksPath(location.toplevel);
|
|
25
15
|
const hook = resolve(location.toplevel, path, "pre-commit");
|
|
26
16
|
const target = path === "" ? undefined : yield* executable(hook);
|
|
@@ -33,6 +23,8 @@ export const globalHookStatus = Effect.fn("Hooks.globalHookStatus")(function* (l
|
|
|
33
23
|
});
|
|
34
24
|
|
|
35
25
|
export const hookStatus = Effect.fn("Hooks.hookStatus")(function* (cwd: string) {
|
|
26
|
+
const { dirname, resolve } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
27
|
+
|
|
36
28
|
const location = yield* hookLocation(cwd);
|
|
37
29
|
const path = (yield* gitOrFail(cwd, ["rev-parse", "--path-format=absolute", "--git-path", "hooks/pre-commit"])).trim();
|
|
38
30
|
const text = yield* readOptionalText(path).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })));
|
package/src/hooks/uninstall.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Console, Effect, FileSystem } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Console, Effect, FileSystem, Path } from "effect";
|
|
3
3
|
import { SetupFailure } from "#failure.ts";
|
|
4
4
|
import { gitOrFail, run } from "#git/command.ts";
|
|
5
5
|
import { readOptionalText } from "#inventory/filesystem.ts";
|
|
@@ -8,6 +8,8 @@ import { hookLocation } from "./location.ts";
|
|
|
8
8
|
import { isHookShim } from "./shim.ts";
|
|
9
9
|
|
|
10
10
|
export const uninstallHook = Effect.fn("Hooks.uninstallHook")(function* (cwd: string) {
|
|
11
|
+
const { dirname } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
12
|
+
|
|
11
13
|
const fs = yield* FileSystem.FileSystem;
|
|
12
14
|
const { file } = yield* hookLocation(cwd);
|
|
13
15
|
const existing = yield* Effect.mapError(readOptionalText(file), (failure) => new SetupFailure({ cause: failure, message: failure.message }));
|
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,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Data, Effect, FileSystem } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Data, Effect, FileSystem, Path } from "effect";
|
|
3
3
|
import type { PlatformError } from "effect/PlatformError";
|
|
4
4
|
|
|
5
5
|
export class FilesystemFailure extends Data.TaggedError("FilesystemFailure")<{
|
|
@@ -41,6 +41,8 @@ export const writeText = Effect.fn("Inventory.writeText")(function* (
|
|
|
41
41
|
path: string,
|
|
42
42
|
text: string,
|
|
43
43
|
): Effect.fn.Return<void, FilesystemFailure, FileSystem.FileSystem> {
|
|
44
|
+
const { dirname } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
45
|
+
|
|
44
46
|
const fs = yield* FileSystem.FileSystem;
|
|
45
47
|
const written = Effect.andThen(fs.makeDirectory(dirname(path), { recursive: true }), fs.writeFileString(path, text));
|
|
46
48
|
return yield* Effect.mapError(written, (error) => new FilesystemFailure({ message: `cannot write ${path}: ${error.message}`, path }));
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, Path, Schema } from "effect";
|
|
3
3
|
import type { SetupFailure } from "#failure.ts";
|
|
4
4
|
import type { RuleServices } from "#rule.ts";
|
|
5
5
|
import { FilesystemFailure, readRequiredText } from "./filesystem.ts";
|
|
@@ -12,9 +12,13 @@ const Components = Schema.fromJsonString(Schema.Struct({ aliases: Schema.Struct(
|
|
|
12
12
|
export const shadcnFolders = Effect.fn("Inventory.shadcnFolders")(function* (
|
|
13
13
|
root: string,
|
|
14
14
|
): Effect.fn.Return<readonly string[], FilesystemFailure | SetupFailure, RuleServices> {
|
|
15
|
+
const { basename } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
16
|
+
|
|
15
17
|
const paths = (yield* walk(root)).filter((path) => basename(path) === "components.json");
|
|
16
18
|
return yield* Effect.forEach(paths, (path) =>
|
|
17
19
|
Effect.gen(function* () {
|
|
20
|
+
const { dirname, relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
21
|
+
|
|
18
22
|
const text = yield* readRequiredText(path);
|
|
19
23
|
return yield* Effect.try({
|
|
20
24
|
catch: (cause) => new FilesystemFailure({ message: `cannot resolve ${path}: ${String(cause)}`, path }),
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Effect } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, Path } from "effect";
|
|
3
3
|
import { SetupFailure } from "#failure.ts";
|
|
4
4
|
import { run } from "#git/command.ts";
|
|
5
5
|
|
|
6
6
|
const listedPaths = Effect.fn("Inventory.listedPaths")(function* (directory: string, options: readonly string[], path = ".") {
|
|
7
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
8
|
+
|
|
7
9
|
const result = yield* run(directory, ["ls-files", "-z", ...options, "--", path]);
|
|
8
10
|
if (result.code !== 0) {
|
|
9
11
|
if (result.stderr.includes("not a git repository")) {
|
|
@@ -26,6 +28,8 @@ export const ignoredTrackedPaths = Effect.fn("Inventory.ignoredTrackedPaths")(fu
|
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
export const ignoredPaths = Effect.fn("Inventory.ignoredPaths")(function* (directory: string) {
|
|
31
|
+
const { resolve } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
32
|
+
|
|
29
33
|
const paths = yield* listedPaths(directory, ["--others", "--ignored", "--exclude-standard", "--directory"]);
|
|
30
34
|
return paths?.map((path) => resolve(path));
|
|
31
35
|
});
|
|
@@ -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/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,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { outsideImportFindings } from "#adapters/outsideImportFindings.ts";
|
|
2
|
+
import { defineRule } from "#rule.ts";
|
|
3
|
+
|
|
4
|
+
export const adapterImports = defineRule({
|
|
5
|
+
check: outsideImportFindings,
|
|
6
|
+
description:
|
|
7
|
+
"Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, workspace modules, test-support/ kits, Effect and @shivaedev packages and React in client/ folders are accepted. Move integrations into adapters/ and expose Effect values. No config exceptions or inline suppressions; baseline existing debt.",
|
|
8
|
+
id: "effect/adapter-imports",
|
|
9
|
+
registrable: false,
|
|
10
|
+
});
|
|
@@ -3,7 +3,7 @@ import ts from "typescript";
|
|
|
3
3
|
import { projectsFor } from "#adapters/imports/projects.ts";
|
|
4
4
|
import type { RuleInputs } from "#rule.ts";
|
|
5
5
|
|
|
6
|
-
export function effectProgram(inputs: RuleInputs, externalTypes = true): ts.Program {
|
|
6
|
+
export function effectProgram(inputs: RuleInputs, externalTypes = true, roots: readonly string[] = []): ts.Program {
|
|
7
7
|
const projectOf = projectsFor(inputs.root);
|
|
8
8
|
const options: ts.CompilerOptions = {
|
|
9
9
|
allowJs: true,
|
|
@@ -25,5 +25,5 @@ export function effectProgram(inputs: RuleInputs, externalTypes = true): ts.Prog
|
|
|
25
25
|
const project = projectOf(from);
|
|
26
26
|
return ts.resolveModuleName(name, from, project.typesOptions, host, project.typesCache).resolvedModule;
|
|
27
27
|
});
|
|
28
|
-
return ts.createProgram([...texts.keys()], options, host);
|
|
28
|
+
return ts.createProgram([...texts.keys(), ...roots], options, host);
|
|
29
29
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { serviceIdFindings } from "#adapters/serviceIdFindings.ts";
|
|
2
|
+
import { defineRule } from "#rule.ts";
|
|
3
|
+
|
|
4
|
+
export const serviceIds = defineRule({
|
|
5
|
+
check: serviceIdFindings,
|
|
6
|
+
description:
|
|
7
|
+
"Literal Context.Service, Context.Reference, defineService and RPC middleware ids in packages/<name>/ start with @shivaedev/<name>/. Prefix the id and update its references. Includes adapters and tests; computed ids and files outside packages/ are not checked. No config exceptions or inline suppressions.",
|
|
8
|
+
id: "effect/service-ids",
|
|
9
|
+
registrable: false,
|
|
10
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { sharedErrorFindings } from "#adapters/sharedErrorFindings.ts";
|
|
2
|
+
import { defineRule } from "#rule.ts";
|
|
3
|
+
|
|
4
|
+
export const sharedErrorClasses = defineRule({
|
|
5
|
+
check: sharedErrorFindings,
|
|
6
|
+
description:
|
|
7
|
+
"A tagged error with a tag exported by @shivaedev/errors must use that exported class. Import the shared class instead of declaring another error or subclass with its tag.",
|
|
8
|
+
id: "effect/shared-error-classes",
|
|
9
|
+
registrable: false,
|
|
10
|
+
});
|