Skip to content

Commit 72eb138

Browse files
committed
fix: eslint errors
1 parent 1e2680f commit 72eb138

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default [
2626
"unicorn/prefer-ternary": "off",
2727
"unicorn/require-number-to-fixed-digits-argument": "off",
2828
"unicorn/prefer-set-has": "off",
29-
"unicorn/unicorn/no-array-reduce": "off",
29+
"unicorn/no-array-reduce": "off",
3030
// maybe not:
3131
"unicorn/consistent-function-scoping": "off",
3232
"unicorn/no-array-for-each": "off",

webdriver-ts-results/src/Common.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export class TableResultValueEntry {
171171
public bgColor: string,
172172
public textColor: string,
173173
public statisticResult: StatisticResult,
174+
// eslint-disable-next-line unicorn/no-useless-undefined
174175
public statisticallySignificantFactor: string | number | undefined = undefined
175176
) {}
176177
}
@@ -331,6 +332,7 @@ export class ResultTableData {
331332
sortBy(sortKey: string): void {
332333
const zipped = this.frameworks.map((f, frameworkIndex) => {
333334
let sortValue;
335+
// eslint-disable-next-line unicorn/prefer-switch
334336
if (sortKey === SORT_BY_NAME) sortValue = f.name;
335337
else if (sortKey === SORT_BY_GEOMMEAN_CPU)
336338
sortValue = this.getResult(BenchmarkType.CPU).geomMean[frameworkIndex]!.mean || Number.POSITIVE_INFINITY;
@@ -358,7 +360,7 @@ export class ResultTableData {
358360
else if (sizeIdx > -1)
359361
sortValue =
360362
this.getResult(BenchmarkType.SIZE).results[sizeIdx][frameworkIndex]?.value ?? Number.POSITIVE_INFINITY;
361-
else throw Error(`sortKey ${sortKey} not found`);
363+
else throw new Error(`sortKey ${sortKey} not found`);
362364
}
363365
return {
364366
framework: f,
@@ -396,12 +398,12 @@ export class ResultTableData {
396398
0.5277091212292658, 0.5644449600965534, 0.5508359820582848, 0.4225836631419211,
397399
];
398400
} else {
399-
benchmarkWeights = new Array(benchmarks.length).fill(1);
401+
benchmarkWeights = Array.from<number>({ length: benchmarks.length }).fill(1);
400402
}
401403

402404
let gMean = 0.0;
403405
resultsForFramework.forEach((r, idx) => {
404-
if (r !== null && !isNaN(r.factor)) {
406+
if (r !== null && !Number.isNaN(r.factor)) {
405407
gMean += benchmarkWeights[idx] * Math.log(r.factor);
406408
}
407409
});
@@ -460,6 +462,7 @@ export class ResultTableData {
460462
return result.results[resultsKey].mean;
461463
}
462464
};
465+
463466
const min = Math.max(
464467
benchmarkResults.reduce(
465468
(min, result) => (result === null ? min : Math.min(min, selectFn(result))),
@@ -504,8 +507,8 @@ export class ResultTableData {
504507

505508
// X1,..,Xn: this Framework, Y1, ..., Ym: selected Framework
506509
// https://de.wikipedia.org/wiki/Zweistichproben-t-Test
507-
let statisticalResult = undefined;
508-
let statisticalCol = undefined;
510+
let statisticalResult;
511+
let statisticalCol;
509512
const compareWithMean = compareWithResultsValues.mean;
510513
const stdDev = resultValues.standardDeviation || 0;
511514
const compareWithResultsStdDev = compareWithResultsValues.standardDeviation || 0;

webdriver-ts-results/src/components/ResultTable/ResultTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const ResultTable = ({ type }: Props) => {
3737

3838
if (
3939
!data ||
40-
!data.frameworks.length ||
41-
(!data.getResult(BenchmarkType.CPU).benchmarks.length &&
42-
!data.getResult(BenchmarkType.STARTUP).benchmarks.length &&
43-
!data.getResult(BenchmarkType.MEM).benchmarks.length)
40+
data.frameworks.length === 0 ||
41+
(data.getResult(BenchmarkType.CPU).benchmarks.length === 0 &&
42+
data.getResult(BenchmarkType.STARTUP).benchmarks.length === 0 &&
43+
data.getResult(BenchmarkType.MEM).benchmarks.length === 0)
4444
) {
4545
return null;
4646
}
@@ -66,7 +66,7 @@ const ResultTable = ({ type }: Props) => {
6666
</h3>
6767
)}
6868
{displayMode === DisplayMode.BoxPlot ? (
69-
benchmarks.length && (
69+
benchmarks.length > 0 && (
7070
<React.Suspense fallback={<div>Loading...</div>}>
7171
<BoxPlotTable
7272
results={data.results}

webdriver-ts-results/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createRoot } from "react-dom/client";
55
import "./index.css";
66
import "./assets/styles/global.css";
77

8-
createRoot(document.getElementById("root")!).render(
8+
createRoot(document.querySelector("#root")!).render(
99
<React.StrictMode>
1010
<App />
1111
</React.StrictMode>

webdriver-ts-results/src/reducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const results: Result[] = rawResults.map((result) => {
3535
});
3636

3737
const removeKeyedSuffix = (value: string) => {
38-
if (value.endsWith("-non-keyed")) return value.substring(0, value.length - 10);
39-
else if (value.endsWith("-keyed")) return value.substring(0, value.length - 6);
38+
if (value.endsWith("-non-keyed")) return value.slice(0, -10);
39+
else if (value.endsWith("-keyed")) return value.slice(0, -6);
4040
return value;
4141
};
4242

0 commit comments

Comments
 (0)