@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import type { Finding, RuleInputs } from "#rule.ts";
|
|
5
|
+
import { boundaryReference } from "#rules/effect/boundaryReference.ts";
|
|
6
|
+
|
|
7
|
+
function definitionId(node: ts.Expression | undefined): ts.Expression | undefined {
|
|
8
|
+
if (node === undefined || !ts.isObjectLiteralExpression(node)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const property = node.properties.find(
|
|
12
|
+
(member) => ts.isPropertyAssignment(member) && (ts.isIdentifier(member.name) || ts.isStringLiteralLike(member.name)) && member.name.text === "id",
|
|
13
|
+
);
|
|
14
|
+
return property !== undefined && ts.isPropertyAssignment(property) ? property.initializer : undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function literalId(checker: ts.TypeChecker, call: ts.CallExpression, ownPackage: boolean): ts.StringLiteralLike | undefined {
|
|
18
|
+
const callee = ts.isCallExpression(call.expression) && call.expression.arguments.length === 0 ? call.expression.expression : call.expression;
|
|
19
|
+
const reference = boundaryReference(checker, callee) ?? "";
|
|
20
|
+
let id = call.arguments[0];
|
|
21
|
+
if (
|
|
22
|
+
(ownPackage && reference === "#defineService.ts.defineService")
|
|
23
|
+
|| /^@shivaedev\/service\/defineService(?:\.ts)?\.defineService$/u.test(reference)
|
|
24
|
+
) {
|
|
25
|
+
id = definitionId(id);
|
|
26
|
+
} else if (
|
|
27
|
+
!(
|
|
28
|
+
/^effect(?:\.Context|\/Context)\.(?:Service|Reference)$/u.test(reference)
|
|
29
|
+
|| /^(?:effect\/(?:unstable\/)?rpc(?:\.RpcMiddleware|\/RpcMiddleware)|@effect\/rpc(?:\.RpcMiddleware|\/RpcMiddleware))\.(?:Service|Tag)$/u.test(
|
|
30
|
+
reference,
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
return id !== undefined && ts.isStringLiteralLike(id) ? id : undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function checkPackage(inputs: RuleInputs, prefix: string): readonly Finding[] {
|
|
40
|
+
const texts = new Map(inputs.sources.map((file) => [join(inputs.root, file.path), file.text]));
|
|
41
|
+
const options: ts.CompilerOptions = { allowJs: true, noLib: true, noResolve: true, target: ts.ScriptTarget.Latest };
|
|
42
|
+
const host = ts.createCompilerHost(options);
|
|
43
|
+
host.readFile = (path) => texts.get(path);
|
|
44
|
+
const program = ts.createProgram([...texts.keys()], options, host);
|
|
45
|
+
const checker = program.getTypeChecker();
|
|
46
|
+
return inputs.sources.flatMap((file) => {
|
|
47
|
+
const source = program.getSourceFile(join(inputs.root, file.path));
|
|
48
|
+
const findings: Finding[] = [];
|
|
49
|
+
function visit(node: ts.Node): void {
|
|
50
|
+
const id = ts.isCallExpression(node) ? literalId(checker, node, prefix === "@shivaedev/service/") : undefined;
|
|
51
|
+
if (id !== undefined && !id.text.startsWith(prefix) && source !== undefined) {
|
|
52
|
+
findings.push({
|
|
53
|
+
file: file.path,
|
|
54
|
+
line: source.getLineAndCharacterOfPosition(id.getStart(source)).line + 1,
|
|
55
|
+
message: `Service id ${JSON.stringify(id.text)} must start with ${JSON.stringify(prefix)}. Prefix the id with its package name and update references to that id.`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
ts.forEachChild(node, visit);
|
|
59
|
+
}
|
|
60
|
+
if (source !== undefined) {
|
|
61
|
+
visit(source);
|
|
62
|
+
}
|
|
63
|
+
return findings;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const serviceIdFindings = Effect.fn("ServiceIds.serviceIdFindings")((inputs: RuleInputs) =>
|
|
68
|
+
Effect.sync(() => {
|
|
69
|
+
const groups = new Map<string, RuleInputs["sources"][number][]>();
|
|
70
|
+
for (const source of inputs.sources) {
|
|
71
|
+
const name = /^packages\/(?<name>[^/]+)\/.+\.[cm]?[jt]sx?$/u.exec(source.path)?.groups?.name;
|
|
72
|
+
if (name !== undefined) {
|
|
73
|
+
const files = groups.get(name) ?? [];
|
|
74
|
+
files.push(source);
|
|
75
|
+
groups.set(name, files);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return [...groups].flatMap(([name, sources]) => checkPackage({ ...inputs, sources }, `@shivaedev/${name}/`));
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import { type SharedErrorModule, sharedErrorModules } from "#adapters/sharedErrorModules.ts";
|
|
5
|
+
import type { Finding, RuleInputs } from "#rule.ts";
|
|
6
|
+
import { effectProgram } from "#rules/effect/program.ts";
|
|
7
|
+
|
|
8
|
+
interface SharedError {
|
|
9
|
+
readonly repair: string;
|
|
10
|
+
readonly symbol: ts.Symbol;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function errorTag(checker: ts.TypeChecker, symbol: ts.Symbol): string | undefined {
|
|
14
|
+
if (!(symbol.flags & ts.SymbolFlags.Class)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const type = checker.getDeclaredTypeOfSymbol(symbol);
|
|
18
|
+
const tag = type.getProperty("_tag");
|
|
19
|
+
const declaration = symbol.valueDeclaration;
|
|
20
|
+
if (tag === undefined || declaration === undefined || type.getProperty("message") === undefined || type.getProperty("name") === undefined) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const literal = checker.getTypeOfSymbolAtLocation(tag, declaration);
|
|
24
|
+
return literal.isStringLiteral() ? literal.value : undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function sharedCatalog(program: ts.Program, checker: ts.TypeChecker, modules: readonly SharedErrorModule[]): ReadonlyMap<string, SharedError> {
|
|
28
|
+
const catalog = new Map<string, SharedError>();
|
|
29
|
+
for (const { file, specifier } of modules) {
|
|
30
|
+
const source = program.getSourceFile(file);
|
|
31
|
+
const module = source === undefined ? undefined : checker.getSymbolAtLocation(source);
|
|
32
|
+
for (const exported of module === undefined ? [] : checker.getExportsOfModule(module)) {
|
|
33
|
+
const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;
|
|
34
|
+
const tag = errorTag(checker, symbol);
|
|
35
|
+
if (tag !== undefined) {
|
|
36
|
+
catalog.set(tag, { repair: `Import ${exported.name} from "${specifier}" and use that class instead.`, symbol });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return catalog;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function classFindings(source: ts.SourceFile, file: string, checker: ts.TypeChecker, catalog: ReadonlyMap<string, SharedError>): readonly Finding[] {
|
|
44
|
+
const findings: Finding[] = [];
|
|
45
|
+
function visit(node: ts.Node): void {
|
|
46
|
+
if (ts.isClassDeclaration(node) || ts.isClassExpression(node)) {
|
|
47
|
+
const symbol = checker.getTypeAtLocation(node).symbol;
|
|
48
|
+
const tag = symbol === undefined ? undefined : errorTag(checker, symbol);
|
|
49
|
+
const shared = tag === undefined ? undefined : catalog.get(tag);
|
|
50
|
+
if (shared !== undefined && symbol !== shared.symbol) {
|
|
51
|
+
findings.push({
|
|
52
|
+
file,
|
|
53
|
+
line: source.getLineAndCharacterOfPosition(node.getStart()).line + 1,
|
|
54
|
+
message: `Tagged error ${node.name?.text ?? "anonymous class"} reuses the shared tag "${tag}". ${shared.repair}`,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
ts.forEachChild(node, visit);
|
|
59
|
+
}
|
|
60
|
+
visit(source);
|
|
61
|
+
return findings;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const sharedErrorFindings = Effect.fn("SharedErrorClasses.sharedErrorFindings")(function* (inputs: RuleInputs) {
|
|
65
|
+
const sources = inputs.sources.filter((source) => /\.[cm]?[jt]sx?$/u.test(source.path) && /\bclass\b/u.test(source.text));
|
|
66
|
+
if (sources.length === 0) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const modules = yield* Effect.promise(() => sharedErrorModules({ ...inputs, sources }));
|
|
70
|
+
if (modules.length === 0) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const program = effectProgram(
|
|
74
|
+
{ ...inputs, sources },
|
|
75
|
+
true,
|
|
76
|
+
modules.map(({ file }) => file),
|
|
77
|
+
);
|
|
78
|
+
const checker = program.getTypeChecker();
|
|
79
|
+
const catalog = sharedCatalog(program, checker, modules);
|
|
80
|
+
return sources.flatMap((file) => {
|
|
81
|
+
const source = program.getSourceFile(join(inputs.root, file.path));
|
|
82
|
+
return source === undefined ? [] : classFindings(source, file.path, checker, catalog);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join, relative } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import ts from "typescript";
|
|
5
|
+
import errorsPackage from "@shivaedev/errors/package.json" with { type: "json" };
|
|
6
|
+
import { type Project, projectsFor } from "#adapters/imports/projects.ts";
|
|
7
|
+
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
8
|
+
import { exportTargets } from "#imports/packageExports.ts";
|
|
9
|
+
import type { RuleInputs } from "#rule.ts";
|
|
10
|
+
|
|
11
|
+
export interface SharedErrorModule {
|
|
12
|
+
readonly file: string;
|
|
13
|
+
readonly specifier: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function targetFiles(directory: string, target: string): readonly string[] {
|
|
17
|
+
const [prefix = "", suffix] = target.split("*");
|
|
18
|
+
if (suffix === undefined) {
|
|
19
|
+
return [join(directory, target)];
|
|
20
|
+
}
|
|
21
|
+
return ts.sys.readDirectory(directory, [".ts", ".js", ".mts", ".cts"], ["node_modules"], ["**/*"]).filter((path) => {
|
|
22
|
+
const local = `./${relative(directory, path).replaceAll("\\", "/")}`;
|
|
23
|
+
return local.startsWith(prefix) && local.endsWith(suffix);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function moduleSpecifiers(directory: string, exports: object): readonly string[] {
|
|
28
|
+
const specifiers = new Set<string>();
|
|
29
|
+
for (const [key, value] of Object.entries(exports)) {
|
|
30
|
+
for (const target of exportTargets(value)) {
|
|
31
|
+
const [prefix = "", suffix] = target.split("*");
|
|
32
|
+
for (const path of targetFiles(directory, target)) {
|
|
33
|
+
const local = `./${relative(directory, path).replaceAll("\\", "/")}`;
|
|
34
|
+
const subpath = suffix === undefined ? key : key.replace("*", local.slice(prefix.length, local.length - suffix.length));
|
|
35
|
+
specifiers.add(`${errorsPackage.name}${subpath === "." ? "" : subpath.slice(1)}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [...specifiers];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function resolveModules(specifiers: readonly string[], from: string, project: Project): readonly SharedErrorModule[] {
|
|
43
|
+
return specifiers.flatMap((specifier) => {
|
|
44
|
+
const resolved = ts.resolveModuleName(specifier, from, project.typesOptions, ts.sys, project.typesCache).resolvedModule;
|
|
45
|
+
return resolved !== undefined && /\.[cm]?tsx?$/u.test(resolved.resolvedFileName) ? [{ file: resolved.resolvedFileName, specifier }] : [];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function sharedErrorModules(inputs: RuleInputs): Promise<readonly SharedErrorModule[]> {
|
|
50
|
+
const projectOf = projectsFor(inputs.root);
|
|
51
|
+
const manifests = new Map<string, string>();
|
|
52
|
+
for (const source of inputs.sources) {
|
|
53
|
+
const from = join(inputs.root, source.path);
|
|
54
|
+
const project = projectOf(from);
|
|
55
|
+
const resolved = ts.resolveModuleName(
|
|
56
|
+
`${errorsPackage.name}/package.json`,
|
|
57
|
+
from,
|
|
58
|
+
project.typesOptions,
|
|
59
|
+
ts.sys,
|
|
60
|
+
project.typesCache,
|
|
61
|
+
).resolvedModule;
|
|
62
|
+
if (resolved !== undefined) {
|
|
63
|
+
manifests.set(resolved.resolvedFileName, from);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (manifests.size === 0) {
|
|
67
|
+
manifests.set(createRequire(import.meta.url).resolve(`${errorsPackage.name}/package.json`), fileURLToPath(import.meta.url));
|
|
68
|
+
}
|
|
69
|
+
const modules = new Map<string, SharedErrorModule>();
|
|
70
|
+
for (const [manifestPath, from] of manifests) {
|
|
71
|
+
const manifest = await readPackageManifest(inputs.readText, relative(inputs.root, manifestPath));
|
|
72
|
+
const exports = manifest?.exports;
|
|
73
|
+
if (typeof exports !== "object" || exports === null || Array.isArray(exports)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
for (const module of resolveModules(moduleSpecifiers(dirname(manifestPath), exports), from, projectOf(from))) {
|
|
77
|
+
modules.set(module.file, module);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return [...modules.values()];
|
|
81
|
+
}
|
|
@@ -57,11 +57,16 @@ export function testProjects(options: TestProjectsOptions = {}): TestUserConfig
|
|
|
57
57
|
...(coverage === true ? {} : coverage),
|
|
58
58
|
},
|
|
59
59
|
}),
|
|
60
|
-
project: ["unit", "pure", "dom"],
|
|
60
|
+
project: ["unit", "pure", "dom", "heavy"],
|
|
61
61
|
projects: [
|
|
62
62
|
{
|
|
63
63
|
extends: true,
|
|
64
|
-
test: {
|
|
64
|
+
test: {
|
|
65
|
+
environment: "node",
|
|
66
|
+
exclude: excluding(named("dom"), named("slow"), named("unit"), named("heavy")),
|
|
67
|
+
include: [named()],
|
|
68
|
+
name: "unit",
|
|
69
|
+
},
|
|
65
70
|
},
|
|
66
71
|
{
|
|
67
72
|
extends: true,
|
|
@@ -82,6 +87,17 @@ export function testProjects(options: TestProjectsOptions = {}): TestUserConfig
|
|
|
82
87
|
name: "dom",
|
|
83
88
|
},
|
|
84
89
|
},
|
|
90
|
+
{
|
|
91
|
+
extends: true,
|
|
92
|
+
test: {
|
|
93
|
+
environment: "node",
|
|
94
|
+
exclude: excluding(),
|
|
95
|
+
include: [named("heavy")],
|
|
96
|
+
maxWorkers: 1,
|
|
97
|
+
name: "heavy",
|
|
98
|
+
sequence: { groupOrder: 1 },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
85
101
|
{ extends: true, test: { environment: "node", exclude: excluding(), include: [named("slow")], name: "slow" } },
|
|
86
102
|
],
|
|
87
103
|
...output,
|
package/src/appTestConfig.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from "vitest/config";
|
|
2
2
|
import { type TestProjectsOptions, testProjects } from "#adapters/testProjects.ts";
|
|
3
3
|
|
|
4
|
-
export function appTestConfig(conditions: string[] = [], options:
|
|
4
|
+
export function appTestConfig(conditions: string[] = [], options: TestProjectsOptions = {}) {
|
|
5
5
|
return defineConfig({
|
|
6
6
|
resolve: { conditions: [...conditions, "module", "browser", "development|production"] },
|
|
7
7
|
ssr: { resolve: { conditions: [...conditions, "node", "development|production"] } },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Clock, Effect, FileSystem, Option } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Clock, Effect, FileSystem, Option, Path } from "effect";
|
|
3
3
|
import { SetupFailure } from "#failure.ts";
|
|
4
4
|
import { gitOrFail } from "#git/command.ts";
|
|
5
5
|
|
|
@@ -7,6 +7,8 @@ const STALE_AFTER_MS = 5 * 60_000;
|
|
|
7
7
|
|
|
8
8
|
export const cleanupMergeFiles = Effect.fn("Baseline.cleanupMergeFiles")(
|
|
9
9
|
function* (cwd: string, inputs: readonly string[]) {
|
|
10
|
+
const { resolve } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
11
|
+
|
|
10
12
|
const fs = yield* FileSystem.FileSystem;
|
|
11
13
|
const root = (yield* gitOrFail(cwd, ["rev-parse", "--show-toplevel"])).trim();
|
|
12
14
|
const active = new Set(inputs.map((path) => resolve(cwd, path)));
|
package/src/baseline/shards.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 { BaselineEntry } from "#baseline/format.ts";
|
|
4
4
|
import { rewriteBaseline } from "#baseline/rewrite.ts";
|
|
5
5
|
import type { ResolvedConfig } from "#config/load.ts";
|
|
@@ -19,6 +19,8 @@ export function shardOf(file: string, rootFile: string): string {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const shardPaths = Effect.fn("Baseline.shardPaths")(function* (config: ResolvedConfig) {
|
|
22
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
23
|
+
|
|
22
24
|
const fs = yield* FileSystem.FileSystem;
|
|
23
25
|
const folder = join(config.root, "packages");
|
|
24
26
|
const names = yield* orWhenAbsent(folder, fs.readDirectory(folder), []);
|
|
@@ -33,6 +35,8 @@ export const shardPaths = Effect.fn("Baseline.shardPaths")(function* (config: Re
|
|
|
33
35
|
|
|
34
36
|
export const saveShards = Effect.fn("Baseline.saveShards")(
|
|
35
37
|
function* (config: ResolvedConfig, before: ReadonlyMap<string, Shard>, entries: readonly BaselineEntry[]) {
|
|
38
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
39
|
+
|
|
36
40
|
const fs = yield* FileSystem.FileSystem;
|
|
37
41
|
const grouped = new Map<string, BaselineEntry[]>();
|
|
38
42
|
for (const entry of entries) {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
3
1
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
4
|
-
import { readOptionalText } from "#inventory/filesystem.ts";
|
|
5
|
-
import { parseConfig, relocateConfig } from "./relocateConfig.ts";
|
|
6
2
|
|
|
7
3
|
function nativeOverride(files: readonly string[], rule: string): unknown {
|
|
8
4
|
const [, tool, group = "", name = ""] = rule.split("/");
|
|
@@ -23,42 +19,3 @@ export function exceptionConfig(declarations: readonly ExceptionDeclaration[]):
|
|
|
23
19
|
),
|
|
24
20
|
};
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
export const withExceptionConfig = Effect.fn("Biome.withExceptionConfig")(function* <TValue, TError, TRequirements>(
|
|
28
|
-
root: string,
|
|
29
|
-
declarations: readonly ExceptionDeclaration[],
|
|
30
|
-
run: (args: readonly string[]) => Effect.Effect<TValue, TError, TRequirements>,
|
|
31
|
-
) {
|
|
32
|
-
const { includes, overrides } = exceptionConfig(declarations);
|
|
33
|
-
if (includes.length === 0 && overrides.length === 0) {
|
|
34
|
-
return yield* run([]);
|
|
35
|
-
}
|
|
36
|
-
const { config, text } = yield* Effect.gen(function* () {
|
|
37
|
-
for (const candidate of ["biome.json", "biome.jsonc"]) {
|
|
38
|
-
const content = yield* readOptionalText(join(root, candidate));
|
|
39
|
-
if (content !== undefined) {
|
|
40
|
-
return { config: candidate, text: content };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return { config: "biome.json", text: "{}" };
|
|
44
|
-
});
|
|
45
|
-
const own = yield* parseConfig(config, text);
|
|
46
|
-
const files = Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files) ? own.files : {};
|
|
47
|
-
if (
|
|
48
|
-
(own.files !== undefined && !Schema.is(Schema.Record(Schema.String, Schema.Unknown))(own.files))
|
|
49
|
-
|| (files.includes !== undefined && !Array.isArray(files.includes))
|
|
50
|
-
|| (own.overrides !== undefined && !Array.isArray(own.overrides))
|
|
51
|
-
) {
|
|
52
|
-
return yield* Effect.die(new Error(`Cannot merge exceptions into invalid ${config}: files, includes or overrides has the wrong shape.`));
|
|
53
|
-
}
|
|
54
|
-
const previousIncludes = Array.isArray(files.includes) ? files.includes : ["**"];
|
|
55
|
-
const previousOverrides = Array.isArray(own.overrides) ? own.overrides : [];
|
|
56
|
-
// Biome also matches a wildcard-led glob such as `!**/.worktrees` against the folders above the root, which ignores a whole linked worktree.
|
|
57
|
-
const generated = {
|
|
58
|
-
...own,
|
|
59
|
-
files: { ...files, includes: [...previousIncludes, ...includes.filter((pattern) => pattern !== "**"), "!.worktrees", "!.quality-biome-*"] },
|
|
60
|
-
overrides: [...previousOverrides, ...overrides],
|
|
61
|
-
};
|
|
62
|
-
const path = yield* relocateConfig(root, join(root, config), generated);
|
|
63
|
-
return yield* run([`--config-path=${path}`]);
|
|
64
|
-
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
+
import { syntaxOf } from "#adapters/biome/syntaxOf.ts";
|
|
3
4
|
import { nativeEffectCall } from "./nativeEffectCall.ts";
|
|
4
5
|
import type { Diagnostic } from "./report.ts";
|
|
5
|
-
import { nodeAt, offsetOf, type Syntax
|
|
6
|
+
import { nodeAt, offsetOf, type Syntax } from "./syntax.ts";
|
|
6
7
|
|
|
7
8
|
const RECOGNIZED: ReadonlySet<string> = new Set(["lint/correctness/noComponentHookFactories", "lint/style/noDoneCallback"]);
|
|
8
9
|
|
|
@@ -1,5 +1,5 @@
|
|
|
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 { runBiome } from "#adapters/biome/run.ts";
|
|
4
4
|
|
|
5
5
|
const RECOMMENDED_ONLY = '{ "linter": { "rules": { "preset": "recommended" } } }\n';
|
|
@@ -9,6 +9,8 @@ const ENABLED_RULE = /^ {4}(?<rule>[a-z0-9]+\/\w+)$/gimu;
|
|
|
9
9
|
export const recommendedRules = Effect.fn("Biome.recommendedRules")(function* () {
|
|
10
10
|
return yield* Effect.scoped(
|
|
11
11
|
Effect.gen(function* () {
|
|
12
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
13
|
+
|
|
12
14
|
const fs = yield* FileSystem.FileSystem;
|
|
13
15
|
const directory = yield* fs.makeTempDirectoryScoped({ prefix: "quality-biome-recommended-" });
|
|
14
16
|
yield* fs.writeFileString(join(directory, "biome.json"), RECOMMENDED_ONLY);
|
package/src/biome/report.ts
CHANGED
|
@@ -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 BiomeRun, runBiome } from "#adapters/biome/run.ts";
|
|
4
4
|
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
5
5
|
import { SetupFailure } from "#failure.ts";
|
|
@@ -65,6 +65,8 @@ export const biomeReport = Effect.fn("Biome.biomeReport")(function* (
|
|
|
65
65
|
exceptions: readonly ExceptionDeclaration[] = [],
|
|
66
66
|
files: readonly string[] = ["."],
|
|
67
67
|
) {
|
|
68
|
+
const { relative, sep } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
69
|
+
|
|
68
70
|
const [report, tracked] = yield* Effect.all([reportFor(root, args, files, exceptions), ignoredTrackedPaths(root)], {
|
|
69
71
|
concurrency: "unbounded",
|
|
70
72
|
});
|
package/src/biome/syntax.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
1
|
import ts from "typescript";
|
|
3
2
|
|
|
4
3
|
export interface Syntax {
|
|
@@ -6,15 +5,6 @@ export interface Syntax {
|
|
|
6
5
|
readonly source: ts.SourceFile;
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
export function syntaxOf(path: string): Syntax {
|
|
10
|
-
const source = ts.createSourceFile(path, readFileSync(path, "utf8"), ts.ScriptTarget.Latest, true);
|
|
11
|
-
const options: ts.CompilerOptions = { allowJs: true, noLib: true, noResolve: true };
|
|
12
|
-
const host = ts.createCompilerHost(options);
|
|
13
|
-
host.getSourceFile = (file) => (file === path ? source : undefined);
|
|
14
|
-
const program = ts.createProgram([path], options, host);
|
|
15
|
-
return { checker: program.getTypeChecker(), source };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
8
|
export function offsetOf(source: ts.SourceFile, position: { readonly line: number; readonly column?: number }): number | undefined {
|
|
19
9
|
const start = source.getLineStarts()[position.line - 1];
|
|
20
10
|
if (start === undefined || position.column === undefined || position.column < 1) {
|
|
@@ -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 { isTooling } from "#imports/isTooling.ts";
|
|
4
5
|
import { entryPointsOf, isApplication, provider } from "#manifests/entryPoints.ts";
|
|
@@ -10,33 +11,37 @@ const UNDECLARED = "lint/correctness/noUndeclaredDependencies";
|
|
|
10
11
|
|
|
11
12
|
const DEPENDENCY = /^Dependency (?<name>\S+) isn't specified in /u;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
const ownerOf = Effect.fn("Biome.ownerOf")(function* (inputs: Pick<RuleInputs, "readText">, path: string) {
|
|
14
15
|
let directory = posix.dirname(path);
|
|
15
16
|
for (;;) {
|
|
16
|
-
const
|
|
17
|
+
const file = posix.join(directory, "package.json");
|
|
18
|
+
const manifest = yield* Effect.promise(() => readPackageManifest(inputs.readText, file));
|
|
17
19
|
if (manifest !== undefined || directory === ".") {
|
|
18
20
|
return { directory, manifest };
|
|
19
21
|
}
|
|
20
22
|
directory = posix.dirname(directory);
|
|
21
23
|
}
|
|
22
|
-
}
|
|
24
|
+
});
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
const brought = Effect.fn("Biome.brought")(function* (inputs: Pick<RuleInputs, "readText">, diagnostic: Diagnostic) {
|
|
25
27
|
const name = DEPENDENCY.exec(diagnostic.message)?.groups?.name;
|
|
26
28
|
const path = diagnostic.location.path;
|
|
27
29
|
if (diagnostic.category !== UNDECLARED || name === undefined || path === undefined) {
|
|
28
30
|
return false;
|
|
29
31
|
}
|
|
30
|
-
const owner =
|
|
32
|
+
const owner = yield* ownerOf(inputs, path);
|
|
31
33
|
if (!isApplication(owner.manifest)) {
|
|
32
34
|
return false;
|
|
33
35
|
}
|
|
34
|
-
const entryPoints =
|
|
36
|
+
const entryPoints = yield* Effect.promise(() => entryPointsOf(inputs, owner.directory, owner.manifest, new Map()));
|
|
35
37
|
const development = isTestCode(path) || isTooling(owner.directory, path);
|
|
36
38
|
return provider(entryPoints, name, development, true) !== undefined;
|
|
37
|
-
}
|
|
39
|
+
});
|
|
38
40
|
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
+
export const withoutEntryPointImports = Effect.fn("Biome.withoutEntryPointImports")(function* (
|
|
42
|
+
inputs: Pick<RuleInputs, "readText">,
|
|
43
|
+
diagnostics: readonly Diagnostic[],
|
|
44
|
+
) {
|
|
45
|
+
const covered = yield* Effect.forEach(diagnostics, (diagnostic) => brought(inputs, diagnostic), { concurrency: "unbounded" });
|
|
41
46
|
return diagnostics.filter((_, index) => !covered[index]);
|
|
42
|
-
}
|
|
47
|
+
});
|
package/src/cli/baseline.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Console, Effect, type FileSystem } from "effect";
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Console, Effect, type FileSystem, Path } from "effect";
|
|
3
3
|
import type { BaselineEntry } from "#baseline/format.ts";
|
|
4
4
|
import { saveShards } from "#baseline/shards.ts";
|
|
5
5
|
import { adopt, type Pruned, prune, type Scope } from "#baseline/update.ts";
|
|
@@ -26,6 +26,8 @@ export const writeBaseline = Effect.fn("Cli.writeBaseline")(function* (
|
|
|
26
26
|
files: readonly string[],
|
|
27
27
|
firstAdoption = false,
|
|
28
28
|
): Effect.fn.Return<void, SetupFailure, RuleServices> {
|
|
29
|
+
const { relative, resolve } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
30
|
+
|
|
29
31
|
const session = yield* openSession(cwd, config);
|
|
30
32
|
const existing = session.baseline.files.size === 0 ? undefined : session.baseline.entries;
|
|
31
33
|
if (firstAdoption && (rules.length === 0 || rules.some((rule) => registrable(session.config, rule)))) {
|
package/src/cli/fix.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 { biomeReport } from "#biome/report.ts";
|
|
4
4
|
import { changedRanges } from "#cli/changedRanges.ts";
|
|
5
5
|
import { loadConfig } from "#config/load.ts";
|
|
@@ -19,6 +19,8 @@ function isBinary(bytes: Uint8Array): boolean {
|
|
|
19
19
|
|
|
20
20
|
export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, RuleServices> {
|
|
21
21
|
return Effect.gen(function* () {
|
|
22
|
+
const { relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
23
|
+
|
|
22
24
|
const fs = yield* FileSystem.FileSystem;
|
|
23
25
|
const decoder = new TextDecoder();
|
|
24
26
|
const paths = yield* walk(root);
|
package/src/cli/fixRule.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 { fixJsxConditionals } from "#adapters/fixJsxConditionals.ts";
|
|
4
4
|
import { loadConfig } from "#config/load.ts";
|
|
5
5
|
import { scan } from "#engine/session.ts";
|
|
@@ -9,13 +9,15 @@ import { plural } from "#report/plural.ts";
|
|
|
9
9
|
import type { RuleServices } from "#rule.ts";
|
|
10
10
|
|
|
11
11
|
const GROUPED =
|
|
12
|
-
"Consecutive assertions stop on the first failure; outcomes
|
|
12
|
+
"Consecutive assertions stop on the first failure; outcomes constructs rows eagerly, then lazily invokes each readout callback in row order before the grouped assertion. Rewrite these stories by hand to review that change in evaluation and failure order.";
|
|
13
13
|
|
|
14
14
|
export const fixRule = Effect.fn("Cli.fixRule")(function* (
|
|
15
15
|
cwd: string,
|
|
16
16
|
configPath: string | undefined,
|
|
17
17
|
rules: readonly string[],
|
|
18
18
|
): Effect.fn.Return<void, SetupFailure | GateFailed, RuleServices> {
|
|
19
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
20
|
+
|
|
19
21
|
const config = yield* loadConfig(cwd, configPath);
|
|
20
22
|
for (const rule of rules) {
|
|
21
23
|
if (rule !== "react/jsx-conditionals") {
|
package/src/cli/lint.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { relative } from "node:path";
|
|
2
1
|
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
|
|
3
2
|
import * as NodePath from "@effect/platform-node/NodePath";
|
|
4
|
-
import { Console, Effect } from "effect";
|
|
3
|
+
import { Console, Effect, Path } from "effect";
|
|
5
4
|
import { withHeavyLock } from "@shivaedev/heavy-lock/withHeavyLock.ts";
|
|
6
5
|
import { looseStagedEntries } from "#baseline/looseStagedEntries.ts";
|
|
7
6
|
import { evaluate, passes } from "#engine/evaluate.ts";
|
|
@@ -13,6 +12,8 @@ import type { RuleServices } from "#rule.ts";
|
|
|
13
12
|
|
|
14
13
|
export const lint = Effect.fn("Cli.lint")(
|
|
15
14
|
function* (cwd: string, config: string | undefined, staged = false): Effect.fn.Return<void, SetupFailure | GateFailed, RuleServices> {
|
|
15
|
+
const { relative } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
16
|
+
|
|
16
17
|
const session = yield* openSession(cwd, config);
|
|
17
18
|
const evaluated = evaluate(session.violations, session.registry, session.baseline.entries, session.config);
|
|
18
19
|
const loose = staged ? yield* looseStagedEntries(session) : [];
|
|
@@ -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 { decodeBaseline } from "#baseline/format.ts";
|
|
4
4
|
import { convertLegacy, decodeLegacyBaseline, LEGACY_BASELINE } from "#baseline/legacy.ts";
|
|
5
5
|
import { saveShards, shardPaths } from "#baseline/shards.ts";
|
|
@@ -16,6 +16,8 @@ export const migrateBaseline = Effect.fn("Cli.migrateBaseline")(function* (
|
|
|
16
16
|
configPath: string | undefined,
|
|
17
17
|
from: string | undefined,
|
|
18
18
|
): Effect.fn.Return<void, SetupFailure, RuleServices> {
|
|
19
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
20
|
+
|
|
19
21
|
const config = yield* loadConfig(cwd, configPath);
|
|
20
22
|
const source = from ?? LEGACY_BASELINE;
|
|
21
23
|
const paths = yield* shardPaths(config).pipe(Effect.mapError((error) => new SetupFailure({ cause: error, message: error.message })));
|
|
@@ -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 { loadConfig } from "#config/load.ts";
|
|
4
4
|
import { validOrFail } from "#decoded.ts";
|
|
5
5
|
import { readInput } from "#engine/baselineFile.ts";
|
|
@@ -38,6 +38,8 @@ export const migrateExceptions = Effect.fnUntraced(function* (
|
|
|
38
38
|
configPath: string | undefined,
|
|
39
39
|
from: string | undefined,
|
|
40
40
|
): Effect.fn.Return<void, SetupFailure, FileSystem.FileSystem> {
|
|
41
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
42
|
+
|
|
41
43
|
const config = yield* loadConfig(cwd, configPath);
|
|
42
44
|
const registryPath = from ?? config.registry;
|
|
43
45
|
const raw = yield* readInput(config.root, registryPath);
|
package/src/config/globs.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import
|
|
2
|
+
import { matchesIgnorePattern } from "#adapters/ignore.ts";
|
|
3
3
|
|
|
4
4
|
const GlobDeclaration = Schema.Struct({
|
|
5
5
|
glob: Schema.NonEmptyString,
|
|
@@ -14,11 +14,6 @@ export function globPatterns(declarations: readonly (typeof GlobDeclaration.Type
|
|
|
14
14
|
return declarations.map(({ glob }) => glob);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function matchesIgnorePattern(file: string, glob: string): boolean {
|
|
18
|
-
const result = ignore().add(glob).test(file);
|
|
19
|
-
return result.ignored || result.unignored;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
17
|
export function validateGlobs(
|
|
23
18
|
{ files, options }: { readonly files: readonly string[]; readonly options: GlobOptions },
|
|
24
19
|
matches: (file: string, glob: string) => boolean = matchesIgnorePattern,
|