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-in-jsx-scope": 0,
"no-console": 2,
};
const languageOptions = {

View File

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

View File

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