Skip to content

Commit 0121b9e

Browse files
skulidropekclaude
andcommitted
fix(lint): apply unicorn/prefer-includes rule from eslint-plugin-unicorn@65
eslint-plugin-unicorn v65 introduced prefer-includes-over-repeated-comparisons. Convert all flagged value===a||value===b chains to .includes() where TypeScript can infer the type, and suppress the rule on the one type-guard where .includes() breaks AgentMode narrowing. Also suppress unicorn/no-this-outside-of-class on the intentional TypeScript this-parameter stub in menu-shared.test.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ed8b77b commit 0121b9e

13 files changed

Lines changed: 17 additions & 31 deletions

packages/app/src/docker-git/api-container-tasks-codec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ const readNumber = (value: JsonValue | undefined): number | null =>
2929
const readBoolean = (value: JsonValue | undefined): boolean | null => typeof value === "boolean" ? value : null
3030

3131
const isTaskKind = (value: string): value is ApiContainerTaskKind =>
32-
value === "ssh" ||
33-
value === "web-terminal" ||
34-
value === "agent" ||
35-
value === "background" ||
36-
value === "system"
32+
["ssh", "web-terminal", "agent", "background", "system"].includes(value)
3733

3834
type DecodedContainerTaskFields = {
3935
readonly command: string | null

packages/app/src/docker-git/api-project-codec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type RawProjectDetailFields = {
5555

5656
const isProjectStatus = (
5757
value: string
58-
): value is ApiProjectSummary["status"] => value === "running" || value === "stopped" || value === "unknown"
58+
): value is ApiProjectSummary["status"] => ["running", "stopped", "unknown"].includes(value)
5959

6060
const stringOrEmpty = (value: string | null): string => value ?? ""
6161

packages/app/src/docker-git/api-terminal-codec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type RawTerminalSession = {
1818
const isTerminalSessionStatus = (
1919
value: string
2020
): value is ApiTerminalSession["status"] =>
21-
value === "ready" || value === "attached" || value === "exited" || value === "failed"
21+
["ready", "attached", "exited", "failed"].includes(value)
2222

2323
const readOptionalNumber = (value: JsonValue | undefined): number | undefined =>
2424
typeof value === "number" ? value : undefined

packages/app/src/docker-git/frontend-lib/core/auto-agent-flags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const resolveAutoAgentFlags = (
1414
if (requested === "auto") {
1515
return Either.right({ agentMode: undefined, agentAuto: true })
1616
}
17+
// eslint-disable-next-line unicorn/prefer-includes-over-repeated-comparisons
1718
if (requested === "claude" || requested === "codex" || requested === "gemini" || requested === "grok") {
1819
return Either.right({ agentMode: requested, agentAuto: true })
1920
}

packages/app/src/docker-git/menu-auth.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ const submitAuthPrompt = (view: AuthPromptView, context: AuthInputContext) => {
9999
const label = defaultLabel(nextValues["label"] ?? "")
100100
const effect = resolveAuthPromptEffect(view, context.state.cwd, nextValues)
101101
runAuthPromptEffect(effect, view, label, { ...context, cwd: context.state.cwd }, {
102-
suspendTui: view.flow === "GithubOauth" || view.flow === "CodexOauth" || view.flow === "ClaudeOauth" ||
103-
view.flow === "ClaudeLogout" || view.flow === "GeminiOauth" || view.flow === "GrokOauth"
102+
suspendTui: ["GithubOauth", "CodexOauth", "ClaudeOauth", "ClaudeLogout", "GeminiOauth", "GrokOauth"].includes(view.flow)
104103
})
105104
}
106105
)

packages/app/src/docker-git/menu-project-auth.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,7 @@ const runProjectAuthAction = (
130130
}
131131

132132
if (
133-
action === "ProjectGithubDisconnect" ||
134-
action === "ProjectGitDisconnect" ||
135-
action === "ProjectClaudeDisconnect" ||
136-
action === "ProjectGeminiDisconnect" ||
137-
action === "ProjectGrokDisconnect"
133+
["ProjectGithubDisconnect", "ProjectGitDisconnect", "ProjectClaudeDisconnect", "ProjectGeminiDisconnect", "ProjectGrokDisconnect"].includes(action)
138134
) {
139135
runProjectAuthEffect(view.project, action, {}, "default", context)
140136
return

packages/app/src/lib/usecases/docker-git-config-search.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@ type DockerGitConfigSearchState = {
1212
const isDockerGitConfig = (entry: string): boolean => entry.endsWith("docker-git.json")
1313

1414
const shouldSkipDir = (entry: string): boolean =>
15-
entry === ".git" ||
16-
entry === ".orch" ||
17-
entry === ".docker-git" ||
18-
entry === ".cache" ||
19-
entry === "node_modules" ||
20-
entry === "tmp"
15+
[".git", ".orch", ".docker-git", ".cache", "node_modules", "tmp"].includes(entry)
2116

2217
const isNotFoundStatError = (error: PlatformError): boolean =>
2318
error._tag === "SystemError" && error.reason === "NotFound"

packages/app/src/lib/usecases/state-repo/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/* jscpd:ignore-start */
22
export const isTruthyEnv = (value: string): boolean => {
33
const normalized = value.trim().toLowerCase()
4-
return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on"
4+
return ["1", "true", "yes", "on"].includes(normalized)
55
}
66

77
export const isFalsyEnv = (value: string): boolean => {
88
const normalized = value.trim().toLowerCase()
9-
return normalized === "0" || normalized === "false" || normalized === "no" || normalized === "off"
9+
return ["0", "false", "no", "off"].includes(normalized)
1010
}
1111

1212
export const autoPullEnvKey = "DOCKER_GIT_STATE_AUTO_PULL"

packages/app/src/web/actions-auth.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,13 @@ const openProjectAuthPrompt = (
184184

185185
const isMenuNavigationAction = (
186186
action: AuthMenuAction | ProjectAuthMenuAction
187-
): action is "Back" | "Refresh" => action === "Back" || action === "Refresh"
187+
): action is "Back" | "Refresh" => ["Back", "Refresh"].includes(action)
188188

189189
const isCodexAuthAction = (action: BrowserAuthPrompt["action"]): action is CodexAuthAction =>
190-
action === "CodexOauth" || action === "CodexLogout"
190+
["CodexOauth", "CodexLogout"].includes(action)
191191

192192
const isTerminalOnlyAuthAction = (action: BrowserAuthPrompt["action"]): action is TerminalAuthFlow =>
193-
action === "ClaudeOauth" || action === "GeminiOauth" || action === "GrokOauth"
193+
["ClaudeOauth", "GeminiOauth", "GrokOauth"].includes(action)
194194

195195
const runCodexAuthAction = (
196196
action: CodexAuthAction,

packages/app/src/web/app-ready-terminal-storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const readJsonArray = (value: JsonValue | undefined): ReadonlyArray<JsonValue> |
4343
const isStoredTerminalStatus = (
4444
value: string | null
4545
): value is ActiveTerminalSession["session"]["status"] =>
46-
value === "ready" || value === "attached" || value === "exited" || value === "failed"
46+
["ready", "attached", "exited", "failed"].includes(value as string)
4747

4848
type StoredTerminalSessionFields = {
4949
readonly createdAt: string | null

0 commit comments

Comments
 (0)