client/web: add eslint

Add eslint to require stricter typescript rules, particularly around
required hook dependencies. This commit also updates any files that
were now throwing errors with eslint.

Updates #10261

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
This commit is contained in:
Sonia Appasamy
2023-11-28 16:31:56 -05:00
committed by Sonia Appasamy
parent 5a9e935597
commit 6e30c9d1fe
12 changed files with 3255 additions and 533 deletions
+5 -9
View File
@@ -29,15 +29,8 @@ export enum UpdateState {
// useInstallUpdate initiates and tracks a Tailscale self-update via the LocalAPI,
// and returns state messages showing the progress of the update.
export function useInstallUpdate(currentVersion: string, cv?: VersionInfo) {
if (!cv) {
return {
updateState: UpdateState.UpToDate,
updateLog: "",
}
}
const [updateState, setUpdateState] = useState<UpdateState>(
cv.RunningLatest ? UpdateState.UpToDate : UpdateState.Available
cv?.RunningLatest ? UpdateState.UpToDate : UpdateState.Available
)
const [updateLog, setUpdateLog] = useState<string>("")
@@ -132,7 +125,10 @@ export function useInstallUpdate(currentVersion: string, cv?: VersionInfo) {
if (timer) clearTimeout(timer)
timer = 0
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return { updateState, updateLog }
return !cv
? { updateState: UpdateState.UpToDate, updateLog: "" }
: { updateState, updateLog }
}