diff --git a/site/biome.json b/site/biome.json index 9ec2052b17c33..9a71b3a3b8308 100644 --- a/site/biome.json +++ b/site/biome.json @@ -16,6 +16,7 @@ }, "suspicious": { "noArrayIndexKey": { "level": "off" }, + "noConsoleLog": { "level": "error" }, "noThenProperty": { "level": "off" } }, "nursery": { diff --git a/site/e2e/helpers.ts b/site/e2e/helpers.ts index b0457697bb641..f435af516879b 100644 --- a/site/e2e/helpers.ts +++ b/site/e2e/helpers.ts @@ -386,14 +386,12 @@ export const startAgentWithCommand = async ( }, }); cp.stdout.on("data", (data: Buffer) => { - // eslint-disable-next-line no-console -- Log agent activity - console.log( + console.info( `[agent] [stdout] [onData] ${data.toString().replace(/\n$/g, "")}`, ); }); cp.stderr.on("data", (data: Buffer) => { - // eslint-disable-next-line no-console -- Log agent activity - console.log( + console.info( `[agent] [stderr] [onData] ${data.toString().replace(/\n$/g, "")}`, ); }); diff --git a/site/e2e/hooks.ts b/site/e2e/hooks.ts index 5825134987f52..bf9681ed43d5d 100644 --- a/site/e2e/hooks.ts +++ b/site/e2e/hooks.ts @@ -3,16 +3,14 @@ import type { BrowserContext, Page } from "@playwright/test"; import { coderPort, gitAuth } from "./constants"; export const beforeCoderTest = async (page: Page) => { - // eslint-disable-next-line no-console -- Show everything that was printed with console.log() - page.on("console", (msg) => console.log(`[onConsole] ${msg.text()}`)); + page.on("console", (msg) => console.info(`[onConsole] ${msg.text()}`)); page.on("request", (request) => { if (!isApiCall(request.url())) { return; } - // eslint-disable-next-line no-console -- Log HTTP requests for debugging purposes - console.log( + console.info( `[onRequest] method=${request.method()} url=${request.url()} postData=${ request.postData() ? request.postData() : "" }`, @@ -40,8 +38,7 @@ export const beforeCoderTest = async (page: Page) => { responseText = "not_available"; } - // eslint-disable-next-line no-console -- Log HTTP requests for debugging purposes - console.log( + console.info( `[onResponse] url=${response.url()} status=${response.status()} body=${responseText}`, ); }); diff --git a/site/e2e/proxy.ts b/site/e2e/proxy.ts index 29089cdd75879..b23f534261f76 100644 --- a/site/e2e/proxy.ts +++ b/site/e2e/proxy.ts @@ -14,14 +14,12 @@ export const startWorkspaceProxy = async ( }, }); cp.stdout.on("data", (data: Buffer) => { - // eslint-disable-next-line no-console -- Log wsproxy activity - console.log( + console.info( `[wsproxy] [stdout] [onData] ${data.toString().replace(/\n$/g, "")}`, ); }); cp.stderr.on("data", (data: Buffer) => { - // eslint-disable-next-line no-console -- Log wsproxy activity - console.log( + console.info( `[wsproxy] [stderr] [onData] ${data.toString().replace(/\n$/g, "")}`, ); }); diff --git a/site/e2e/reporter.ts b/site/e2e/reporter.ts index 21d67aa9809f0..00ad5ec83f26b 100644 --- a/site/e2e/reporter.ts +++ b/site/e2e/reporter.ts @@ -23,19 +23,19 @@ class CoderReporter implements Reporter { onBegin(config: FullConfig, suite: Suite) { this.config = config; - console.log(`==> Running ${suite.allTests().length} tests`); + console.info(`==> Running ${suite.allTests().length} tests`); } onTestBegin(test: TestCase) { this.testOutput.set(test.id, []); - console.log(`==> Starting test ${test.title}`); + console.info(`==> Starting test ${test.title}`); } onStdOut(chunk: string, test?: TestCase, _?: TestResult): void { // If there's no associated test, just print it now if (!test) { for (const line of logLines(chunk)) { - console.log(`[stdout] ${line}`); + console.info(`[stdout] ${line}`); } return; } @@ -58,12 +58,12 @@ class CoderReporter implements Reporter { async onTestEnd(test: TestCase, result: TestResult) { try { if (test.expectedStatus === "skipped") { - console.log(`==> Skipping test ${test.title}`); + console.info(`==> Skipping test ${test.title}`); this.skippedCount++; return; } - console.log(`==> Finished test ${test.title}: ${result.status}`); + console.info(`==> Finished test ${test.title}: ${result.status}`); if (result.status === "passed") { this.passedCount++; @@ -82,24 +82,24 @@ class CoderReporter implements Reporter { const outputFile = `test-results/debug-pprof-goroutine-${fsTestTitle}.txt`; await exportDebugPprof(outputFile); - console.log(`Data from pprof has been saved to ${outputFile}`); - console.log("==> Output"); + console.info(`Data from pprof has been saved to ${outputFile}`); + console.info("==> Output"); const output = this.testOutput.get(test.id)!; for (const [target, chunk] of output) { target.write(`${chunk.replace(/\n$/g, "")}\n`); } if (result.errors.length > 0) { - console.log("==> Errors"); + console.info("==> Errors"); for (const error of result.errors) { reportError(error); } } if (result.attachments.length > 0) { - console.log("==> Attachments"); + console.info("==> Attachments"); for (const attachment of result.attachments) { - console.log(attachment); + console.info(attachment); } } } finally { @@ -108,26 +108,26 @@ class CoderReporter implements Reporter { } onEnd(result: FullResult) { - console.log(`==> Tests ${result.status}`); + console.info(`==> Tests ${result.status}`); if (!enterpriseLicense) { - console.log( + console.info( "==> Enterprise tests were skipped, because no license was provided", ); } - console.log(`${this.passedCount} passed`); + console.info(`${this.passedCount} passed`); if (this.skippedCount > 0) { - console.log(`${this.skippedCount} skipped`); + console.info(`${this.skippedCount} skipped`); } if (this.failedTests.length > 0) { - console.log(`${this.failedTests.length} failed`); + console.info(`${this.failedTests.length} failed`); for (const test of this.failedTests) { - console.log(` ${test.location.file} › ${test.title}`); + console.info(` ${test.location.file} › ${test.title}`); } } if (this.timedOutTests.length > 0) { - console.log(`${this.timedOutTests.length} timed out`); + console.info(`${this.timedOutTests.length} timed out`); for (const test of this.timedOutTests) { - console.log(` ${test.location.file} › ${test.title}`); + console.info(` ${test.location.file} › ${test.title}`); } } } @@ -157,16 +157,16 @@ const exportDebugPprof = async (outputFile: string) => { const reportError = (error: TestError) => { if (error.location) { - console.log(`${error.location.file}:${error.location.line}:`); + console.info(`${error.location.file}:${error.location.line}:`); } if (error.snippet) { - console.log(error.snippet); + console.info(error.snippet); } if (error.message) { - console.log(error.message); + console.info(error.message); } else { - console.log(error); + console.info(error); } }; diff --git a/site/e2e/tests/webTerminal.spec.ts b/site/e2e/tests/webTerminal.spec.ts index 68a7620bdeb98..fd288470d180e 100644 --- a/site/e2e/tests/webTerminal.spec.ts +++ b/site/e2e/tests/webTerminal.spec.ts @@ -63,7 +63,7 @@ test("web terminal", async ({ context, page }) => { } catch (error) { const pageContent = await terminal.content(); // eslint-disable-next-line no-console -- Let's see what is inside of xterm-rows - console.log("Unable to find echoed text:", pageContent); + console.error("Unable to find echoed text:", pageContent); throw error; } diff --git a/site/src/contexts/useProxyLatency.ts b/site/src/contexts/useProxyLatency.ts index ce55c83faac7b..334638bc9314d 100644 --- a/site/src/contexts/useProxyLatency.ts +++ b/site/src/contexts/useProxyLatency.ts @@ -162,8 +162,8 @@ export const useProxyLatency = ( } else { // This is the total duration of the request and will be off by a good margin. // This is a fallback if the better timing is not available. - // eslint-disable-next-line no-console -- We can remove this when we display the "accurate" bool on the UI - console.log( + // We can remove this when we display the "accurate" bool on the UI + console.warn( `Using fallback latency calculation for "${entry.name}". Latency will be incorrect and larger then actual.`, ); latencyMS = entry.duration;