From c081d55a32bd10d46609de68f4ae54171b296a9b Mon Sep 17 00:00:00 2001 From: Ivan Li Date: Mon, 17 Oct 2022 15:37:01 +0000 Subject: [PATCH] style: auto fix. --- .dockerignore | 4 +- .editorconfig | 12 ++ .gitignore | 2 + .prettierrc.js | 8 +- components/Card.tsx | 18 +- components/ClientReload.tsx | 18 +- components/Footer.tsx | 18 +- components/Image.tsx | 6 +- components/LayoutWrapper.tsx | 29 ++-- components/Link.tsx | 23 +-- components/MDXComponents.tsx | 39 +++-- components/MobileNav.tsx | 39 ++--- components/NewsletterForm.tsx | 63 ++++--- components/PageTitle.tsx | 6 +- components/Pagination.tsx | 25 ++- components/Pre.tsx | 48 ++--- components/SEO.tsx | 107 +++++++----- components/ScrollTopAndComment.tsx | 41 +++-- components/SectionContainer.tsx | 10 +- components/TOCInline.tsx | 38 ++-- components/Tag.tsx | 12 +- components/ThemeSwitch.tsx | 26 +-- components/analytics/GoogleAnalytics.tsx | 14 +- components/analytics/Plausible.tsx | 14 +- components/analytics/SimpleAnalytics.tsx | 19 +- components/analytics/Umami.tsx | 10 +- components/analytics/index.tsx | 32 ++-- components/comments/Commento.tsx | 31 ++-- components/comments/Cusdis.tsx | 26 +-- components/comments/Disqus.tsx | 47 ++--- components/comments/Giscus.tsx | 87 ++++++---- components/comments/Utterances.tsx | 64 +++---- .../comments/commento/ReactCommento.tsx | 76 ++++---- components/comments/index.tsx | 57 +++--- components/social-icons/index.tsx | 33 ++-- layouts/AuthorLayout.tsx | 35 ++-- layouts/ListLayout.tsx | 58 ++++--- layouts/PostLayout.tsx | 91 ++++++---- layouts/PostSimple.tsx | 52 +++--- lib/generate-rss.ts | 20 ++- lib/mdx.ts | 130 ++++++++------ lib/remark-code-title.ts | 58 ++++--- lib/remark-extract-frontmatter.ts | 12 +- lib/remark-img-to-jsx.ts | 51 +++--- lib/remark-toc-headings.ts | 14 +- lib/tags.ts | 36 ++-- lib/utils/files.ts | 30 ++-- lib/utils/formatDate.ts | 12 +- lib/utils/htmlEscaper.ts | 10 +- lib/utils/kebabCase.ts | 6 +- pages/404.tsx | 8 +- pages/_app.tsx | 28 +-- pages/_document.tsx | 30 +++- pages/about.tsx | 30 ++-- pages/api/buttondown.ts | 22 +-- pages/api/convertkit.ts | 24 +-- pages/api/klaviyo.ts | 20 +-- pages/api/mailchimp.ts | 18 +- pages/blog.tsx | 37 ++-- pages/blog/[...slug].tsx | 75 ++++---- pages/blog/page/[page].tsx | 51 +++--- pages/index.tsx | 54 +++--- pages/projects.tsx | 15 +- pages/tags.tsx | 42 +++-- pages/tags/[tag].tsx | 65 +++---- scripts/compose.js | 72 ++++---- scripts/generate-sitemap.js | 45 ++--- scripts/next-remote-watch.js | 164 ++++++++++-------- 68 files changed, 1403 insertions(+), 1114 deletions(-) create mode 100644 .editorconfig diff --git a/.dockerignore b/.dockerignore index 76bad3b..f8ee828 100644 --- a/.dockerignore +++ b/.dockerignore @@ -35,4 +35,6 @@ yarn-error.log* .env.test.local .env.production.local -secrets.txt \ No newline at end of file +secrets.txt + +.pnpm-store \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ebe51d3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false \ No newline at end of file diff --git a/.gitignore b/.gitignore index dd6d93c..f8ee828 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ yarn-error.log* .env.production.local secrets.txt + +.pnpm-store \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js index 2c63c08..2e7c768 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,2 +1,6 @@ -{ -} +module.exports = { + singleQuote: true, + trailingCommas: 'all', + bracketSpacing: true, + bracketSameLine: true, +}; diff --git a/components/Card.tsx b/components/Card.tsx index 143681e..c7f127a 100644 --- a/components/Card.tsx +++ b/components/Card.tsx @@ -1,13 +1,12 @@ -import Image from './Image' -import Link from './Link' +import Image from './Image'; +import Link from './Link'; const Card = ({ title, description, imgSrc, href }) => (
+ } overflow-hidden rounded-md border-2 border-gray-200 border-opacity-60 dark:border-gray-700`}> {imgSrc && (href ? ( @@ -38,19 +37,20 @@ const Card = ({ title, description, imgSrc, href }) => ( title )} -

{description}

+

+ {description} +

{href && ( + aria-label={`Link to ${title}`}> Learn more → )}
-) +); -export default Card +export default Card; diff --git a/components/ClientReload.tsx b/components/ClientReload.tsx index e8713e9..b575934 100644 --- a/components/ClientReload.tsx +++ b/components/ClientReload.tsx @@ -1,5 +1,5 @@ -import { useEffect } from 'react' -import Router from 'next/router' +import { useEffect } from 'react'; +import Router from 'next/router'; /** * Client-side complement to next-remote-watch @@ -10,14 +10,14 @@ export const ClientReload = () => { // Exclude socket.io from prod bundle useEffect(() => { import('socket.io-client').then((module) => { - const socket = module.io() + const socket = module.io(); socket.on('reload', () => { Router.replace(Router.asPath, undefined, { scroll: false, - }) - }) - }) - }, []) + }); + }); + }); + }, []); - return null -} + return null; +}; diff --git a/components/Footer.tsx b/components/Footer.tsx index 7b034be..02eb537 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -1,13 +1,17 @@ -import Link from './Link' -import siteMetadata from '@/data/siteMetadata' -import SocialIcon from '@/components/social-icons' +import Link from './Link'; +import siteMetadata from '@/data/siteMetadata'; +import SocialIcon from '@/components/social-icons'; export default function Footer() { return ( - ) + ); } diff --git a/components/Image.tsx b/components/Image.tsx index fde277a..d5022ca 100644 --- a/components/Image.tsx +++ b/components/Image.tsx @@ -1,5 +1,5 @@ -import NextImage, { ImageProps } from 'next/image' +import NextImage, { ImageProps } from 'next/image'; -const Image = ({ ...rest }: ImageProps) => +const Image = ({ ...rest }: ImageProps) => ; -export default Image +export default Image; diff --git a/components/LayoutWrapper.tsx b/components/LayoutWrapper.tsx index 08ef946..e6feb0e 100644 --- a/components/LayoutWrapper.tsx +++ b/components/LayoutWrapper.tsx @@ -1,15 +1,15 @@ -import siteMetadata from '@/data/siteMetadata' -import headerNavLinks from '@/data/headerNavLinks' -import Logo from '@/data/logo.svg' -import Link from './Link' -import SectionContainer from './SectionContainer' -import Footer from './Footer' -import MobileNav from './MobileNav' -import ThemeSwitch from './ThemeSwitch' -import { ReactNode } from 'react' +import siteMetadata from '@/data/siteMetadata'; +import headerNavLinks from '@/data/headerNavLinks'; +import Logo from '@/data/logo.svg'; +import Link from './Link'; +import SectionContainer from './SectionContainer'; +import Footer from './Footer'; +import MobileNav from './MobileNav'; +import ThemeSwitch from './ThemeSwitch'; +import { ReactNode } from 'react'; interface Props { - children: ReactNode + children: ReactNode; } const LayoutWrapper = ({ children }: Props) => { @@ -39,8 +39,7 @@ const LayoutWrapper = ({ children }: Props) => { + className="p-1 font-medium text-gray-900 dark:text-gray-100 sm:p-4"> {link.title} ))} @@ -53,7 +52,7 @@ const LayoutWrapper = ({ children }: Props) => {