eslint update

This commit is contained in:
Athou
2023-12-28 19:54:51 +01:00
parent f4e48383cc
commit 97781d5551
65 changed files with 1258 additions and 3103 deletions

View File

@@ -41,7 +41,7 @@ export function WelcomePage() {
label={<Trans>Try the demo!</Trans>}
icon={<TbClock size={iconSize} />}
variant="outline"
onClick={() => login.execute({ name: "demo", password: "demo" })}
onClick={async () => await login.execute({ name: "demo", password: "demo" })}
showLabelOnMobile
/>
</Center>
@@ -93,7 +93,7 @@ function Buttons() {
label={<Trans>Log in</Trans>}
icon={<TbKey size={iconSize} />}
variant="outline"
onClick={() => dispatch(redirectToLogin())}
onClick={async () => await dispatch(redirectToLogin())}
showLabelOnMobile
/>
{serverInfos?.allowRegistrations && (
@@ -101,7 +101,7 @@ function Buttons() {
label={<Trans>Sign up</Trans>}
icon={<TbUserPlus size={iconSize} />}
variant="filled"
onClick={() => dispatch(redirectToRegistration())}
onClick={async () => await dispatch(redirectToRegistration())}
showLabelOnMobile
/>
)}
@@ -139,7 +139,7 @@ function Footer() {
</Anchor>
</Group>
<Box>
<Anchor variant="text" onClick={() => dispatch(redirectToApiDocumentation())}>
<Anchor variant="text" onClick={async () => await dispatch(redirectToApiDocumentation())}>
API documentation
</Anchor>
</Box>

View File

@@ -2,12 +2,12 @@ import { Trans } from "@lingui/macro"
import { ActionIcon, Box, Code, Container, Group, Table, Text, Title, useMantineTheme } from "@mantine/core"
import { closeAllModals, openConfirmModal, openModal } from "@mantine/modals"
import { client, errorToStrings } from "app/client"
import { UserModel } from "app/types"
import { type UserModel } from "app/types"
import { UserEdit } from "components/admin/UserEdit"
import { Alert } from "components/Alert"
import { Loader } from "components/Loader"
import { RelativeDate } from "components/RelativeDate"
import { ReactNode } from "react"
import { type ReactNode } from "react"
import { useAsync, useAsyncCallback } from "react-async-hook"
import { TbCheck, TbPencil, TbPlus, TbTrash, TbX } from "react-icons/tb"
@@ -17,7 +17,7 @@ function BooleanIcon({ value }: { value: boolean }) {
export function AdminUsersPage() {
const theme = useMantineTheme()
const query = useAsync(() => client.admin.getAllUsers(), [])
const query = useAsync(async () => await client.admin.getAllUsers(), [])
const users = query.result?.data.sort((a, b) => a.id - b.id)
const deleteUser = useAsyncCallback(client.admin.deleteUser, {
@@ -56,7 +56,7 @@ export function AdminUsersPage() {
),
labels: { confirm: <Trans>Confirm</Trans>, cancel: <Trans>Cancel</Trans> },
confirmProps: { color: "red" },
onConfirm: () => deleteUser.execute({ id: user.id }),
onConfirm: async () => await deleteUser.execute({ id: user.id }),
})
}

View File

@@ -8,7 +8,7 @@ import { Timer } from "components/metrics/Timer"
import { useAsync } from "react-async-hook"
import { TbChartAreaLine, TbClock } from "react-icons/tb"
const shownMeters: { [key: string]: string } = {
const shownMeters: Record<string, string> = {
"com.commafeed.backend.feed.FeedRefreshEngine.refill": "Feed queue refill rate",
"com.commafeed.backend.feed.FeedRefreshWorker.feedFetched": "Feed fetching rate",
"com.commafeed.backend.feed.FeedRefreshUpdater.feedUpdated": "Feed update rate",
@@ -17,7 +17,7 @@ const shownMeters: { [key: string]: string } = {
"com.commafeed.backend.service.DatabaseCleaningService.entriesDeleted": "Entries deleted",
}
const shownGauges: { [key: string]: string } = {
const shownGauges: Record<string, string> = {
"com.commafeed.backend.feed.FeedRefreshEngine.queue.size": "Queue size",
"com.commafeed.backend.feed.FeedRefreshEngine.worker.active": "Feed Worker active",
"com.commafeed.backend.feed.FeedRefreshEngine.updater.active": "Feed Updater active",
@@ -26,7 +26,7 @@ const shownGauges: { [key: string]: string } = {
}
export function MetricsPage() {
const query = useAsync(() => client.admin.getMetrics(), [])
const query = useAsync(async () => await client.admin.getMetrics(), [])
if (!query.result) return <Loader />
const { meters, gauges, timers } = query.result.data

View File

@@ -118,7 +118,7 @@ export function AboutPage() {
<KeyboardShortcutsHelp />
</Section>
<Section title={<Trans>REST API</Trans>} icon={<TbRocket size={24} />}>
<Anchor onClick={() => dispatch(redirectToApiDocumentation())}>
<Anchor onClick={async () => await dispatch(redirectToApiDocumentation())}>
<Trans>Go to the API documentation.</Trans>
</Anchor>
</Section>

View File

@@ -7,7 +7,7 @@ import { Constants } from "app/constants"
import { redirectToRootCategory, redirectToSelectedSource } from "app/slices/redirect"
import { reloadTree } from "app/slices/tree"
import { useAppDispatch, useAppSelector } from "app/store"
import { CategoryModificationRequest } from "app/types"
import { type CategoryModificationRequest } from "app/types"
import { flattenCategoryTree } from "app/utils"
import { Alert } from "components/Alert"
import { CategorySelect } from "components/content/add/CategorySelect"
@@ -23,7 +23,7 @@ export function CategoryDetailsPage() {
const apiKey = useAppSelector(state => state.user.profile?.apiKey)
const dispatch = useAppDispatch()
const query = useAsync(() => client.category.getRoot(), [])
const query = useAsync(async () => await client.category.getRoot(), [])
const category =
id === Constants.categories.starred.id
? Constants.categories.starred
@@ -47,7 +47,7 @@ export function CategoryDetailsPage() {
const openDeleteCategoryModal = () => {
const categoryName = category?.name
return openConfirmModal({
openConfirmModal({
title: <Trans>Delete Category</Trans>,
children: (
<Text size="sm">
@@ -58,7 +58,7 @@ export function CategoryDetailsPage() {
),
labels: { confirm: <Trans>Confirm</Trans>, cancel: <Trans>Cancel</Trans> },
confirmProps: { color: "red" },
onConfirm: () => deleteCategory.execute({ id: +id }),
onConfirm: async () => await deleteCategory.execute({ id: +id }),
})
}
@@ -122,7 +122,7 @@ export function CategoryDetailsPage() {
)}
<Group>
<Button variant="default" onClick={() => dispatch(redirectToSelectedSource())}>
<Button variant="default" onClick={async () => await dispatch(redirectToSelectedSource())}>
<Trans>Cancel</Trans>
</Button>
{editable && (

View File

@@ -6,7 +6,7 @@ import { client, errorToStrings } from "app/client"
import { redirectToRootCategory, redirectToSelectedSource } from "app/slices/redirect"
import { reloadTree } from "app/slices/tree"
import { useAppDispatch, useAppSelector } from "app/store"
import { FeedModificationRequest } from "app/types"
import { type FeedModificationRequest } from "app/types"
import { Alert } from "components/Alert"
import { CategorySelect } from "components/content/add/CategorySelect"
import { Loader } from "components/Loader"
@@ -54,7 +54,7 @@ export function FeedDetailsPage() {
const apiKey = useAppSelector(state => state.user.profile?.apiKey)
const dispatch = useAppDispatch()
const query = useAsync(() => client.feed.get(id), [id])
const query = useAsync(async () => await client.feed.get(id), [id])
const feed = query.result?.data
const form = useForm<FeedModificationRequest>()
@@ -75,7 +75,7 @@ export function FeedDetailsPage() {
const openUnsubscribeModal = () => {
const feedName = feed?.name
return openConfirmModal({
openConfirmModal({
title: <Trans>Unsubscribe</Trans>,
children: (
<Text size="sm">
@@ -86,7 +86,7 @@ export function FeedDetailsPage() {
),
labels: { confirm: <Trans>Confirm</Trans>, cancel: <Trans>Cancel</Trans> },
confirmProps: { color: "red" },
onConfirm: () => unsubscribe.execute({ id: +id }),
onConfirm: async () => await unsubscribe.execute({ id: +id }),
})
}
@@ -163,7 +163,7 @@ export function FeedDetailsPage() {
/>
<Group>
<Button variant="default" onClick={() => dispatch(redirectToSelectedSource())}>
<Button variant="default" onClick={async () => await dispatch(redirectToSelectedSource())}>
<Trans>Cancel</Trans>
</Button>
<Button type="submit" leftIcon={<TbDeviceFloppy size={16} />} loading={modifyFeed.loading}>

View File

@@ -2,7 +2,7 @@ import { Trans } from "@lingui/macro"
import { ActionIcon, Box, Center, createStyles, Divider, Group, Title, useMantineTheme } from "@mantine/core"
import { useViewportSize } from "@mantine/hooks"
import { Constants } from "app/constants"
import { EntrySourceType, loadEntries } from "app/slices/entries"
import { type EntrySourceType, loadEntries } from "app/slices/entries"
import { redirectToCategoryDetails, redirectToFeedDetails, redirectToTagDetails } from "app/slices/redirect"
import { useAppDispatch, useAppSelector } from "app/store"
import { flattenCategoryTree } from "app/utils"

View File

@@ -28,7 +28,7 @@ import { useMobile } from "hooks/useMobile"
import { useWebSocket } from "hooks/useWebSocket"
import { LoadingPage } from "pages/LoadingPage"
import { Resizable } from "re-resizable"
import { ReactNode, Suspense, useEffect } from "react"
import { type ReactNode, Suspense, useEffect } from "react"
import { TbPlus } from "react-icons/tb"
import { Outlet } from "react-router-dom"
@@ -79,7 +79,7 @@ const useStyles = createStyles((theme, props: LayoutProps) => ({
function LogoAndTitle() {
const dispatch = useAppDispatch()
return (
<Center inline onClick={() => dispatch(redirectToRootCategory())} style={{ cursor: "pointer" }}>
<Center inline onClick={async () => await dispatch(redirectToRootCategory())} style={{ cursor: "pointer" }}>
<Logo size={24} />
<Title order={3} pl="md">
CommaFeed
@@ -115,7 +115,7 @@ export default function Layout(props: LayoutProps) {
if (!webSocketConnected && treeReloadInterval) {
// reload tree periodically if not receiving websocket events
timer = window.setInterval(() => dispatch(reloadTree()), treeReloadInterval)
timer = window.setInterval(async () => await dispatch(reloadTree()), treeReloadInterval)
}
return () => clearInterval(timer)
@@ -133,7 +133,7 @@ export default function Layout(props: LayoutProps) {
)
const addButton = (
<ActionIcon color={theme.primaryColor} onClick={() => dispatch(redirectToAdd())} aria-label="Subscribe">
<ActionIcon color={theme.primaryColor} onClick={async () => await dispatch(redirectToAdd())} aria-label="Subscribe">
<TbPlus size={18} />
</ActionIcon>
)

View File

@@ -32,7 +32,7 @@ export function TagDetailsPage() {
</Input.Wrapper>
<Group>
<Button variant="default" onClick={() => dispatch(redirectToSelectedSource())}>
<Button variant="default" onClick={async () => await dispatch(redirectToSelectedSource())}>
<Trans>Cancel</Trans>
</Button>
</Group>

View File

@@ -4,7 +4,7 @@ import { useForm } from "@mantine/form"
import { client, errorToStrings } from "app/client"
import { redirectToRootCategory } from "app/slices/redirect"
import { useAppDispatch, useAppSelector } from "app/store"
import { LoginRequest } from "app/types"
import { type LoginRequest } from "app/types"
import { Alert } from "components/Alert"
import { PageTitle } from "pages/PageTitle"
import { useAsyncCallback } from "react-async-hook"

View File

@@ -2,7 +2,7 @@ import { t, Trans } from "@lingui/macro"
import { Anchor, Box, Button, Center, Container, Group, Paper, Stack, TextInput, Title } from "@mantine/core"
import { useForm } from "@mantine/form"
import { client, errorToStrings } from "app/client"
import { PasswordResetRequest } from "app/types"
import { type PasswordResetRequest } from "app/types"
import { Alert } from "components/Alert"
import { PageTitle } from "pages/PageTitle"
import { useState } from "react"

View File

@@ -4,7 +4,7 @@ import { useForm } from "@mantine/form"
import { client, errorToStrings } from "app/client"
import { redirectToRootCategory } from "app/slices/redirect"
import { useAppDispatch, useAppSelector } from "app/store"
import { RegistrationRequest } from "app/types"
import { type RegistrationRequest } from "app/types"
import { Alert } from "components/Alert"
import { PageTitle } from "pages/PageTitle"
import { useAsyncCallback } from "react-async-hook"