Skip to content

Commit e88876a

Browse files
committed
fix: resolve ESLint violations
1 parent 5ab8a9f commit e88876a

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ Playwright MCP server supports following arguments. They can be provided in the
156156
to enable, possible values: vision, pdf.
157157
--cdp-endpoint <endpoint> CDP endpoint to connect to.
158158
--cdp-headers <headers> JSON string of headers to send with CDP
159-
connection, e.g. '{"Authorization": "Bearer token"}'
159+
connection, e.g. '{"Authorization": "Bearer
160+
token"}'
160161
--config <path> path to the configuration file.
161162
--device <device> device to emulate, for example: "iPhone 15"
162163
--executable-path <path> path to the browser executable.

src/browserContextFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ class CdpContextFactory extends BaseContextFactory {
135135

136136
protected override async _doObtainBrowser(): Promise<playwright.Browser> {
137137
const options: any = {};
138-
if (this.config.browser.cdpHeaders) {
138+
if (this.config.browser.cdpHeaders)
139139
options.headers = this.config.browser.cdpHeaders;
140-
}
140+
141141
return playwright.chromium.connectOverCDP(this.config.browser.cdpEndpoint!, options);
142142
}
143143

src/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,14 @@ export function parseJsonObject(value: string | undefined): Record<string, strin
304304
return undefined;
305305
try {
306306
const parsed = JSON.parse(value);
307-
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
307+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
308308
throw new InvalidArgumentError('Expected JSON object');
309-
}
309+
310310
return parsed;
311311
} catch (error) {
312-
if (error instanceof InvalidArgumentError) {
312+
if (error instanceof InvalidArgumentError)
313313
throw error;
314-
}
314+
315315
const errorMessage = error instanceof Error ? error.message : String(error);
316316
throw new InvalidArgumentError(`Invalid JSON format: ${errorMessage}`);
317317
}

tests/cdp.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ test('should throw connection error and allow re-connecting', async ({ cdpServer
8787
test('cdp server with headers', async ({ cdpServer, startClient, server }) => {
8888
await cdpServer.start();
8989
const headers = { 'X-Test-Header': 'test-value' };
90-
const { client } = await startClient({
91-
args: [`--cdp-endpoint=${cdpServer.endpoint}`, `--cdp-headers=${JSON.stringify(headers)}`]
90+
const { client } = await startClient({
91+
args: [`--cdp-endpoint=${cdpServer.endpoint}`, `--cdp-headers=${JSON.stringify(headers)}`]
9292
});
9393
expect(await client.callTool({
9494
name: 'browser_navigate',
@@ -100,7 +100,7 @@ test('cdp server with headers', async ({ cdpServer, startClient, server }) => {
100100

101101
test('cdp server with invalid headers JSON', async () => {
102102
const result = spawnSync('node', [
103-
path.join(__filename, '../../cli.js'),
103+
path.join(__filename, '../../cli.js'),
104104
'--cdp-endpoint=http://localhost:1234',
105105
'--cdp-headers=invalid-json'
106106
]);

0 commit comments

Comments
 (0)