From 2f9e5e905ae148922ea1dbe52bb20d628b6f1a67 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Fri, 7 Jan 2022 15:52:41 +0000 Subject: [PATCH] fix more linting issues --- src/App.js | 26 +++++++++++------------ src/components/device/tabPane/boot.jsx | 8 +++---- src/components/device/tabPane/console.jsx | 4 ++-- src/components/device/tabPane/crash.jsx | 3 +-- src/components/device/tabPane/device.jsx | 6 +++--- src/components/device/tabPane/drives.jsx | 9 ++++---- 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/App.js b/src/App.js index e2ddc47..18078ae 100644 --- a/src/App.js +++ b/src/App.js @@ -37,31 +37,29 @@ function App() { mode: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light', }, }), - [true], + [], ); return (
- - - - - - + + - + + + - {session ? : } + - - + {session ? : } - + + + + - -
); } diff --git a/src/components/device/tabPane/boot.jsx b/src/components/device/tabPane/boot.jsx index 5072e3e..6802c15 100644 --- a/src/components/device/tabPane/boot.jsx +++ b/src/components/device/tabPane/boot.jsx @@ -33,18 +33,18 @@ function loading() { export default function EnhancedTable(props) { const [state, dispatch] = useContext(DeviceContext) - const [ notifState, notifdispatch ] = useContext(SnackbarContext) + const [, notifDispatch] = useContext(SnackbarContext) useEffect(() => { deviceController.getBootlogs(props.dongleId).then((res) => { setTimeout(() => { dispatch({ type: "update_dongle_bootlogs", dongle_id: props.dongleId, bootlogs: res.data }) }, 1) - }).catch((err) => { - notifdispatch({type: "NEW_TOAST", msg: 'Failed to load bootlogs'}) + }).catch(() => { + notifDispatch({type: "NEW_TOAST", msg: 'Failed to load bootlogs'}) }) - }, []); + }, [dispatch, notifDispatch, props.dongleId]) return ( diff --git a/src/components/device/tabPane/console.jsx b/src/components/device/tabPane/console.jsx index 44dd731..28fdc43 100644 --- a/src/components/device/tabPane/console.jsx +++ b/src/components/device/tabPane/console.jsx @@ -1,7 +1,7 @@ - +import React from 'react'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; -import React, { useContext } from 'react'; + //import { JsonFormatter } from 'react-json-formatter' /* diff --git a/src/components/device/tabPane/crash.jsx b/src/components/device/tabPane/crash.jsx index 24415c6..22f9a9e 100644 --- a/src/components/device/tabPane/crash.jsx +++ b/src/components/device/tabPane/crash.jsx @@ -75,8 +75,7 @@ export default function EnhancedTable(props) { deviceController.getCrashlogs(props.dongleId).then((res) => { dispatch({ type: "update_dongle_bootlogs", dongle_id: props.dongleId, bootlogs: res.data }) }) - - }, []); + }, [dispatch, props.dongleId]); console.log("drives", state.dongles[props.dongleId]) console.log("drives", typeof state.dongles[props.dongleId]) diff --git a/src/components/device/tabPane/device.jsx b/src/components/device/tabPane/device.jsx index 6da642b..e82bc07 100644 --- a/src/components/device/tabPane/device.jsx +++ b/src/components/device/tabPane/device.jsx @@ -19,17 +19,17 @@ import * as helpers from "./../../../controllers/helpers" export default function SignIn(props) { const [state] = useContext(DeviceContext) - const [notifState, notifdispatch] = useContext(SnackbarContext) + const [, notifDispatch] = useContext(SnackbarContext) function pubKeyClipboard(newClip) { navigator.clipboard.writeText(newClip).then(function () { - notifdispatch({ + notifDispatch({ type: "NEW_TOAST", open: true, msg: "Successfully copied to clipboard!" }) }, function () { - notifdispatch({ + notifDispatch({ type: "NEW_TOAST", open: true, msg: "Failed to write to clipboard!" diff --git a/src/components/device/tabPane/drives.jsx b/src/components/device/tabPane/drives.jsx index b8502bb..0c05039 100644 --- a/src/components/device/tabPane/drives.jsx +++ b/src/components/device/tabPane/drives.jsx @@ -25,7 +25,7 @@ import ViewDrive from "./view_drive" export default function EnhancedTable(props) { const [deviceState, dispatch] = useContext(DeviceContext) - const [ notifState, notifdispatch ] = useContext(SnackbarContext) + const [, notifDispatch] = useContext(SnackbarContext) const [state, setState] = useState({selectedSegment: null}) useEffect(() => { @@ -33,11 +33,10 @@ export default function EnhancedTable(props) { setTimeout(() => { dispatch({ type: "update_dongle_drive", dongle_id: props.dongleId, drives: res.data }) }, 1) - }).catch((err) => { - notifdispatch({type: "NEW_TOAST", msg: 'Failed to load drives'}) + }).catch(() => { + notifDispatch({type: "NEW_TOAST", msg: 'Failed to load drives'}) }) - - }, []); + }, [dispatch, notifDispatch, props.dongleId]) return (