Skip to content

Commit 0cb56a1

Browse files
author
Sirius
committed
refactor: remove no-this-alias suppressions using arrow function this capture
Replace pattern with direct access inside arrow functions passed to setTimeout. Arrow functions lexically bind , making the alias unnecessary. Removes 2 eslint-disable comments.
1 parent db08634 commit 0cb56a1

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/testing/tests/unit/server/test-client.test.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ vi.mock("@modelcontextprotocol/sdk/client/streamableHttp.js", () => {
5151
onclose: (() => void) | null = null;
5252
constructor(url: unknown) {
5353
lastHttpArgs = url;
54-
// eslint-disable-next-line @typescript-eslint/no-this-alias
55-
const self = this;
5654
setTimeout(() => {
57-
lastOnclose = self.onclose;
58-
}, 0);
55+
lastOnclose = this.onclose;
56+
});
5957
}
6058
async close() {}
6159
},
@@ -68,11 +66,9 @@ vi.mock("@modelcontextprotocol/sdk/client/stdio.js", () => {
6866
onclose: (() => void) | null = null;
6967
constructor(args: unknown) {
7068
lastStdioArgs = args;
71-
// eslint-disable-next-line @typescript-eslint/no-this-alias
72-
const self = this;
7369
setTimeout(() => {
74-
lastOnclose = self.onclose;
75-
}, 0);
70+
lastOnclose = this.onclose;
71+
});
7672
}
7773
async close() {}
7874
},

0 commit comments

Comments
 (0)