Skip to content

Commit 6a36dd2

Browse files
committed
chore(extension): tidy code style to match upstream conventions
- Use inferred Set type: Set<number> = new Set() -> = new Set<number>() - Use nullish coalescing for url default (|| -> ??) - Fix ternary indentation to 4-space continuation - Remove stale comment on forwardCDPCommand - Fix double space in import
1 parent 26a333e commit 6a36dd2

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

packages/extension/src/background.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type PageMessage = {
3535
class TabShareExtension {
3636
private _activeConnection: RelayConnection | undefined;
3737
private _connectedTabId: number | null = null;
38-
private _playwrightTabIds: Set<number> = new Set();
38+
private _playwrightTabIds = new Set<number>();
3939
private _pendingTabSelection = new Map<number, { connection: RelayConnection, timerId?: number }>();
4040

4141
constructor() {

packages/extension/src/relayConnection.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class RelayConnection {
4444
private _tabPromise: Promise<void>;
4545
private _tabPromiseResolve!: () => void;
4646
private _closed = false;
47-
private _playwrightTabIds: Set<number> = new Set();
47+
private _playwrightTabIds = new Set<number>();
4848

4949
onclose?: () => void;
5050
onPlaywrightTabCreated?: (tabId: number) => void;
@@ -162,7 +162,7 @@ export class RelayConnection {
162162
};
163163
}
164164
if (message.method === 'createTab') {
165-
const url: string = message.params?.url || 'about:blank';
165+
const url = message.params?.url ?? 'about:blank';
166166
debugLog('Creating new tab:', url);
167167
const tab = await chrome.tabs.create({ url, active: true });
168168
const tabId = tab.id!;
@@ -189,9 +189,8 @@ export class RelayConnection {
189189
const { sessionId, method, params, tabId } = message.params;
190190
debugLog('CDP command:', method, params, 'tabId:', tabId);
191191
const debuggee: chrome.debugger.DebuggerSession = tabId !== undefined
192-
? { tabId, sessionId }
193-
: { ...this._debuggee, sessionId };
194-
// Forward CDP command to chrome.debugger
192+
? { tabId, sessionId }
193+
: { ...this._debuggee, sessionId };
195194
return await chrome.debugger.sendCommand(debuggee, method, params);
196195
}
197196
}

packages/extension/src/ui/status.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import React, { useState, useEffect } from 'react';
1818
import { createRoot } from 'react-dom/client';
19-
import { Button, TabItem } from './tabItem';
19+
import { Button, TabItem } from './tabItem';
2020

2121
import type { TabInfo } from './tabItem';
2222
import { AuthTokenSection } from './authToken';

0 commit comments

Comments
 (0)