Skip to content

Commit a2313df

Browse files
committed
refactor(webdriver): remove unused variables
Remove unused variables, imports, function parameters, etc.
1 parent a2e5483 commit a2313df

11 files changed

+23
-31
lines changed

webdriver-ts/.eslintrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
rules: {
1212
"prefer-const": "off",
1313
"@typescript-eslint/no-explicit-any": "off",
14-
"@typescript-eslint/no-unused-vars": "off",
1514
"require-await": "error",
1615
"@typescript-eslint/no-floating-promises": "error",
1716
},

webdriver-ts/src/benchmarkRunner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from "./benchmarksCommon.js";
2222
import { StartupBenchmarkResult } from "./benchmarksLighthouse.js";
2323
import { writeResults } from "./writeResults.js";
24-
import { PlausibilityCheck, parseCPUTrace } from "./timeline.js";
24+
import { PlausibilityCheck } from "./timeline.js";
2525

2626
function forkAndCallBenchmark(
2727
framework: FrameworkData,
@@ -128,6 +128,7 @@ async function runBenchmakLoop(
128128
framework: FrameworkData,
129129
benchmarkInfo: CPUBenchmarkInfo | MemBenchmarkInfo,
130130
benchmarkOptions: BenchmarkOptions,
131+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
131132
plausibilityCheck: PlausibilityCheck
132133
): Promise<{ errors: string[]; warnings: string[] }> {
133134
let warnings: string[] = [];

webdriver-ts/src/benchmarksPlaywright.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
cpuBenchmarkInfos,
1111
memBenchmarkInfos,
1212
} from "./benchmarksCommon.js";
13-
import { BenchmarkOptions, config, FrameworkData } from "./common.js";
13+
import { config, FrameworkData } from "./common.js";
1414
import {
1515
checkCountForSelector,
1616
checkElementContainsText,
@@ -266,7 +266,7 @@ export const benchReadyMemory = new (class extends MemBenchmarkPlaywright {
266266
async init(browser: Browser, page: Page) {
267267
await checkElementExists(page, "#run");
268268
}
269-
async run(browser: Browser, page: Page) {
269+
async run() {
270270
return await Promise.resolve(null);
271271
}
272272
})();

webdriver-ts/src/benchmarksPuppeteer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
BenchmarkImpl,
1111
MemBenchmarkInfo,
1212
} from "./benchmarksCommon.js";
13-
import { BenchmarkOptions, config, FrameworkData } from "./common.js";
13+
import { config, FrameworkData } from "./common.js";
1414
import {
1515
checkCountForSelector,
1616
checkElementContainsText,
@@ -283,7 +283,7 @@ export const benchReadyMemory = new (class extends MemBenchmarkPuppeteer {
283283
async init(page: Page) {
284284
await checkElementExists(page, "pierce/#run");
285285
}
286-
async run(page: Page) {
286+
async run() {
287287
return await Promise.resolve(null);
288288
}
289289
})();

webdriver-ts/src/benchmarksWebdriverCDP.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
cpuBenchmarkInfos,
66
CPUBenchmarkInfo,
77
} from "./benchmarksCommon.js";
8-
import { BenchmarkOptions, config, FrameworkData } from "./common.js";
8+
import { config, FrameworkData } from "./common.js";
99
import {
1010
clickElementById,
1111
clickElementByXPath,

webdriver-ts/src/forkedBenchmarkRunnerWebdriverCDP.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ async function runCPUBenchmark(
151151
},
152152
});
153153

154-
let p = new Promise((resolve, reject) => {
154+
let p = new Promise((resolve) => {
155155
cdpConnection._wsConnection.on("message", async (msg: any) => {
156156
let message: any = JSON.parse(msg);
157157
// console.log("####", typeof message, message.method, Object.keys(message), message);

webdriver-ts/src/isCSPCompliant.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ let allArgs = args._.length <= 2 ? [] : args._.slice(2, args._.length);
4545

4646
console.log("args.framework", args.framework, !args.framework);
4747

48-
async function runBench(frameworkNames: string[]) {
48+
async function runBench(
49+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
50+
frameworkNames: string[] // Not used in the function, but is used when calling the function in other files
51+
) {
4952
let runFrameworks;
5053
let matchesDirectoryArg = (directoryName: string) =>
5154
allArgs.length == 0 || allArgs.some((arg: string) => arg == directoryName);

webdriver-ts/src/isKeyed.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ export async function checkTRcorrect(page: Page): Promise<boolean> {
285285
return true;
286286
}
287287

288-
async function runBench(frameworkNames: string[]) {
288+
async function runBench(
289+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
290+
frameworkNames: string[] // Not used in the function, but is used when calling the function in other files
291+
) {
289292
let runFrameworks;
290293
let matchesDirectoryArg = (directoryName: string) =>
291294
frameworkArgument.length == 0 || frameworkArgument.some((arg: string) => arg == directoryName);

webdriver-ts/src/parseTrace.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
import {
2-
BenchmarkInfo,
3-
BenchmarkType,
4-
CPUBenchmarkInfo,
5-
cpuBenchmarkInfos,
6-
CPUBenchmarkResult,
7-
} from "./benchmarksCommon.js";
8-
import { BenchmarkOptions, config, FrameworkData, initializeFrameworks } from "./common.js";
9-
import {
10-
computeResultsCPU,
11-
computeResultsJS,
12-
parseCPUTrace,
13-
PlausibilityCheck,
14-
} from "./timeline.js";
15-
import { writeResults } from "./writeResults.js";
1+
import { cpuBenchmarkInfos } from "./benchmarksCommon.js";
2+
import { BenchmarkOptions, config, initializeFrameworks } from "./common.js";
3+
import { computeResultsCPU, parseCPUTrace, PlausibilityCheck } from "./timeline.js";
164

175
async function debugSingle() {
186
// for (let i = 0; i < 12; i++) {
@@ -29,6 +17,7 @@ async function debugSingle() {
2917
// }
3018
}
3119

20+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3221
async function debugAll() {
3322
let benchmarkOptions: BenchmarkOptions = {
3423
port: 8080,

webdriver-ts/src/timeline.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as R from "ramda";
44
import { BenchmarkType, CPUBenchmarkInfo, CPUBenchmarkResult } from "./benchmarksCommon.js";
55
import { BenchmarkOptions, FrameworkData, Config, config } from "./common.js";
66
import { writeResults } from "./writeResults.js";
7-
import { start } from "repl";
87

98
interface TimingResult {
109
type: string;
@@ -211,10 +210,7 @@ function logEvents(events: TimingResult[], click: TimingResult) {
211210
});
212211
}
213212

214-
export async function computeResultsCPU(
215-
fileName: string,
216-
warning_logger: (...msg: any) => void = console.log
217-
): Promise<CPUDurationResult> {
213+
export async function computeResultsCPU(fileName: string): Promise<CPUDurationResult> {
218214
const perfLogEvents = await fetchEventsFromPerformanceLog(fileName);
219215
let events = R.sortBy((e: TimingResult) => e.end)(perfLogEvents);
220216

0 commit comments

Comments
 (0)