Skip to content

Commit fc191d8

Browse files
daklclaude
andcommitted
fix: resolve biome lint and format issues in session-stop-watcher
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d5e0659 commit fc191d8

3 files changed

Lines changed: 6 additions & 17 deletions

File tree

src/main/ipc-handlers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ export function registerIpcHandlers(options: RegisterHandlersOptions): void {
5454
const ptyManager = new PtyManager(
5555
(file, args, options) => pty.spawn(file, args, options),
5656
undefined,
57-
(sessionId, onIdle) =>
58-
new SessionStopWatcher(getHookSettingsPath(sessionId), getHookSignalPath(sessionId), onIdle),
57+
(sessionId, onIdle) => new SessionStopWatcher(getHookSettingsPath(sessionId), getHookSignalPath(sessionId), onIdle),
5958
);
6059

6160
ptyManager.on("data", (sessionId: string, data: string) => {

src/main/services/session-stop-watcher.test.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("SessionStopWatcher", () => {
3232
);
3333
expect(settingsCall).toBeDefined();
3434

35-
const written = JSON.parse(settingsCall![1]);
35+
const written = JSON.parse(settingsCall?.[1] as string);
3636
expect(written.hooks.Stop[0].hooks[0].command).toBe("touch '/data/hook-signals/s1'");
3737
expect(written.hooks.Stop[0].hooks[0].async).toBe(true);
3838
});
@@ -45,7 +45,7 @@ describe("SessionStopWatcher", () => {
4545
(call) => call[0] === "/data/hook-signals/s1",
4646
);
4747
expect(signalCall).toBeDefined();
48-
expect(signalCall![1]).toBe("");
48+
expect(signalCall?.[1]).toBe("");
4949
});
5050

5151
it("calls onIdle when the signal file is touched", () => {
@@ -75,12 +75,7 @@ describe("SessionStopWatcher", () => {
7575

7676
it("dispose closes the watcher and removes both files", () => {
7777
const { fsOps, watcher } = createMockFsOps();
78-
const stopWatcher = new SessionStopWatcher(
79-
"/data/hook-settings/s1.json",
80-
"/data/hook-signals/s1",
81-
vi.fn(),
82-
fsOps,
83-
);
78+
const stopWatcher = new SessionStopWatcher("/data/hook-settings/s1.json", "/data/hook-signals/s1", vi.fn(), fsOps);
8479

8580
stopWatcher.dispose();
8681

@@ -91,12 +86,7 @@ describe("SessionStopWatcher", () => {
9186

9287
it("dispose is safe to call twice", () => {
9388
const { fsOps } = createMockFsOps();
94-
const stopWatcher = new SessionStopWatcher(
95-
"/data/hook-settings/s1.json",
96-
"/data/hook-signals/s1",
97-
vi.fn(),
98-
fsOps,
99-
);
89+
const stopWatcher = new SessionStopWatcher("/data/hook-settings/s1.json", "/data/hook-signals/s1", vi.fn(), fsOps);
10090

10191
stopWatcher.dispose();
10292
expect(() => stopWatcher.dispose()).not.toThrow();

src/main/services/session-stop-watcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface FsOps {
1111
// Wraps a path in single quotes, escaping any embedded single quotes.
1212
// Handles spaces and most special shell characters.
1313
function shellQuote(s: string): string {
14-
return "'" + s.replace(/'/g, "'\\''") + "'";
14+
return `'${s.replace(/'/g, "'\\''")}'`;
1515
}
1616

1717
export type StopWatcherFactory = (

0 commit comments

Comments
 (0)