Skip to content

Commit cc3a1a2

Browse files
committed
refactor(web-ts-results): fix warnings & errors
1 parent c3251f2 commit cc3a1a2

File tree

10 files changed

+21
-16
lines changed

10 files changed

+21
-16
lines changed

webdriver-ts-results/src/Common.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3-
// eslint-disable-next-line @typescript-eslint/no-var-requires
4-
const jStat = require('jstat').jStat;
2+
import { jStat } from "jstat"
53

64
export enum StatisticResult {Slower, Undecided, Faster}
75
export enum DisplayMode { DisplayMean, DisplayMedian, BoxPlot }

webdriver-ts-results/src/ResultTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ResultTable = ({type}: Props): JSX.Element|null => {
3434
<div key={texts[type].label}>
3535
<h1>{texts[type].label}</h1>
3636
<p>{texts[type].description}</p>
37-
{cpuDurationMode==CpuDurationMode.Script && <h3>Warning: This is an experimental view. Don't rely on those values yet.</h3>}
37+
{cpuDurationMode==CpuDurationMode.Script && <h3>Warning: This is an experimental view. Don&apos;t rely on those values yet.</h3>}
3838
{
3939
displayMode === DisplayMode.BoxPlot ?
4040
(

webdriver-ts-results/src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import App from './App';
33
import {Provider} from 'react-redux'
44
import { createStore } from 'redux'
55
import { reducer } from './reducer';
6+
import { createRoot } from 'react-dom/client';
67

78
const store = createStore(reducer)
89

9-
import { createRoot } from 'react-dom/client';
1010

1111
window.onload = () => {
1212

13+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1314
const root = createRoot(document.getElementById('root')!);
1415

1516
root.render(

webdriver-ts-results/src/reducer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { Benchmark, BenchmarkType, convertToMap, DisplayMode, Framework, FrameworkType, RawResult, Result, ResultTableData, SORT_BY_GEOMMEAN_CPU, Severity, ResultValues, CpuDurationMode, knownIssues } from "./Common"
1+
import { Benchmark, BenchmarkType, convertToMap, DisplayMode, Framework, FrameworkType, RawResult, Result, ResultTableData, SORT_BY_GEOMMEAN_CPU, ResultValues, CpuDurationMode, knownIssues } from "./Common"
22
import { benchmarks as benchmark_orig, frameworks, results as rawResults } from './results';
3+
import { jStat } from "jstat";
34

45
// Temporarily disable script bootup time
56
//const benchmarks = benchmark_orig;
67
const benchmarks = benchmark_orig.filter(b => b.id !== '32_startup-bt'
78
&& b.id !== '33_startup-mainthreadcost');
8-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9-
// eslint-disable-next-line @typescript-eslint/no-var-requires
10-
const jStat = require('jstat').jStat;
9+
1110

1211
const results: Result[] = (rawResults as RawResult[]).map(res => {
1312
const values: {[k: string]: ResultValues} = {};
@@ -29,7 +28,7 @@ const removeKeyedSuffix = (value: string) => {
2928
else if (value.endsWith('-keyed')) return value.substring(0, value.length - 6)
3029
return value;
3130
}
32-
const mappedFrameworks = frameworks.map((f:any) => ({ name: f.name, dir: f.dir, displayname: removeKeyedSuffix(f.name), issues: f.issues ?? [], type: f.keyed ? FrameworkType.KEYED : FrameworkType.NON_KEYED, frameworkHomeURL: f.frameworkHomeURL }));
31+
const mappedFrameworks = frameworks.map((f) => ({ name: f.name, dir: f.dir, displayname: removeKeyedSuffix(f.name), issues: f.issues ?? [], type: f.keyed ? FrameworkType.KEYED : FrameworkType.NON_KEYED, frameworkHomeURL: f.frameworkHomeURL }));
3332

3433
const allBenchmarks = benchmarks.reduce((set, b) => set.add(b), new Set<Benchmark>());
3534
const allFrameworks = mappedFrameworks.reduce((set, f) => set.add(f), new Set<Framework>());

webdriver-ts-results/src/results.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-loss-of-precision */
12
import {RawResult} from './Common';
23

34
export const results: RawResult[]=[

webdriver-ts-results/src/tables/BoxPlotTable.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect, useRef } from 'react'
22
import {SORT_BY_NAME, Benchmark, Framework, ResultLookup, CpuDurationMode} from '../Common';
3-
// eslint-disable-next-line @typescript-eslint/no-var-requires
4-
const Plotly = require('plotly.js-cartesian-dist');
3+
import Plotly from 'plotly.js-cartesian-dist';
54

65
interface BoxPlotData {
76
framework: string;

webdriver-ts-results/src/tables/CpuResultsTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import {ResultTableData, SORT_BY_NAME, SORT_BY_GEOMMEAN_CPU, BenchmarkType, Framework} from '../Common';
2+
import {ResultTableData, SORT_BY_NAME, SORT_BY_GEOMMEAN_CPU, BenchmarkType} from '../Common';
33
import GeomMeanRow from './GeomMeanRow'
44
import CompareRow from './CompareRow'
55
import ValueResultRow from './ValueResultRow'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module "jstat" {
2+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3+
const jStat: any;
4+
export { jStat };
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare module "plotly.js-cartesian-dist" {
2+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3+
const Plotly: any;
4+
export = Plotly;
5+
}

webdriver-ts-results/src/typings/jstat.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)