Skip to content

Commit 4edf4d7

Browse files
konardclaude
andcommitted
fix(lint): remove forbidden type casts from parser and tests
- Replace 'as Command' cast in parseApplyAll with typed variable declaration - Rewrite parser-apply-all.test.ts to avoid 'as const' casts (no-restricted-syntax) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6a2bcff commit 4edf4d7

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

packages/app/src/docker-git/cli/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const downAllCommand: Command = { _tag: "DownAll" }
3333
// COMPLEXITY: O(n) where n = |args|
3434
const parseApplyAll = (args: ReadonlyArray<string>): Either.Either<Command, ParseError> => {
3535
const activeOnly = args.includes("--active")
36-
return Either.right({ _tag: "ApplyAll", activeOnly } as Command)
36+
const command: Command = { _tag: "ApplyAll", activeOnly }
37+
return Either.right(command)
3738
}
3839

3940
const parseCreate = (args: ReadonlyArray<string>): Either.Either<Command, ParseError> =>

packages/app/tests/docker-git/parser-apply-all.test.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,32 @@ import { Effect } from "effect"
33

44
import { parseOrThrow } from "./parser-helpers.js"
55

6+
const assertApplyAllActiveOnly = (args: ReadonlyArray<string>, expectedActiveOnly: boolean) => {
7+
const command = parseOrThrow(args)
8+
expect(command._tag).toBe("ApplyAll")
9+
if (command._tag === "ApplyAll") {
10+
expect(command.activeOnly).toBe(expectedActiveOnly)
11+
}
12+
}
13+
614
describe("parseArgs apply-all --active", () => {
7-
it.effect("parses apply-all and update-all without --active as activeOnly=false", () =>
15+
it.effect("parses apply-all without --active as activeOnly=false", () =>
16+
Effect.sync(() => {
17+
assertApplyAllActiveOnly(["apply-all"], false)
18+
}))
19+
20+
it.effect("parses update-all without --active as activeOnly=false", () =>
21+
Effect.sync(() => {
22+
assertApplyAllActiveOnly(["update-all"], false)
23+
}))
24+
25+
it.effect("parses apply-all with --active as activeOnly=true", () =>
826
Effect.sync(() => {
9-
for (const alias of ["apply-all", "update-all"] as const) {
10-
const command = parseOrThrow([alias])
11-
expect(command._tag).toBe("ApplyAll")
12-
if (command._tag === "ApplyAll") {
13-
expect(command.activeOnly).toBe(false)
14-
}
15-
}
27+
assertApplyAllActiveOnly(["apply-all", "--active"], true)
1628
}))
1729

18-
it.effect("parses apply-all and update-all with --active as activeOnly=true", () =>
30+
it.effect("parses update-all with --active as activeOnly=true", () =>
1931
Effect.sync(() => {
20-
for (const alias of ["apply-all", "update-all"] as const) {
21-
const command = parseOrThrow([alias, "--active"])
22-
expect(command._tag).toBe("ApplyAll")
23-
if (command._tag === "ApplyAll") {
24-
expect(command.activeOnly).toBe(true)
25-
}
26-
}
32+
assertApplyAllActiveOnly(["update-all", "--active"], true)
2733
}))
2834
})

0 commit comments

Comments
 (0)