Skip to content

Commit f5eca3f

Browse files
committed
chore(lint): enable object and reassignment rules
1 parent ea11b8a commit f5eca3f

197 files changed

Lines changed: 619 additions & 638 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.oxlintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"eslint/no-multi-str": "error",
2121
"eslint/no-new": "error",
2222
"eslint/no-object-constructor": "error",
23+
"eslint/no-param-reassign": "error",
2324
"eslint/no-proto": "error",
2425
"eslint/no-regex-spaces": "error",
2526
"eslint/no-return-assign": "error",
@@ -44,8 +45,10 @@
4445
"eslint/default-case-last": "error",
4546
"eslint/default-param-last": "error",
4647
"eslint/prefer-exponentiation-operator": "error",
48+
"eslint/prefer-const": "error",
4749
"eslint/prefer-numeric-literals": "error",
4850
"eslint/prefer-object-has-own": "error",
51+
"eslint/object-shorthand": "error",
4952
"eslint/prefer-rest-params": "error",
5053
"eslint/prefer-spread": "error",
5154
"eslint/radix": "error",

extensions/browser/src/browser/pw-session.connections.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type BrowserMockBundle = {
1717
};
1818

1919
function makeBrowser(targetId: string, url: string): BrowserMockBundle {
20-
let context: import("playwright-core").BrowserContext;
2120
const browserClose = vi.fn(async () => {});
2221
const page = {
2322
on: vi.fn(),
@@ -26,7 +25,7 @@ function makeBrowser(targetId: string, url: string): BrowserMockBundle {
2625
url: vi.fn(() => url),
2726
} as unknown as import("playwright-core").Page;
2827

29-
context = {
28+
const context: import("playwright-core").BrowserContext = {
3029
pages: () => [page],
3130
on: vi.fn(),
3231
newCDPSession: vi.fn(async () => ({
@@ -66,7 +65,6 @@ function makeEmptyBrowser(): BrowserMockBundle {
6665
}
6766

6867
function makeDisconnectedReadBrowser(): BrowserMockBundle {
69-
let context: import("playwright-core").BrowserContext;
7068
const browserClose = vi.fn(async () => {});
7169
const page = {
7270
on: vi.fn(),
@@ -79,7 +77,7 @@ function makeDisconnectedReadBrowser(): BrowserMockBundle {
7977
}),
8078
} as unknown as import("playwright-core").Page;
8179

82-
context = {
80+
const context: import("playwright-core").BrowserContext = {
8381
pages: () => [page],
8482
on: vi.fn(),
8583
newCDPSession: vi.fn(async () => {

extensions/browser/src/browser/pw-session.get-page-for-targetid.extension-fallback.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function requireFetchInit(init: Parameters<typeof fetch>[1]): FetchInitWithDispa
4343
}
4444

4545
function makeBrowser(pages: MockPageSpec[]): BrowserMockBundle {
46-
let context: import("playwright-core").BrowserContext;
4746
const browserClose = vi.fn(async () => {});
4847
const targetIdByPage = new Map<import("playwright-core").Page, string | undefined>();
4948

@@ -58,7 +57,7 @@ function makeBrowser(pages: MockPageSpec[]): BrowserMockBundle {
5857
return page;
5958
});
6059

61-
context = {
60+
const context: import("playwright-core").BrowserContext = {
6261
pages: () => pageObjects,
6362
on: vi.fn(),
6463
newCDPSession: vi.fn(async (page: import("playwright-core").Page) => ({

extensions/browser/src/browser/pw-tools-core.responses.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export async function responseBodyViaPlaywright(opts: {
3232
const promise = new Promise<unknown>((resolve, reject) => {
3333
let done = false;
3434
let timer: NodeJS.Timeout | undefined;
35-
let handler: ((resp: unknown) => void) | undefined;
3635

3736
const cleanup = () => {
3837
if (timer) {
@@ -44,7 +43,7 @@ export async function responseBodyViaPlaywright(opts: {
4443
}
4544
};
4645

47-
handler = (resp: unknown) => {
46+
const handler: ((resp: unknown) => void) | undefined = (resp: unknown) => {
4847
if (done) {
4948
return;
5049
}

extensions/codex/src/app-server/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ export class CodexAppServerClient {
202202
request<T = JsonValue | undefined>(
203203
method: string,
204204
params?: unknown,
205-
options?: { timeoutMs?: number; signal?: AbortSignal },
205+
optionsInput?: { timeoutMs?: number; signal?: AbortSignal },
206206
): Promise<T> {
207+
let options = optionsInput;
207208
options ??= {};
208209
if (this.closed) {
209210
return Promise.reject(this.closeError ?? new Error("codex app-server client is closed"));

extensions/codex/src/app-server/computer-use.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,12 @@ async function delay(ms: number, signal?: AbortSignal): Promise<void> {
487487
throw abortError(signal);
488488
}
489489
await new Promise<void>((resolve, reject) => {
490-
let timer: ReturnType<typeof setTimeout>;
491490
const onAbort = () => {
492491
clearTimeout(timer);
493492
signal?.removeEventListener("abort", onAbort);
494493
reject(abortError(signal));
495494
};
496-
timer = setTimeout(() => {
495+
const timer: ReturnType<typeof setTimeout> = setTimeout(() => {
497496
signal?.removeEventListener("abort", onAbort);
498497
resolve();
499498
}, ms);

extensions/codex/src/app-server/run-attempt.test.ts

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,17 +2735,18 @@ describe("runCodexAppServerAttempt", () => {
27352735
});
27362736

27372737
it("does not drop turn completion notifications emitted while turn/start is in flight", async () => {
2738-
let harness: ReturnType<typeof createAppServerHarness>;
2739-
harness = createAppServerHarness(async (method) => {
2740-
if (method === "thread/start") {
2741-
return threadStartResult();
2742-
}
2743-
if (method === "turn/start") {
2744-
await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2745-
return turnStartResult("turn-1", "completed");
2746-
}
2747-
return {};
2748-
});
2738+
const harness: ReturnType<typeof createAppServerHarness> = createAppServerHarness(
2739+
async (method) => {
2740+
if (method === "thread/start") {
2741+
return threadStartResult();
2742+
}
2743+
if (method === "turn/start") {
2744+
await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2745+
return turnStartResult("turn-1", "completed");
2746+
}
2747+
return {};
2748+
},
2749+
);
27492750

27502751
const result = await runCodexAppServerAttempt(
27512752
createParams(path.join(tempDir, "session.jsonl"), path.join(tempDir, "workspace")),
@@ -2755,30 +2756,31 @@ describe("runCodexAppServerAttempt", () => {
27552756
});
27562757

27572758
it("does not fail when a buffered terminal notification is followed by client close", async () => {
2758-
let harness: ReturnType<typeof createAppServerHarness>;
27592759
let resolveBufferedTerminal!: () => void;
27602760
const bufferedTerminal = new Promise<void>((resolve) => {
27612761
resolveBufferedTerminal = resolve;
27622762
});
2763-
harness = createAppServerHarness(async (method) => {
2764-
if (method === "thread/start") {
2765-
return threadStartResult();
2766-
}
2767-
if (method === "turn/start") {
2768-
await harness.notify({
2769-
method: "item/started",
2770-
params: {
2771-
threadId: "thread-1",
2772-
turnId: "turn-1",
2773-
item: { id: "tool-1", type: "commandExecution" },
2774-
},
2775-
});
2776-
await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2777-
resolveBufferedTerminal();
2778-
return turnStartResult("turn-1", "inProgress");
2779-
}
2780-
return {};
2781-
});
2763+
const harness: ReturnType<typeof createAppServerHarness> = createAppServerHarness(
2764+
async (method) => {
2765+
if (method === "thread/start") {
2766+
return threadStartResult();
2767+
}
2768+
if (method === "turn/start") {
2769+
await harness.notify({
2770+
method: "item/started",
2771+
params: {
2772+
threadId: "thread-1",
2773+
turnId: "turn-1",
2774+
item: { id: "tool-1", type: "commandExecution" },
2775+
},
2776+
});
2777+
await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });
2778+
resolveBufferedTerminal();
2779+
return turnStartResult("turn-1", "inProgress");
2780+
}
2781+
return {};
2782+
},
2783+
);
27822784

27832785
const run = runCodexAppServerAttempt(
27842786
createParams(path.join(tempDir, "session.jsonl"), path.join(tempDir, "workspace")),
@@ -2795,24 +2797,25 @@ describe("runCodexAppServerAttempt", () => {
27952797
});
27962798

27972799
it("does not time out when turn progress arrives before turn/start returns", async () => {
2798-
let harness: ReturnType<typeof createAppServerHarness>;
2799-
harness = createAppServerHarness(async (method) => {
2800-
if (method === "thread/start") {
2801-
return threadStartResult();
2802-
}
2803-
if (method === "turn/start") {
2804-
await harness.notify({
2805-
method: "turn/started",
2806-
params: {
2807-
threadId: "thread-1",
2808-
turnId: "turn-1",
2809-
turn: { id: "turn-1", status: "inProgress" },
2810-
},
2811-
});
2812-
return turnStartResult("turn-1", "inProgress");
2813-
}
2814-
return {};
2815-
});
2800+
const harness: ReturnType<typeof createAppServerHarness> = createAppServerHarness(
2801+
async (method) => {
2802+
if (method === "thread/start") {
2803+
return threadStartResult();
2804+
}
2805+
if (method === "turn/start") {
2806+
await harness.notify({
2807+
method: "turn/started",
2808+
params: {
2809+
threadId: "thread-1",
2810+
turnId: "turn-1",
2811+
turn: { id: "turn-1", status: "inProgress" },
2812+
},
2813+
});
2814+
return turnStartResult("turn-1", "inProgress");
2815+
}
2816+
return {};
2817+
},
2818+
);
28162819
const params = createParams(
28172820
path.join(tempDir, "session.jsonl"),
28182821
path.join(tempDir, "workspace"),

0 commit comments

Comments
 (0)