Skip to content

Commit 84c71f9

Browse files
chore(lint): enforce unnecessaryEffectGen
1 parent d240aea commit 84c71f9

4 files changed

Lines changed: 49 additions & 56 deletions

File tree

‎apps/server/src/mcp/WorktreeMcpService.test.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,7 @@ const expectTypedFailure = (exit: Exit.Exit<unknown, unknown>, expected: object)
350350

351351
// Resolve once so calls share the in-flight guard.
352352
const resolveService = (harness: ReturnType<typeof makeHarness>) =>
353-
Effect.gen(function* () {
354-
return yield* WorktreeMcpService.WorktreeMcpService;
355-
}).pipe(Effect.provide(harness.layer));
353+
WorktreeMcpService.WorktreeMcpService.pipe(Effect.provide(harness.layer));
356354

357355
const runHandoff = (
358356
harness: ReturnType<typeof makeHarness>,

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5339,12 +5339,10 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
53395339
Effect.ensuring(
53405340
runRuntimeCallbackAtGeneration(
53415341
generation,
5342-
Effect.gen(function* () {
5343-
yield* Ref.update(pendingRuntimeRequests, (current) => {
5344-
const updated = new Map(current);
5345-
updated.delete(String(requestId));
5346-
return updated;
5347-
});
5342+
Ref.update(pendingRuntimeRequests, (current) => {
5343+
const updated = new Map(current);
5344+
updated.delete(String(requestId));
5345+
return updated;
53485346
}),
53495347
).pipe(Effect.asVoid),
53505348
),
@@ -6032,12 +6030,10 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
60326030
Effect.ensuring(
60336031
runRuntimeCallbackAtGeneration(
60346032
handlerGeneration,
6035-
Effect.gen(function* () {
6036-
yield* Ref.update(pendingRuntimeRequests, (current) => {
6037-
const updated = new Map(current);
6038-
updated.delete(String(requestId));
6039-
return updated;
6040-
});
6033+
Ref.update(pendingRuntimeRequests, (current) => {
6034+
const updated = new Map(current);
6035+
updated.delete(String(requestId));
6036+
return updated;
60416037
}),
60426038
).pipe(Effect.asVoid),
60436039
),

‎packages/provider-cursor/src/server/usageLimits.test.ts‎

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -71,49 +71,47 @@ describe("Cursor usage limits", () => {
7171
});
7272

7373
it.effect("reads the instance's credentials and endpoint even when usage enabled is false", () =>
74-
Effect.gen(function* () {
75-
yield* withNodeServices(
76-
Effect.gen(function* () {
77-
const fs = yield* FileSystem.FileSystem;
78-
const path = yield* Path.Path;
79-
const directory = yield* fs.makeTempDirectoryScoped();
80-
yield* fs.makeDirectory(path.join(directory, "cursor"));
81-
yield* fs.writeFileString(
82-
path.join(directory, "cursor", "auth.json"),
83-
'{"accessToken":"instance-token"}',
74+
withNodeServices(
75+
Effect.gen(function* () {
76+
const fs = yield* FileSystem.FileSystem;
77+
const path = yield* Path.Path;
78+
const directory = yield* fs.makeTempDirectoryScoped();
79+
yield* fs.makeDirectory(path.join(directory, "cursor"));
80+
yield* fs.writeFileString(
81+
path.join(directory, "cursor", "auth.json"),
82+
'{"accessToken":"instance-token"}',
83+
);
84+
const client = HttpClient.make((request) => {
85+
expect(request.url).toBe(
86+
"https://cursor.example/aiserver.v1.DashboardService/GetCurrentPeriodUsage",
8487
);
85-
const client = HttpClient.make((request) => {
86-
expect(request.url).toBe(
87-
"https://cursor.example/aiserver.v1.DashboardService/GetCurrentPeriodUsage",
88-
);
89-
expect(request.method).toBe("POST");
90-
expect(request.headers.authorization).toBe("Bearer instance-token");
91-
expect(request.headers["connect-protocol-version"]).toBe("1");
92-
return Effect.succeed(
93-
HttpClientResponse.fromWeb(
94-
request,
95-
Response.json({ enabled: false, planUsage: { totalPercentUsed: 42 } }),
96-
),
97-
);
98-
});
99-
yield* fs.makeDirectory(path.join(directory, ".cursor"));
100-
yield* fs.writeFileString(
101-
path.join(directory, ".cursor", "auth.json"),
102-
'{"accessToken":"instance-token"}',
88+
expect(request.method).toBe("POST");
89+
expect(request.headers.authorization).toBe("Bearer instance-token");
90+
expect(request.headers["connect-protocol-version"]).toBe("1");
91+
return Effect.succeed(
92+
HttpClientResponse.fromWeb(
93+
request,
94+
Response.json({ enabled: false, planUsage: { totalPercentUsed: 42 } }),
95+
),
10396
);
104-
for (const platform of ["linux", "darwin"] as const) {
105-
const limits = yield* readCursorUsageLimits(
106-
{ apiEndpoint: "https://cursor.example/" },
107-
{ XDG_CONFIG_HOME: directory, HOME: directory, AGENT_CLI_CREDENTIAL_STORE: "file" },
108-
).pipe(
109-
Effect.provideService(HostProcess.Platform, platform),
110-
Effect.provideService(HttpClient.HttpClient, client),
111-
);
112-
expect(limits.windows[0]?.usedPercent).toBe(42);
113-
}
114-
}).pipe(Effect.scoped),
115-
);
116-
}),
97+
});
98+
yield* fs.makeDirectory(path.join(directory, ".cursor"));
99+
yield* fs.writeFileString(
100+
path.join(directory, ".cursor", "auth.json"),
101+
'{"accessToken":"instance-token"}',
102+
);
103+
for (const platform of ["linux", "darwin"] as const) {
104+
const limits = yield* readCursorUsageLimits(
105+
{ apiEndpoint: "https://cursor.example/" },
106+
{ XDG_CONFIG_HOME: directory, HOME: directory, AGENT_CLI_CREDENTIAL_STORE: "file" },
107+
).pipe(
108+
Effect.provideService(HostProcess.Platform, platform),
109+
Effect.provideService(HttpClient.HttpClient, client),
110+
);
111+
expect(limits.windows[0]?.usedPercent).toBe(42);
112+
}
113+
}).pipe(Effect.scoped),
114+
),
117115
);
118116

119117
it.effect(

‎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+
"unnecessaryEffectGen": "error",
2728
"allOfMapToForEach": "error",
2829
"catchToOrElseSucceed": "error",
2930
"unnecessaryFailYieldableError": "error",

0 commit comments

Comments
 (0)