From a05760177188ba7dd80405d9dcbb0b0321a1c03c Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Thu, 18 Apr 2024 15:04:02 +0200 Subject: [PATCH] Fix a few Mantine UI lint errors Signed-off-by: Julius Volz --- .../src/components/CustomInfiniteScroll.tsx | 16 ++++++++++------ web/ui/mantine-ui/src/pages/StatusPage.tsx | 10 +++++----- .../src/pages/query/ExpressionInput.tsx | 3 +++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/web/ui/mantine-ui/src/components/CustomInfiniteScroll.tsx b/web/ui/mantine-ui/src/components/CustomInfiniteScroll.tsx index a4e0575d3..f926c299c 100644 --- a/web/ui/mantine-ui/src/components/CustomInfiniteScroll.tsx +++ b/web/ui/mantine-ui/src/components/CustomInfiniteScroll.tsx @@ -1,5 +1,5 @@ -import { ComponentType, useEffect, useState } from 'react'; -import InfiniteScroll from 'react-infinite-scroll-component'; +import { ComponentType, useEffect, useState } from "react"; +import InfiniteScroll from "react-infinite-scroll-component"; const initialNumberOfItemsDisplayed = 50; @@ -12,11 +12,15 @@ interface CustomInfiniteScrollProps { child: ComponentType>; } -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -const CustomInfiniteScroll = ({ allItems, child }: CustomInfiniteScrollProps) => { +const CustomInfiniteScroll = ({ + allItems, + child, +}: CustomInfiniteScrollProps) => { const [items, setItems] = useState(allItems.slice(0, 50)); const [index, setIndex] = useState(initialNumberOfItemsDisplayed); - const [hasMore, setHasMore] = useState(allItems.length > initialNumberOfItemsDisplayed); + const [hasMore, setHasMore] = useState( + allItems.length > initialNumberOfItemsDisplayed + ); const Child = child; useEffect(() => { @@ -40,7 +44,7 @@ const CustomInfiniteScroll = ({ allItems, child }: CustomInfiniteScrollProps hasMore={hasMore} loader={

loading...

} dataLength={items.length} - height={items.length > 25 ? '75vh' : ''} + height={items.length > 25 ? "75vh" : ""} > diff --git a/web/ui/mantine-ui/src/pages/StatusPage.tsx b/web/ui/mantine-ui/src/pages/StatusPage.tsx index ddb10f974..15798756d 100644 --- a/web/ui/mantine-ui/src/pages/StatusPage.tsx +++ b/web/ui/mantine-ui/src/pages/StatusPage.tsx @@ -7,22 +7,22 @@ const statusConfig: Record< string, { title?: string; - formatValue?: (v: any) => string; + formatValue?: (v: string | boolean) => string; } > = { startTime: { title: "Start time", - formatValue: (v: string) => - formatTimestamp(new Date(v).valueOf() / 1000, false), // TODO: Set useLocalTime parameter correctly. + formatValue: (v: string | boolean) => + formatTimestamp(new Date(v as string).valueOf() / 1000, false), // TODO: Set useLocalTime parameter correctly. }, CWD: { title: "Working directory" }, reloadConfigSuccess: { title: "Configuration reload", - formatValue: (v: boolean) => (v ? "Successful" : "Unsuccessful"), + formatValue: (v: string | boolean) => (v ? "Successful" : "Unsuccessful"), }, lastConfigTime: { title: "Last successful configuration reload", - formatValue: (v: string) => new Date(v).toUTCString(), + formatValue: (v: string | boolean) => new Date(v as string).toUTCString(), }, corruptionCount: { title: "WAL corruptions" }, goroutineCount: { title: "Goroutines" }, diff --git a/web/ui/mantine-ui/src/pages/query/ExpressionInput.tsx b/web/ui/mantine-ui/src/pages/query/ExpressionInput.tsx index 320ec7efc..53c817106 100644 --- a/web/ui/mantine-ui/src/pages/query/ExpressionInput.tsx +++ b/web/ui/mantine-ui/src/pages/query/ExpressionInput.tsx @@ -166,6 +166,8 @@ const ExpressionInput: FC = ({ } }, [formatResult, formatError]); + // This is just a placeholder until query history is implemented, so disable the linter warning. + // eslint-disable-next-line react-hooks/exhaustive-deps const queryHistory = [] as string[]; // (Re)initialize editor based on settings / setting changes. @@ -191,6 +193,7 @@ const ExpressionInput: FC = ({ {/* TODO: For wrapped long lines, the input grows in width more and more, the longer the line is. Figure out why and fix it. */} + {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} leftSection={ isFormatting ? :