Skip to content

Commit 9425952

Browse files
chore(lint): enforce optionMatchToFromOption
1 parent fc5871a commit 9425952

4 files changed

Lines changed: 25 additions & 30 deletions

File tree

‎apps/server/src/ws.ts‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,16 +1406,14 @@ export const layerWsRpc = (
14061406
}),
14071407
),
14081408
);
1409-
return yield* Option.match(project, {
1410-
onNone: () =>
1411-
Effect.fail(
1412-
new AcpRegistryOperationError({
1413-
reason: "project_not_found",
1414-
message: `Project ${projectId} was not found.`,
1415-
}),
1416-
),
1417-
onSome: Effect.succeed,
1418-
});
1409+
return yield* Effect.fromOption(
1410+
project,
1411+
() =>
1412+
new AcpRegistryOperationError({
1413+
reason: "project_not_found",
1414+
message: `Project ${projectId} was not found.`,
1415+
}),
1416+
);
14191417
});
14201418

14211419
const acpSessionManager = Effect.fn("ws.acpRegistry.sessionManager")(function* (

‎packages/provider-acp-registry/src/server/auth.ts‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,12 @@ export const makeAcpRegistryAuth = Effect.fn("makeAcpRegistryAuth")(function* (o
142142
.runBackgroundProbe(agentKey, discoverMethods)
143143
.pipe(
144144
Effect.flatMap((result) =>
145-
Option.isSome(result)
146-
? Effect.succeed(result.value)
147-
: Effect.fail(
148-
failure(
149-
"methods",
150-
"Sign-in discovery was interrupted by an active provider session. Try again.",
151-
),
152-
),
145+
Effect.fromOption(result, () =>
146+
failure(
147+
"methods",
148+
"Sign-in discovery was interrupted by an active provider session. Try again.",
149+
),
150+
),
153151
),
154152
)
155153
: discoverMethods;

‎packages/provider-acp/src/server/AcpSessionRuntime.ts‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,18 +1958,16 @@ export const make = Effect.fn("AcpSessionRuntime.make")(function* (
19581958
Effect.ensuring(Fiber.interrupt(idleFiber).pipe(Effect.ignore)),
19591959
Effect.timeoutOption(sessionLoadTimeout),
19601960
Effect.flatMap((result) =>
1961-
Option.match(result, {
1962-
onNone: () =>
1963-
Effect.fail(
1964-
new EffectAcpErrors.AcpTransportError({
1965-
operation: "call-rpc",
1966-
method: "session/load",
1967-
detail: "session/load timed out waiting for RPC response or replay idle gap",
1968-
cause: undefined,
1969-
}),
1970-
),
1971-
onSome: Effect.succeed,
1972-
}),
1961+
Effect.fromOption(
1962+
result,
1963+
() =>
1964+
new EffectAcpErrors.AcpTransportError({
1965+
operation: "call-rpc",
1966+
method: "session/load",
1967+
detail: "session/load timed out waiting for RPC response or replay idle gap",
1968+
cause: undefined,
1969+
}),
1970+
),
19731971
),
19741972
Effect.tap((result) =>
19751973
logRequest({

‎tsconfig.base.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"namespaceImportPackages": ["@effect/platform-node", "effect"],
2525
"effectFn": ["span", "inferred-span", "suggested-span"],
2626
"diagnosticSeverity": {
27+
"optionMatchToFromOption": "error",
2728
"catchToIgnore": "error",
2829
"unnecessaryEffectGen": "error",
2930
"allOfMapToForEach": "error",

0 commit comments

Comments
 (0)