From a54a22f142febd0c282cf9e0ee8cbb7808074a58 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Sun, 26 Feb 2023 15:22:05 -0800 Subject: [PATCH] chore: linting --- src/app/(drift)/providers.tsx | 18 ++++++++++-------- .../badges/visibility-control/index.tsx | 2 +- src/app/components/post-list/index.tsx | 2 +- src/app/hooks/swr/use-api-tokens.ts | 2 +- types/index.d.ts | 3 +-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app/(drift)/providers.tsx b/src/app/(drift)/providers.tsx index 0046e33c..bb2e73f2 100644 --- a/src/app/(drift)/providers.tsx +++ b/src/app/(drift)/providers.tsx @@ -18,17 +18,19 @@ export function Providers({ children }: PropsWithChildren) { ) } -export type ApiResponse = { - data: T - error: never -} | { - data: never - error: string -} +export type ApiResponse = + | { + data: T + error: never + } + | { + data: never + error: string + } async function fetcher(url: string): Promise { const response = await fetch(url) - const data: ApiResponse = await response.json() as ApiResponse + const data: ApiResponse = (await response.json()) as ApiResponse if (data.error) { throw new Error(data.error) diff --git a/src/app/components/badges/visibility-control/index.tsx b/src/app/components/badges/visibility-control/index.tsx index c710b287..ff868136 100644 --- a/src/app/components/badges/visibility-control/index.tsx +++ b/src/app/components/badges/visibility-control/index.tsx @@ -43,7 +43,7 @@ function VisibilityControl({ }) if (res.ok) { - const json = await res.json() as PostWithFiles + const json = (await res.json()) as PostWithFiles setVisibility(json.visibility) router.refresh() setToast({ diff --git a/src/app/components/post-list/index.tsx b/src/app/components/post-list/index.tsx index f5b6730c..a68609f6 100644 --- a/src/app/components/post-list/index.tsx +++ b/src/app/components/post-list/index.tsx @@ -59,7 +59,7 @@ const PostList = ({ } } ) - const json = await res.json() as PostWithFiles[] + const json = (await res.json()) as PostWithFiles[] setPosts(json) setSearching(false) } diff --git a/src/app/hooks/swr/use-api-tokens.ts b/src/app/hooks/swr/use-api-tokens.ts index a58d93ff..5ce1611a 100644 --- a/src/app/hooks/swr/use-api-tokens.ts +++ b/src/app/hooks/swr/use-api-tokens.ts @@ -36,7 +36,7 @@ export function useApiTokens({ userId, initialTokens }: UseApiTokens) { } ) - const response = await res.json() as ApiResponse + const response = (await res.json()) as ApiResponse if (response.error) { throw new Error(response.error) return diff --git a/types/index.d.ts b/types/index.d.ts index 9bea8c1a..e547e84a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,2 +1 @@ - -import "@total-typescript/ts-reset"; +import "@total-typescript/ts-reset"