Skip to content

Commit f10a39a

Browse files
committed
update linter to include hooks
1 parent 26be5ac commit f10a39a

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

.eslintrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
22
"extends": ["airbnb", "plugin:jest/recommended"],
33
"root": true,
4-
"plugins": ["jest", "react"],
4+
"plugins": ["jest", "react", "react-hooks"],
55
"rules": {
66
"arrow-parens": [2, "as-needed"],
77
"import/no-unresolved": "off",
8-
"import/extensions": "off"
8+
"import/extensions": "off",
9+
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
10+
"react-hooks/exhaustive-deps": "warn" // Checks effect dependencies
911
},
1012
"env": {
1113
"es6": true,

src/app/components/PerfView.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
/* eslint-disable no-unused-vars */
2+
/* eslint-disable react/prop-types */
3+
/* eslint-disable arrow-body-style */
14
/* eslint-disable no-plusplus */
25
/* eslint-disable func-names */
3-
/* eslint-disable react/no-this-in-sfc */
46
/* eslint-disable no-shadow */
57
/* eslint-disable no-multi-spaces */
68
/* eslint-disable newline-per-chained-call */
@@ -10,13 +12,11 @@
1012
// eslint-disable-next-line object-curly-newline
1113
/* eslint-disable comma-dangle */
1214
/* eslint-disable indent */
13-
/* eslint-disable react/destructuring-assignment */
14-
/* eslint-disable react/prop-types */
1515
/* eslint-disable no-console */
1616

1717
import React, { useEffect, useState, useRef } from 'react';
1818
import * as d3 from 'd3';
19-
import { addNewSnapshots } from '../actions/actions';
19+
// import { addNewSnapshots } from '../actions/actions';
2020

2121
// const windowRef = useRef(null);
2222
// const winWidth = null;

src/app/components/StateRoute.jsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
/* eslint-disable max-len */
12
/* eslint-disable object-curly-newline */
2-
import React, { useRef, useEffect } from 'react';
3+
import React from 'react';
34
import PropTypes from 'prop-types';
45
import { MemoryRouter as Router, Route, NavLink, Switch } from 'react-router-dom';
56

@@ -10,12 +11,7 @@ import PerfView from './PerfView';
1011
const NO_STATE_MSG = 'No state change detected. Trigger an event to change state';
1112
// eslint-disable-next-line react/prop-types
1213

13-
const StateRoute = ({
14-
snapshot,
15-
hierarchy,
16-
snapshots,
17-
viewIndex,
18-
}) => {
14+
const StateRoute = ({ snapshot, hierarchy, snapshots, viewIndex }) => {
1915
// 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
2016
const renderChart = () => {
2117
if (hierarchy) {
@@ -32,9 +28,9 @@ const StateRoute = ({
3228
return <div className="noState">{NO_STATE_MSG}</div>;
3329
};
3430

35-
const renderPerfView = () => {
31+
const renderPerfView = () => {
3632
if (hierarchy) {
37-
return <PerfView viewIndex={viewIndex} snapshots={snapshots} />; // ref={windowRef}
33+
return <PerfView viewIndex={viewIndex} snapshots={snapshots} />; // ref={windowRef}
3834
}
3935
return <div className="noState">{NO_STATE_MSG}</div>;
4036
};

0 commit comments

Comments
 (0)