From 5918b138677249bf71ccaaa9fbbfb8c58dc33932 Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Sun, 4 Dec 2022 14:26:14 -0800 Subject: [PATCH] lint --- client/app/(auth)/components/index.tsx | 4 ++-- client/app/(posts)/components/file-dropdown/index.tsx | 8 +++++++- .../app/(posts)/new/components/drag-and-drop/index.tsx | 3 ++- .../edit-document/formatting-icons/index.tsx | 9 ++++++++- client/app/(posts)/new/from/[id]/page.tsx | 2 +- .../(posts)/post/[id]/components/post-page/index.tsx | 1 - .../components/post-page/password-modal-wrapper.tsx | 2 +- client/app/(posts)/post/[id]/page.tsx | 4 ++-- client/app/admin/page.tsx | 6 +++++- client/app/author/[username]/page.tsx | 10 ++++++++-- .../app/components/badges/created-ago-badge/index.tsx | 2 +- .../app/components/badges/visibility-control/index.tsx | 2 +- client/app/components/header/index.tsx | 10 ++++++---- client/app/components/scroll-to-top/index.tsx | 2 +- client/app/components/spinner/index.tsx | 2 +- client/app/layout.tsx | 4 +--- client/lib/config.ts | 2 +- client/lib/server/auth.ts | 2 +- 18 files changed, 49 insertions(+), 26 deletions(-) diff --git a/client/app/(auth)/components/index.tsx b/client/app/(auth)/components/index.tsx index fc5cecc0..17e698b3 100644 --- a/client/app/(auth)/components/index.tsx +++ b/client/app/(auth)/components/index.tsx @@ -7,7 +7,7 @@ import { signIn } from "next-auth/react" import Input from "@components/input" import Button from "@components/button" import Note from "@components/note" -import { GitHub } from 'react-feather' +import { GitHub } from "react-feather" const Auth = ({ page, requiresServerPassword @@ -68,7 +68,7 @@ const Auth = ({ buttonType="primary" width="100%" style={{ - color: 'var(--fg)' + color: "var(--fg)" }} iconLeft={} onClick={(e) => { diff --git a/client/app/(posts)/components/file-dropdown/index.tsx b/client/app/(posts)/components/file-dropdown/index.tsx index 573f4048..09d6ba01 100644 --- a/client/app/(posts)/components/file-dropdown/index.tsx +++ b/client/app/(posts)/components/file-dropdown/index.tsx @@ -11,7 +11,13 @@ type Item = File & { icon: JSX.Element } -const FileDropdown = ({ files, loading }: { files: File[], loading?: boolean }) => { +const FileDropdown = ({ + files, + loading +}: { + files: File[] + loading?: boolean +}) => { if (loading) { return } diff --git a/client/app/(posts)/new/components/drag-and-drop/index.tsx b/client/app/(posts)/new/components/drag-and-drop/index.tsx index 80c80984..6feb15f7 100644 --- a/client/app/(posts)/new/components/drag-and-drop/index.tsx +++ b/client/app/(posts)/new/components/drag-and-drop/index.tsx @@ -86,7 +86,8 @@ function FileDropzone({ setDocs }: { setDocs: (docs: Document[]) => void }) { {!isDragActive && (

- Drag some files here, or to select files + Drag some files here, or to select + files

)} {isDragActive &&

Release to drop the files here

} diff --git a/client/app/(posts)/new/components/edit-document-list/edit-document/formatting-icons/index.tsx b/client/app/(posts)/new/components/edit-document-list/edit-document/formatting-icons/index.tsx index 12e660ba..dd04fd92 100644 --- a/client/app/(posts)/new/components/edit-document-list/edit-document/formatting-icons/index.tsx +++ b/client/app/(posts)/new/components/edit-document-list/edit-document/formatting-icons/index.tsx @@ -1,4 +1,11 @@ -import { Bold, Code, Image as ImageIcon, Italic, Link, List } from "react-feather" +import { + Bold, + Code, + Image as ImageIcon, + Italic, + Link, + List +} from "react-feather" import { RefObject, useMemo } from "react" import styles from "./formatting-icons.module.css" import { TextareaMarkdownRef } from "textarea-markdown-editor" diff --git a/client/app/(posts)/new/from/[id]/page.tsx b/client/app/(posts)/new/from/[id]/page.tsx index 485f28fd..0130f31c 100644 --- a/client/app/(posts)/new/from/[id]/page.tsx +++ b/client/app/(posts)/new/from/[id]/page.tsx @@ -25,7 +25,7 @@ const NewFromExisting = async ({ withFiles: true, withAuthor: false }) - + const serialized = JSON.stringify(post) return diff --git a/client/app/(posts)/post/[id]/components/post-page/index.tsx b/client/app/(posts)/post/[id]/components/post-page/index.tsx index d4862c2a..ede83220 100644 --- a/client/app/(posts)/post/[id]/components/post-page/index.tsx +++ b/client/app/(posts)/post/[id]/components/post-page/index.tsx @@ -69,7 +69,6 @@ const PostPage = ({ post: initialPost, isProtected, isAuthor }: Props) => { preview={html} /> ))} - ) } diff --git a/client/app/(posts)/post/[id]/components/post-page/password-modal-wrapper.tsx b/client/app/(posts)/post/[id]/components/post-page/password-modal-wrapper.tsx index 03c465ea..194b618f 100644 --- a/client/app/(posts)/post/[id]/components/post-page/password-modal-wrapper.tsx +++ b/client/app/(posts)/post/[id]/components/post-page/password-modal-wrapper.tsx @@ -1,4 +1,4 @@ -'use client'; +"use client" import { Post, PostWithFilesAndAuthor } from "@lib/server/prisma" import PasswordModal from "@components/password-modal" diff --git a/client/app/(posts)/post/[id]/page.tsx b/client/app/(posts)/post/[id]/page.tsx index 64276c08..b19d4bfe 100644 --- a/client/app/(posts)/post/[id]/page.tsx +++ b/client/app/(posts)/post/[id]/page.tsx @@ -67,10 +67,10 @@ const getPost = async (id: string) => { createdAt: new Date("1970-01-01"), expiresAt: new Date("1970-01-01"), author: { - displayName: "", + displayName: "" }, description: "", - authorId: "", + authorId: "" }, isProtected: true, isAuthor: isAuthorOrAdmin diff --git a/client/app/admin/page.tsx b/client/app/admin/page.tsx index e0a7aefb..2e3af7b3 100644 --- a/client/app/admin/page.tsx +++ b/client/app/admin/page.tsx @@ -57,7 +57,11 @@ export function PostTable({ {posts?.map((post) => ( - {post.title} + + + {post.title} + + {"author" in post ? post.author.name : "no author"} {post.createdAt.toLocaleDateString()} {post.visibility} diff --git a/client/app/author/[username]/page.tsx b/client/app/author/[username]/page.tsx index 6ec95ecf..79d9d34b 100644 --- a/client/app/author/[username]/page.tsx +++ b/client/app/author/[username]/page.tsx @@ -4,13 +4,19 @@ import { Suspense } from "react" async function PostListWrapper({ posts, - userId, + userId }: { posts: ReturnType userId: string }) { const data = (await posts).filter((post) => post.visibility === "public") - return + return ( + + ) } export default async function UserPage({ diff --git a/client/app/components/badges/created-ago-badge/index.tsx b/client/app/components/badges/created-ago-badge/index.tsx index 2ff6722a..a03b643e 100644 --- a/client/app/components/badges/created-ago-badge/index.tsx +++ b/client/app/components/badges/created-ago-badge/index.tsx @@ -1,4 +1,4 @@ -'use client' +"use client" import Tooltip from "@components/tooltip" import { timeAgo } from "@lib/time-ago" import { useMemo, useState, useEffect } from "react" diff --git a/client/app/components/badges/visibility-control/index.tsx b/client/app/components/badges/visibility-control/index.tsx index 07e61cc4..444a44aa 100644 --- a/client/app/components/badges/visibility-control/index.tsx +++ b/client/app/components/badges/visibility-control/index.tsx @@ -1,4 +1,4 @@ -'use client'; +"use client" import PasswordModal from "@components/password-modal" import { useCallback, useState } from "react" diff --git a/client/app/components/header/index.tsx b/client/app/components/header/index.tsx index b26f11b7..22746017 100644 --- a/client/app/components/header/index.tsx +++ b/client/app/components/header/index.tsx @@ -159,13 +159,15 @@ const Header = () => { // TODO: this is a hack to close the radix ui menu when a next link is clicked const onClick = () => { - document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' })); + document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape" })) } return ( -
+
{buttons}
diff --git a/client/app/components/scroll-to-top/index.tsx b/client/app/components/scroll-to-top/index.tsx index 86fbc918..40f1eba3 100644 --- a/client/app/components/scroll-to-top/index.tsx +++ b/client/app/components/scroll-to-top/index.tsx @@ -1,4 +1,4 @@ -'use client'; +"use client" import Button from "@components/button" import Tooltip from "@components/tooltip" diff --git a/client/app/components/spinner/index.tsx b/client/app/components/spinner/index.tsx index ce7b3e0d..d35c2e41 100644 --- a/client/app/components/spinner/index.tsx +++ b/client/app/components/spinner/index.tsx @@ -1,3 +1,3 @@ -import styles from './spinner.module.css' +import styles from "./spinner.module.css" export const Spinner = () =>
diff --git a/client/app/layout.tsx b/client/app/layout.tsx index d4c7aa2a..bce80d7d 100644 --- a/client/app/layout.tsx +++ b/client/app/layout.tsx @@ -18,9 +18,7 @@ export default async function RootLayout({ children }: RootLayoutProps) { - - {children} - + {children} diff --git a/client/lib/config.ts b/client/lib/config.ts index c578a636..7834affa 100644 --- a/client/lib/config.ts +++ b/client/lib/config.ts @@ -63,7 +63,7 @@ export const config = (env: Environment): Config => { validNodeEnvs(env.NODE_ENV) - throwIfUndefined("DATABASE_URL"); + throwIfUndefined("DATABASE_URL") const config: Config = { is_production, diff --git a/client/lib/server/auth.ts b/client/lib/server/auth.ts index df6c0bb7..1314be8d 100644 --- a/client/lib/server/auth.ts +++ b/client/lib/server/auth.ts @@ -7,7 +7,7 @@ import config from "@lib/config" const providers: NextAuthOptions["providers"] = [ GitHubProvider({ clientId: config.github_client_id, - clientSecret: config.github_client_secret, + clientSecret: config.github_client_secret }) ]