Skip to content

Commit f3bccc5

Browse files
committed
fix eslint
1 parent 90e9f3c commit f3bccc5

18 files changed

+81
-92
lines changed

src/app/components/Chart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import * as d3 from 'd3';
2323
const colors = ['#95B6B7', '#475485', '#519331', '#AA5039', '#8B2F5F', '#C5B738', '#858DFF', '#FF8D02', '#FFCD51', '#ACDAE6', '#FC997E', '#CF93AD', '#AA3939', '#AA6C39', '#226666', '#2C4870'];
2424

2525
const filter = (data:any[]) => {
26-
console.log('data from filter', data)
2726
if (data[0].children && data[0].state === 'stateless') {
2827
return filter(data[0].children);
2928
}

src/app/components/ErrorHandler.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/* eslint-disable react/prop-types */
2+
/* eslint-disable semi */
3+
/* eslint-disable react/destructuring-assignment */
4+
/* eslint-disable no-console */
5+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
6+
/* eslint-disable @typescript-eslint/no-explicit-any */
17
import React from 'react';
28

39
class ErrorHandler extends React.Component {
@@ -7,7 +13,7 @@ class ErrorHandler extends React.Component {
713
}
814

915
componentDidCatch(error:string, info:string) {
10-
this.setState({ errorOccurred: true })
16+
this.setState({ errorOccurred: true });
1117
console.log('Error occurred in React Component: ', error, info);
1218
}
1319

src/app/components/MainSlider.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
13
/* eslint-disable react/jsx-props-no-spreading */
24
/* eslint-disable react/prop-types */
35
import React from 'react';
@@ -9,10 +11,10 @@ import { useStoreContext } from '../store';
911
const { Handle } = Slider;
1012

1113
interface handleProps {
12-
value: number,
13-
dragging: boolean,
14+
value: number,
15+
dragging: boolean,
1416
index: number
15-
};
17+
}
1618

1719
const handle = (props: handleProps) => {
1820
const {
@@ -34,10 +36,10 @@ const handle = (props: handleProps) => {
3436

3537
interface MainSliderProps {
3638
snapshotsLength: number;
37-
};
39+
}
3840

3941
function MainSlider(props: MainSliderProps) {
40-
const { snapshotsLength } = props
42+
const { snapshotsLength } = props;
4143
const [{ tabs, currentTab }, dispatch] = useStoreContext();
4244
const { sliderIndex } = tabs[currentTab];
4345

src/app/components/PerfView.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* eslint-disable max-len */
2+
/* eslint-disable @typescript-eslint/ban-types */
3+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
4+
/* eslint-disable @typescript-eslint/no-explicit-any */
5+
/* eslint-disable @typescript-eslint/no-unused-vars */
16
/* eslint-disable no-use-before-define */
27
/* eslint-disable react/no-this-in-sfc */
38
/* eslint-disable no-unused-vars */
@@ -23,15 +28,15 @@ import { schemeSet1 as colorScheme } from 'd3';
2328
// import { addNewSnapshots } from '../actions/actions.ts';
2429

2530
interface PerfViewProps {
26-
snapshots:any[];
27-
viewIndex:number;
31+
snapshots:any[];
32+
viewIndex:number;
2833
width: number;
2934
height: number;
3035
}
3136

3237
const PerfView = (props:PerfViewProps) => {
33-
const { snapshots, viewIndex, width, height } = props
34-
let adjustedSize = Math.min(width, height);
38+
const { snapshots, viewIndex, width, height } = props;
39+
const adjustedSize = Math.min(width, height);
3540
const svgRef = useRef(null);
3641

3742
// Figure out which snapshot index to use
@@ -79,7 +84,7 @@ const PerfView = (props:PerfViewProps) => {
7984
let view;
8085

8186
// Set up viewBox dimensions and onClick for parent svg
82-
87+
8388
// console.log("PerfView -> height", height)
8489
// console.log("PerfView -> width", width)
8590
// console.log("PerfView -> adjustedSize", adjustedSize)
@@ -107,7 +112,8 @@ const PerfView = (props:PerfViewProps) => {
107112
.style('fill-opacity', (d:{parent:object}) => (d.parent === packedRoot ? 1 : 0))
108113
.style('display', (d:{parent?:object}) => (d.parent === packedRoot ? 'inline' : 'none'))
109114
.text((d:{data:{name:string, componentData?:{actualDuration:any}}}) => {
110-
return `${d.data.name}: ${Number.parseFloat(d.data.componentData.actualDuration || 0).toFixed(2)}ms`});
115+
return `${d.data.name}: ${Number.parseFloat(d.data.componentData.actualDuration || 0).toFixed(2)}ms`;
116+
});
111117

112118
// Remove any unused nodes
113119
label.exit().remove();
@@ -129,7 +135,7 @@ const PerfView = (props:PerfViewProps) => {
129135
function zoomToNode(newFocus:{x:number; y:number; r:number}) {
130136
const transition = svg.transition()
131137
.duration(d3.event.altKey ? 7500 : 750)
132-
.tween('zoom', (d:object)=> {
138+
.tween('zoom', (d:object) => {
133139
const i = d3.interpolateZoom(view, [newFocus.x, newFocus.y, newFocus.r * 2]);
134140
return t => zoomViewArea(i(t));
135141
});
@@ -144,7 +150,7 @@ const PerfView = (props:PerfViewProps) => {
144150

145151
curFocus = newFocus;
146152
}
147-
}, [colorScale, packFunc, width, height, indexToDisplay, snapshots]);
153+
}, [colorScale, packFunc, width, height, indexToDisplay, snapshots, adjustedSize]);
148154

149155
return (
150156
<div className="perf-d3-container">
@@ -156,6 +162,5 @@ const PerfView = (props:PerfViewProps) => {
156162

157163
export default PerfView;
158164

159-
160165
// d3.quantize(d3.interpolateHcl('#60c96e', '#4d4193'), 10);
161166
// const colorScale = d3.scaleOrdinal(colorScheme);

src/app/components/StateRoute.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
2+
/* eslint-disable @typescript-eslint/no-explicit-any */
3+
/* eslint-disable @typescript-eslint/ban-types */
4+
/* eslint-disable @typescript-eslint/no-var-requires */
15
/* eslint-disable max-len */
26
/* eslint-disable object-curly-newline */
37
import React from 'react';
48
import { MemoryRouter as Router, Route, NavLink, Switch } from 'react-router-dom';
5-
6-
7-
const Chart = require('./Chart').default;
89
import Tree from './Tree';
910
import PerfView from './PerfView';
11+
12+
const Chart = require('./Chart').default;
1013
const ErrorHandler = require('./ErrorHandler').default;
1114

1215
const NO_STATE_MSG = 'No state change detected. Trigger an event to change state';
1316
// eslint-disable-next-line react/prop-types
1417

15-
1618
interface StateRouteProps {
17-
snapshot: { name?: string; componentData?: object; state?: string | object; stateSnaphot?: object; children?: any[]; };
18-
hierarchy: object;
19-
snapshots: [];
19+
snapshot: { name?: string; componentData?: object; state?: string | object; stateSnaphot?: object; children?: any[]; };
20+
hierarchy: object;
21+
snapshots: [];
2022
viewIndex: number;
2123
}
2224

2325
const StateRoute = (props:StateRouteProps) => {
24-
const { snapshot, hierarchy, snapshots, viewIndex } = props
26+
const { snapshot, hierarchy, snapshots, viewIndex } = props;
2527
// gabi :: the hierarchy get set on the first click in the page, when page in refreshed we don't have a hierarchy so we need to check if hierarchy was initialize involk render chart
2628
const renderChart = () => {
2729
if (hierarchy) {
@@ -42,7 +44,7 @@ const StateRoute = (props:StateRouteProps) => {
4244
if (hierarchy) {
4345
return (
4446
<ErrorHandler>
45-
<PerfView viewIndex={viewIndex} snapshots={snapshots} width={600} height={1000}/>
47+
<PerfView viewIndex={viewIndex} snapshots={snapshots} width={600} height={1000} />
4648
</ErrorHandler>
4749
);
4850
}
@@ -53,13 +55,13 @@ const StateRoute = (props:StateRouteProps) => {
5355
<Router>
5456
<div className="navbar">
5557
<NavLink className="router-link" activeClassName="is-active" exact to="/">
56-
Tree
58+
Tree
5759
</NavLink>
5860
<NavLink className="router-link" activeClassName="is-active" to="/chart">
59-
History
61+
History
6062
</NavLink>
6163
<NavLink className="router-link" activeClassName="is-active" to="/performance">
62-
Performance
64+
Performance
6365
</NavLink>
6466
</div>
6567
<Switch>
@@ -71,4 +73,4 @@ const StateRoute = (props:StateRouteProps) => {
7173
);
7274
};
7375

74-
export default StateRoute;
76+
export default StateRoute;

src/app/components/SwitchApp.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
13
import React from 'react';
24
import Select from 'react-select';
35
import { useStoreContext } from '../store';
46
import { setTab } from '../actions/actions';
57

6-
78
const SwitchAppDropdown = () => {
89
const [{ currentTab, tabs }, dispatch] = useStoreContext();
9-
10+
1011
const tabsArray:any[] = [];
1112
Object.keys(tabs).forEach(tab => {
1213
tabsArray.unshift({ value: tab, label: tabs[tab].title });

src/app/components/Tree.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* eslint-disable arrow-body-style */
2+
/* eslint-disable max-len */
3+
/* eslint-disable @typescript-eslint/no-explicit-any */
4+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
5+
/* eslint-disable @typescript-eslint/ban-types */
16
import React from 'react';
27
import JSONTree from 'react-json-tree';
38

@@ -15,8 +20,6 @@ interface TreeProps {
1520
const Tree = (props:TreeProps) => {
1621
const { snapshot } = props;
1722

18-
console.log('Tree -> snapshot', snapshot);
19-
2023
return (
2124
<>
2225
{snapshot && (
@@ -26,7 +29,7 @@ const Tree = (props:TreeProps) => {
2629
shouldExpandNode={() => true}
2730
getItemString={getItemString}
2831
labelRenderer={(raw:any[]) => {
29-
return (typeof raw[0] !== 'number' ? <span>{raw[0]}</span> : null)
32+
return (typeof raw[0] !== 'number' ? <span>{raw[0]}</span> : null);
3033
}}
3134
/>
3235
)}

src/app/containers/ActionContainer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* eslint-disable brace-style */
2+
/* eslint-disable max-len */
3+
/* eslint-disable @typescript-eslint/no-unused-vars */
4+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
5+
/* eslint-disable @typescript-eslint/no-explicit-any */
16
/* eslint-disable react/no-array-index-key */
27
/* eslint-disable no-inner-declarations */
38
import React from 'react';
@@ -15,7 +20,6 @@ const resetSlider = () => {
1520
function ActionContainer() {
1621
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1722
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
18-
console.log(tabs[currentTab])
1923
let actionsArr = [];
2024
const hierarchyArr:any[] = [];
2125

@@ -27,7 +31,7 @@ function ActionContainer() {
2731
displayName: `${obj.name}.${obj.branch}`,
2832
state: obj.stateSnapshot.children[0].state,
2933
componentName: obj.stateSnapshot.children[0].name,
30-
componentData: JSON.stringify(obj.stateSnapshot.children[0].componentData) === '{}' ? '' : obj.stateSnapshot.children[0].componentData
34+
componentData: JSON.stringify(obj.stateSnapshot.children[0].componentData) === '{}' ? '' : obj.stateSnapshot.children[0].componentData,
3135
};
3236
hierarchyArr.push(newObj);
3337
}

src/app/containers/ButtonsContainer.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* eslint-disable no-prototype-builtins */
2+
/* eslint-disable no-restricted-globals */
3+
/* eslint-disable @typescript-eslint/no-explicit-any */
4+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
15
import React from 'react';
26

37
import { importSnapshots, toggleMode } from '../actions/actions';
@@ -27,11 +31,11 @@ function importHandler(dispatch:(a:any)=>void) {
2731
fileUpload.onchange = () => {
2832
const reader = new FileReader();
2933
reader.onload = () => {
30-
const test = reader.result.toString()
31-
return dispatch(importSnapshots(JSON.parse(test)))
34+
const test = reader.result.toString();
35+
return dispatch(importSnapshots(JSON.parse(test)));
3236
};
33-
if(event.target.hasOwnProperty('files')){
34-
const eventFiles:any = event.target
37+
if (event.target.hasOwnProperty('files')) {
38+
const eventFiles:any = event.target;
3539
reader.readAsText(eventFiles.files[0]);
3640
}
3741
};
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
/* eslint-disable jsx-a11y/alt-text */
2+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
13
import React from 'react';
24
import SwitchAppDropdown from '../components/SwitchApp';
35

46
function HeadContainer() {
57
return (
68
<div className="head-container">
7-
<img src ="https://i.imgur.com/19jt84a.png" height= "30px"/>
9+
<img src="https://i.imgur.com/19jt84a.png" height="30px" />
810
<SwitchAppDropdown />
911
</div>
1012
);
1113
}
1214

13-
export default HeadContainer;
15+
export default HeadContainer;

0 commit comments

Comments
 (0)