chore: enable noConsoleLog lint (#14329)

This commit is contained in:
Kayla Washburn-Love
2024-08-16 10:12:06 -06:00
committed by GitHub
parent 2c150d03f6
commit 7142cbb9e6
7 changed files with 33 additions and 39 deletions
+1
View File
@@ -16,6 +16,7 @@
},
"suspicious": {
"noArrayIndexKey": { "level": "off" },
"noConsoleLog": { "level": "error" },
"noThenProperty": { "level": "off" }
},
"nursery": {
+2 -4
View File
@@ -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, "")}`,
);
});
+3 -6
View File
@@ -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}`,
);
});
+2 -4
View File
@@ -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, "")}`,
);
});
+22 -22
View File
@@ -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);
}
};
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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;