From 9d2b860004acd2d4ded22e80e5f9ff6ff8aa5d4c Mon Sep 17 00:00:00 2001 From: amDeimos666 <71735806+amDeimos666@users.noreply.github.com> Date: Sat, 10 Jun 2023 15:44:26 -0400 Subject: [PATCH] re fix lint --- .../ExplorationConfig/ExplorationConfig.tsx | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/renderer/components/pages/Config/pages/ExplorationConfig/ExplorationConfig.tsx b/src/renderer/components/pages/Config/pages/ExplorationConfig/ExplorationConfig.tsx index 45fb9065..33ea9f93 100644 --- a/src/renderer/components/pages/Config/pages/ExplorationConfig/ExplorationConfig.tsx +++ b/src/renderer/components/pages/Config/pages/ExplorationConfig/ExplorationConfig.tsx @@ -39,7 +39,7 @@ export const ExplorationConfig: FC = () => { }; useEffect(() => { - let interval: any = null; + let interval: ReturnType | undefined; const intervalMs = 1000; if (isTimerActive) { interval = setInterval(() => { @@ -47,26 +47,30 @@ export const ExplorationConfig: FC = () => { setTimeRemaining(timeRemaining - intervalMs); }, intervalMs); } else if (!isTimerActive && timeRemaining !== 0) { - clearInterval(interval); + if (interval !== undefined) { + clearInterval(interval); + } setTimerDisplay('00:00'); } - return () => clearInterval(interval); - }, [isTimerActive, timeRemaining]); - const getTimeRemaining = () => { - const total = countDownDate - Date.now(); + const getTimeRemaining = () => { + const total = countDownDate - Date.now(); - const minutes = Math.floor((total % (1000 * 60 * 60)) / (1000 * 60)); - const seconds = Math.floor((total % (1000 * 60)) / 1000); + const minutes = Math.floor((total % (1000 * 60 * 60)) / (1000 * 60)); + const seconds = Math.floor((total % (1000 * 60)) / 1000); - const minutesDiplay = minutes < 10 ? '0' + minutes : minutes.toString(); - const secondsDiplay = seconds < 10 ? '0' + seconds : seconds.toString(); + const minutesDiplay = + minutes < 10 ? '0' + minutes.toString() : minutes.toString(); + const secondsDiplay = + seconds < 10 ? '0' + seconds.toString() : seconds.toString(); - if (total < 0) { - setIsTimerActive(false); - } - return `${minutesDiplay}:${secondsDiplay}`; - }; + if (total < 0) { + setIsTimerActive(false); + } + return `${minutesDiplay}:${secondsDiplay}`; + }; + return () => clearInterval(interval); + }, [isTimerActive, countDownDate, timeRemaining]); const setRosExplorationTimer = () => { rosClient