lint: ban console output (#317)

This commit is contained in:
Pavel Feldman 2025-04-30 14:15:32 -07:00 committed by GitHub
parent 685dea9e19
commit 23ce973377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 11 deletions

View File

@ -180,6 +180,7 @@ export const baseRules = {
// react // react
"react/react-in-jsx-scope": 0, "react/react-in-jsx-scope": 0,
"no-console": 2,
}; };
const languageOptions = { const languageOptions = {

View File

@ -41,7 +41,6 @@ program
.option('--config <path>', 'Path to the configuration file.') .option('--config <path>', 'Path to the configuration file.')
.action(async options => { .action(async options => {
const config = await resolveConfig(options); const config = await resolveConfig(options);
console.error(config);
const serverList = new ServerList(() => createServer(config)); const serverList = new ServerList(() => createServer(config));
setupExitWatchdog(serverList); setupExitWatchdog(serverList);

View File

@ -49,7 +49,10 @@ async function handleSSE(req: http.IncomingMessage, res: http.ServerResponse, ur
const server = await serverList.create(); const server = await serverList.create();
res.on('close', () => { res.on('close', () => {
sessions.delete(transport.sessionId); sessions.delete(transport.sessionId);
serverList.close(server).catch(e => console.error(e)); serverList.close(server).catch(e => {
// eslint-disable-next-line no-console
console.error(e);
});
}); });
return await server.connect(transport); return await server.connect(transport);
} }
@ -113,15 +116,19 @@ export function startHttpTransport(port: number, hostname: string | undefined, s
resolvedHost = 'localhost'; resolvedHost = 'localhost';
url = `http://${resolvedHost}:${resolvedPort}`; url = `http://${resolvedHost}:${resolvedPort}`;
} }
console.log(`Listening on ${url}`); const message = [
console.log('Put this in your client config:'); `Listening on ${url}`,
console.log(JSON.stringify({ 'Put this in your client config:',
'mcpServers': { JSON.stringify({
'playwright': { 'mcpServers': {
'url': `${url}/sse` 'playwright': {
'url': `${url}/sse`
}
} }
} }, undefined, 2),
}, undefined, 2)); 'If your client supports streamable HTTP, you can use the /mcp endpoint instead.',
console.log('If your client supports streamable HTTP, you can use the /mcp endpoint instead.'); ].join('\n');
// eslint-disable-next-line no-console
console.log(message);
}); });
} }