Skip to content

Commit 0f75bd8

Browse files
committed
remove trailing console spaces
1 parent c5361d9 commit 0f75bd8

16 files changed

+143
-86
lines changed

eslint.config.js

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,12 @@ import ts from "@typescript-eslint/eslint-plugin";
44
import tsParser from "@typescript-eslint/parser";
55
import react from "eslint-plugin-react";
66
import reactHooks from "eslint-plugin-react-hooks";
7+
import unicorn from "eslint-plugin-unicorn";
78

89
export default [
910
js.configs.recommended,
1011
{
11-
ignores: [
12-
"**/dist",
13-
"**/results",
14-
"**/node_modules",
15-
"css",
16-
"**/csv_export.js",
17-
],
12+
ignores: ["**/dist", "**/results", "**/node_modules", "css", "**/csv_export.js"],
1813
},
1914
{
2015
files: ["**/*.{ts,tsx}"],
@@ -28,6 +23,9 @@ export default [
2823
{
2924
files: ["*.js", "utils/**/*", "cli/**/*.js"],
3025
languageOptions: { globals: { ...globals.node } },
26+
rules: {
27+
"no-unused-vars": "warn",
28+
},
3129
},
3230
/**
3331
* Server
@@ -41,11 +39,69 @@ export default [
4139
*/
4240
{
4341
files: ["webdriver-ts/**/*.ts"],
42+
plugins: { unicorn },
4443
languageOptions: {
4544
parserOptions: { project: ["./webdriver-ts/tsconfig.eslint.json"] },
4645
globals: { ...globals.node },
4746
},
4847
rules: {
48+
"unicorn/no-console-spaces": "error",
49+
// "unicorn/filename-case": "error",
50+
// "unicorn/better-regex": "error",
51+
// "unicorn/catch-error-name": "error",
52+
// "unicorn/consistent-destructuring": "error",
53+
// "unicorn/consistent-function-scoping": "error",
54+
// "unicorn/custom-error-definition": "off",
55+
// "unicorn/empty-brace-spaces": "error",
56+
// "unicorn/error-message": "error",
57+
// "unicorn/escape-case": "error",
58+
// "unicorn/expiring-todo-comments": "error",
59+
// "unicorn/explicit-length-check": "error",
60+
// "unicorn/import-style": "error",
61+
// "unicorn/new-for-builtins": "error",
62+
// "unicorn/no-abusive-eslint-disable": "error",
63+
// "unicorn/no-array-callback-reference": "error",
64+
// "unicorn/no-array-for-each": "error",
65+
// "unicorn/no-array-method-this-argument": "error",
66+
// "unicorn/no-array-push-push": "error",
67+
// "unicorn/no-array-reduce": "error",
68+
// "unicorn/no-await-expression-member": "error",
69+
// "unicorn/no-console-spaces": "error",
70+
// "unicorn/no-document-cookie": "error",
71+
// "unicorn/no-empty-file": "error",
72+
// "unicorn/no-for-loop": "error",
73+
// "unicorn/no-hex-escape": "error",
74+
// "unicorn/no-instanceof-array": "error",
75+
// "unicorn/no-invalid-remove-event-listener": "error",
76+
// "unicorn/no-keyword-prefix": "off",
77+
// "unicorn/no-lonely-if": "error",
78+
// "no-negated-condition": "off",
79+
// "unicorn/no-negated-condition": "error",
80+
// "no-nested-ternary": "off",
81+
// "unicorn/no-nested-ternary": "error",
82+
// "unicorn/no-new-array": "error",
83+
// "unicorn/no-new-buffer": "error",
84+
// "unicorn/no-null": "error",
85+
// "unicorn/no-object-as-default-parameter": "error",
86+
// "unicorn/no-process-exit": "error",
87+
// "unicorn/no-static-only-class": "error",
88+
// "unicorn/no-thenable": "error",
89+
// "unicorn/no-this-assignment": "error",
90+
// "unicorn/no-typeof-undefined": "error",
91+
// "unicorn/no-unnecessary-await": "error",
92+
// "unicorn/no-unreadable-array-destructuring": "error",
93+
// "unicorn/no-unreadable-iife": "error",
94+
// "unicorn/no-unused-properties": "off",
95+
// "unicorn/no-useless-fallback-in-spread": "error",
96+
// "unicorn/no-useless-length-check": "error",
97+
// "unicorn/no-useless-promise-resolve-reject": "error",
98+
// "unicorn/no-useless-spread": "error",
99+
// "unicorn/no-useless-switch-case": "error",
100+
// "unicorn/no-useless-undefined": "error",
101+
// "unicorn/no-zero-fractions": "error",
102+
// "unicorn/number-literal-case": "error",
103+
// "unicorn/numeric-separators-style": "error",
104+
49105
"no-unused-vars": "off",
50106
"@typescript-eslint/no-explicit-any": "off",
51107
"@typescript-eslint/no-unused-vars": "off",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"adm-zip": "^0.5.10",
4646
"commander": "^11.0.0",
4747
"cross-env": "^7.0.3",
48+
"eslint-plugin-unicorn": "^49.0.0",
4849
"json5": "^2.2.3",
4950
"rimraf": "^5.0.5",
5051
"yargs": "^17.7.2"

webdriver-ts/src/benchmarkRunner.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function forkAndCallBenchmark(
4343
} else {
4444
forkedRunner = "dist/forkedBenchmarkRunnerPuppeteer.js";
4545
}
46-
console.log("forking ", forkedRunner);
46+
console.log("forking", forkedRunner);
4747
const forked = fork(forkedRunner);
4848
if (config.LOG_DETAILS) console.log("FORKING: forked child process");
4949
forked.send({
@@ -87,7 +87,7 @@ async function runBenchmakLoopStartup(
8787
console.log("runBenchmakLoopStartup", framework, benchmarkInfo);
8888

8989
while (done < count) {
90-
console.log("FORKING: ", benchmarkInfo.id, " BatchSize ", benchmarkOptions.batchSize);
90+
console.log("FORKING:", benchmarkInfo.id, "BatchSize", benchmarkOptions.batchSize);
9191
let res = await forkAndCallBenchmark(framework, benchmarkInfo, benchmarkOptions);
9292
if (Array.isArray(res.result)) {
9393
results = results.concat(res.result as StartupBenchmarkResult[]);
@@ -105,7 +105,7 @@ async function runBenchmakLoopStartup(
105105
}
106106
done++;
107107
}
108-
console.log("******* result ", results);
108+
console.log("******* result", results);
109109
if (config.WRITE_RESULTS) {
110110
await writeResults(benchmarkOptions.resultsDirectory, {
111111
framework: framework,
@@ -146,7 +146,7 @@ async function runBenchmakLoop(
146146

147147
while (results.length < count) {
148148
benchmarkOptions.batchSize = Math.min(benchmarkOptions.batchSize, count - results.length);
149-
console.log("FORKING: ", benchmarkInfo.id, " BatchSize ", benchmarkOptions.batchSize);
149+
console.log("FORKING:", benchmarkInfo.id, "BatchSize", benchmarkOptions.batchSize);
150150
let res = await forkAndCallBenchmark(framework, benchmarkInfo, benchmarkOptions);
151151
if (Array.isArray(res.result)) {
152152
results = results.concat(res.result as number[] | CPUBenchmarkResult[]);
@@ -166,15 +166,15 @@ async function runBenchmakLoop(
166166
}
167167
}
168168
if (benchmarkInfo.type == BenchmarkType.CPU) {
169-
console.log("CPU results before: ", results);
169+
console.log("CPU results before:", results);
170170
// (results as CPUBenchmarkResult[]).sort(
171171
// (a: CPUBenchmarkResult, b: CPUBenchmarkResult) => a.total - b.total
172172
// );
173173
// results = results.slice(0, config.NUM_ITERATIONS_FOR_BENCHMARK_CPU);
174174
// console.log("CPU results after: ", results)
175175
}
176176

177-
console.log("******* result ", results);
177+
console.log("******* result", results);
178178
if (config.WRITE_RESULTS) {
179179
if (benchmarkInfo.type == BenchmarkType.CPU) {
180180
await writeResults(benchmarkOptions.resultsDirectory, {
@@ -330,7 +330,7 @@ async function main() {
330330
]);
331331
process.exit(1);
332332
}
333-
console.log("HEADLESS*** ", args.headless);
333+
console.log("HEADLESS***", args.headless);
334334

335335
let benchmarkOptions: BenchmarkOptions = {
336336
port: 8080,
@@ -393,7 +393,7 @@ async function main() {
393393
cpuBenchmarkInfosArray.forEach((b) => {
394394
b.additionalNumberOfRuns = 0;
395395
});
396-
console.log("Using smoketest config ", JSON.stringify(config));
396+
console.log("Using smoketest config", JSON.stringify(config));
397397
}
398398
if (config.BENCHMARK_RUNNER == BenchmarkRunner.WEBDRIVER_AFTERFRAME) {
399399
benchmarkOptions.resultsDirectory = "results_client_" + benchmarkOptions.browser;

webdriver-ts/src/benchmarksWebdriverAfterframe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ async function measureClickForElement(driver: WebDriver, elem: WebElement) {
9898
elem
9999
)) as number;
100100
durations.push(duration);
101-
console.log("computed duration ", duration);
101+
console.log("computed duration", duration);
102102
}
103103

104104
async function measureClickElementById(driver: WebDriver, id: string, isInButtonArea: boolean) {
105105
let elem = await findById(driver, id, isInButtonArea);
106-
console.log("measureClickElementById: ", elem);
106+
console.log("measureClickElementById:", elem);
107107
await measureClickForElement(driver, elem);
108108
}
109109

webdriver-ts/src/forkedBenchmarkRunnerLighthouse.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ function convertError(error: any): string {
7979
error,
8080
"| type:",
8181
typeof error,
82-
" instance of Error",
82+
"instance of Error",
8383
error instanceof Error,
84-
" Message: ",
84+
"Message:",
8585
error.message
8686
);
8787
if (typeof error === "string") {
@@ -133,7 +133,7 @@ export async function executeBenchmark(
133133

134134
process.on("message", (msg: any) => {
135135
config = msg.config;
136-
console.log("START BENCHMARK. Write results? ", config.WRITE_RESULTS);
136+
console.log("START BENCHMARK. Write results?", config.WRITE_RESULTS);
137137
// if (config.LOG_DEBUG) console.log("child process got message", msg);
138138

139139
let {

webdriver-ts/src/forkedBenchmarkRunnerPlaywright.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async function runBenchmark(
1919
framework: FrameworkData
2020
): Promise<any> {
2121
await benchmark.run(browser, page, framework);
22-
if (config.LOG_PROGRESS) console.log("after run ", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
22+
if (config.LOG_PROGRESS) console.log("after run", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
2323
}
2424

2525
async function initBenchmark(
@@ -29,7 +29,7 @@ async function initBenchmark(
2929
framework: FrameworkData
3030
): Promise<any> {
3131
await benchmark.init(browser, page, framework);
32-
if (config.LOG_PROGRESS) console.log("after initialized ", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
32+
if (config.LOG_PROGRESS) console.log("after initialized", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
3333
// if (benchmark.type === BenchmarkType.MEM) {
3434
// await forceGC(page);
3535
// }
@@ -43,9 +43,9 @@ function convertError(error: any): string {
4343
error,
4444
"| type:",
4545
typeof error,
46-
" instance of Error",
46+
"instance of Error",
4747
error instanceof Error,
48-
" Message: ",
48+
"Message:",
4949
error.message
5050
);
5151
if (typeof error === "string") {
@@ -77,7 +77,7 @@ async function runCPUBenchmark(
7777
let warnings: string[] = [];
7878
let results: CPUBenchmarkResult[] = [];
7979

80-
console.log("benchmarking ", framework, benchmark.benchmarkInfo.id);
80+
console.log("benchmarking", framework, benchmark.benchmarkInfo.id);
8181
let browser: Browser = null;
8282
let page: Page = null;
8383
try {
@@ -151,7 +151,7 @@ async function runCPUBenchmark(
151151
}
152152
let result = await computeResultsCPU(fileNameTrace(framework, benchmark.benchmarkInfo, i, benchmarkOptions));
153153
let resultScript = (m2_val - m1_val) * 1000.0;
154-
console.log("**** resultScript = ", resultScript);
154+
console.log("**** resultScript =", resultScript);
155155
if (m2_Timestamp == m1_Timestamp) throw new Error("Page metrics timestamp didn't change");
156156

157157
results.push({ total: result.duration, script: resultScript });
@@ -160,7 +160,7 @@ async function runCPUBenchmark(
160160
}
161161
return { error, warnings, result: results };
162162
} catch (e) {
163-
console.log("ERROR ", e);
163+
console.log("ERROR", e);
164164
error = convertError(e);
165165
return { error, warnings };
166166
} finally {
@@ -190,7 +190,7 @@ async function runMemBenchmark(
190190
let warnings: string[] = [];
191191
let results: number[] = [];
192192

193-
console.log("benchmarking ", framework, benchmark.benchmarkInfo.id);
193+
console.log("benchmarking", framework, benchmark.benchmarkInfo.id);
194194
let browser: Browser = null;
195195
try {
196196
browser = await startBrowser(benchmarkOptions);
@@ -234,7 +234,7 @@ async function runMemBenchmark(
234234
await browser.close();
235235
return { error, warnings, result: results };
236236
} catch (e) {
237-
console.log("ERROR ", e);
237+
console.log("ERROR", e);
238238
error = convertError(e);
239239
try {
240240
if (browser) {

webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ let config: Config = defaultConfig;
99

1010
async function runBenchmark(page: Page, benchmark: BenchmarkPuppeteer, framework: FrameworkData): Promise<any> {
1111
await benchmark.run(page, framework);
12-
if (config.LOG_PROGRESS) console.log("after run ", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
12+
if (config.LOG_PROGRESS) console.log("after run", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
1313
}
1414

1515
async function initBenchmark(page: Page, benchmark: BenchmarkPuppeteer, framework: FrameworkData): Promise<any> {
1616
await benchmark.init(page, framework);
1717
if (config.LOG_PROGRESS)
18-
console.log("after initialized ", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
18+
console.log("after initialized", benchmark.benchmarkInfo.id, benchmark.type, framework.name);
1919
}
2020

2121
const wait = (delay = 1000) => new Promise((res) => setTimeout(res, delay));
@@ -26,9 +26,9 @@ function convertError(error: any): string {
2626
error,
2727
"| type:",
2828
typeof error,
29-
" instance of Error",
29+
"instance of Error",
3030
error instanceof Error,
31-
" Message: ",
31+
"Message:",
3232
error.message
3333
);
3434
if (typeof error === "string") {
@@ -60,7 +60,7 @@ async function runCPUBenchmark(
6060
let warnings: string[] = [];
6161
let results: CPUBenchmarkResult[] = [];
6262

63-
console.log("benchmarking ", framework, benchmark.benchmarkInfo.id);
63+
console.log("benchmarking", framework, benchmark.benchmarkInfo.id);
6464
let browser: Browser = null;
6565
let page: Page = null;
6666
try {
@@ -146,15 +146,15 @@ async function runCPUBenchmark(
146146
config,
147147
fileNameTrace(framework, benchmark.benchmarkInfo, i, benchmarkOptions)
148148
);
149-
console.log("**** resultScript = ", resultScript);
149+
console.log("**** resultScript =", resultScript);
150150
if (m2.Timestamp == m1.Timestamp) throw new Error("Page metrics timestamp didn't change");
151151
results.push({ total: result.duration, script: resultScript });
152152
console.log(`duration for ${framework.name} and ${benchmark.benchmarkInfo.id}: ${JSON.stringify(result)}`);
153153
if (result.duration < 0) throw new Error(`duration ${result} < 0`);
154154
}
155155
return { error, warnings, result: results };
156156
} catch (e) {
157-
console.log("ERROR ", e);
157+
console.log("ERROR", e);
158158
error = convertError(e);
159159
return { error, warnings };
160160
} finally {
@@ -180,7 +180,7 @@ async function runMemBenchmark(
180180
let warnings: string[] = [];
181181
let results: number[] = [];
182182

183-
console.log("benchmarking ", framework, benchmark.benchmarkInfo.id);
183+
console.log("benchmarking", framework, benchmark.benchmarkInfo.id);
184184
let browser: Browser = null;
185185
try {
186186
browser = await startBrowser(benchmarkOptions);
@@ -230,7 +230,7 @@ async function runMemBenchmark(
230230
await browser.close();
231231
return { error, warnings, result: results };
232232
} catch (e) {
233-
console.log("ERROR ", e);
233+
console.log("ERROR", e);
234234
error = convertError(e);
235235
try {
236236
if (browser) {
@@ -268,7 +268,7 @@ export async function executeBenchmark(
268268

269269
process.on("message", (msg: any) => {
270270
config = msg.config;
271-
console.log("START BENCHMARK. Write results? ", config.WRITE_RESULTS);
271+
console.log("START BENCHMARK. Write results?", config.WRITE_RESULTS);
272272
// if (config.LOG_DEBUG) console.log("child process got message", msg);
273273

274274
let {

0 commit comments

Comments
 (0)