refactor(format): update formatter interface to return command from enabled() (#20703)

This commit is contained in:
Dax
2026-04-02 12:22:01 -04:00
committed by GitHub
parent 93a139315c
commit 3faabdadb7
3 changed files with 104 additions and 89 deletions

View File

@@ -87,12 +87,10 @@ describe("Format", () => {
const one = {
extensions: Formatter.gofmt.extensions,
enabled: Formatter.gofmt.enabled,
command: Formatter.gofmt.command,
}
const two = {
extensions: Formatter.mix.extensions,
enabled: Formatter.mix.enabled,
command: Formatter.mix.command,
}
let active = 0
@@ -102,21 +100,19 @@ describe("Format", () => {
Effect.sync(() => {
Formatter.gofmt.extensions = [".parallel"]
Formatter.mix.extensions = [".parallel"]
Formatter.gofmt.command = ["sh", "-c", "true"]
Formatter.mix.command = ["sh", "-c", "true"]
Formatter.gofmt.enabled = async () => {
active++
max = Math.max(max, active)
await Bun.sleep(20)
active--
return true
return ["sh", "-c", "true"]
}
Formatter.mix.enabled = async () => {
active++
max = Math.max(max, active)
await Bun.sleep(20)
active--
return true
return ["sh", "-c", "true"]
}
}),
() =>
@@ -130,10 +126,8 @@ describe("Format", () => {
Effect.sync(() => {
Formatter.gofmt.extensions = one.extensions
Formatter.gofmt.enabled = one.enabled
Formatter.gofmt.command = one.command
Formatter.mix.extensions = two.extensions
Formatter.mix.enabled = two.enabled
Formatter.mix.command = two.command
}),
)