diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 56ecf82..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": ["next/core-web-vitals"], - "rules": { - "@next/next/no-img-element": "off", - "react/jsx-uses-vars": "error", - "react/jsx-sort-props": 2 - } -} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 44f3ac0..0000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -*.woff2 -*.woff2 -*.ttf \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index bc519c2..0000000 --- a/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "printWidth": 120, - "endOfLine": "auto", - "trailingComma": "all", - "plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-organize-imports", "react"] -} diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..097651c --- /dev/null +++ b/biome.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "files": { + "ignore": [".next", "VSCodeCounter", ".turbo", "node_modules"] + }, + "formatter": { + "indentStyle": "space", + "lineWidth": 120 + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "a11y": { + "useKeyWithClickEvents": "off" + }, + "complexity": { + "noForEach": "off" + }, + "correctness": { + "useExhaustiveDependencies": "off" + }, + "suspicious": { + "noExplicitAny": "off" + }, + "style": { + "noParameterAssign": "off", + "noNonNullAssertion": "off", + "useNodejsImportProtocol": "off" + }, + "nursery": { + "useSortedClasses": "error" + }, + "recommended": true + } + } +} diff --git a/components/homepage/HomeCover.tsx b/components/homepage/HomeCover.tsx index 984dbf4..26931b5 100644 --- a/components/homepage/HomeCover.tsx +++ b/components/homepage/HomeCover.tsx @@ -6,7 +6,7 @@ export const HomeCover = () => { <>
{ />
-
{Config.Nickname}
+
{Config.Nickname}
{Config.Sentence && (
-

{Config.Sentence}

+

{Config.Sentence}

)}
diff --git a/components/layouts/index.tsx b/components/layouts/index.tsx index 2552cc7..ca1a585 100644 --- a/components/layouts/index.tsx +++ b/components/layouts/index.tsx @@ -3,5 +3,5 @@ export const Page = ({ children }: { children: React.ReactNode }) => { }; export const ContentContainer = ({ children }: { children: React.ReactNode }) => { - return
{children}
; + return
{children}
; }; diff --git a/components/mdx/Blockquote.tsx b/components/mdx/Blockquote.tsx index dc3e6e3..1888529 100644 --- a/components/mdx/Blockquote.tsx +++ b/components/mdx/Blockquote.tsx @@ -2,7 +2,7 @@ const Blockquote = (props: JSX.IntrinsicElements["blockquote"]) => { return (
{props.children} diff --git a/components/mdx/H2.tsx b/components/mdx/H2.tsx index cb1ecb4..7ae8fdc 100644 --- a/components/mdx/H2.tsx +++ b/components/mdx/H2.tsx @@ -1,6 +1,6 @@ const H2 = (props: JSX.IntrinsicElements["h2"]) => { return ( -

+

{props.children}

); diff --git a/components/mdx/ImageWrapper.tsx b/components/mdx/ImageWrapper.tsx index cc0ec37..2b7f343 100644 --- a/components/mdx/ImageWrapper.tsx +++ b/components/mdx/ImageWrapper.tsx @@ -2,9 +2,9 @@ // but all the attributes of the img tag. const ImageWrapper = (props: JSX.IntrinsicElements["img"]) => { return ( -
+
{props.alt} -
{props.alt}
+
{props.alt}
); }; diff --git a/components/mdx/PreWrapper.tsx b/components/mdx/PreWrapper.tsx index aa3bccc..eeeac38 100644 --- a/components/mdx/PreWrapper.tsx +++ b/components/mdx/PreWrapper.tsx @@ -23,7 +23,7 @@ const PreWrapper = ({ children }: { children: JSX.Element }) => { return (
{ {hovered && ( )} -
+      
         {children}
       
diff --git a/components/mdx/TableWrapper.tsx b/components/mdx/TableWrapper.tsx index 073e4dc..36e3405 100644 --- a/components/mdx/TableWrapper.tsx +++ b/components/mdx/TableWrapper.tsx @@ -1,6 +1,6 @@ const TableWrapper = ({ children }: { children: React.ReactNode }) => { return ( -
+
{children}
); diff --git a/components/readerpage/BottomCard.tsx b/components/readerpage/BottomCard.tsx index 370dccc..4884fa3 100644 --- a/components/readerpage/BottomCard.tsx +++ b/components/readerpage/BottomCard.tsx @@ -2,8 +2,8 @@ import { Config } from "@/data/config"; export const BottomCard = () => { return ( -
- {Config.AuthorName} +
+ {Config.AuthorName}

{Config.Sentence}

); diff --git a/components/readerpage/DrawerTOC.tsx b/components/readerpage/DrawerTOC.tsx index 381fd7a..4910319 100644 --- a/components/readerpage/DrawerTOC.tsx +++ b/components/readerpage/DrawerTOC.tsx @@ -1,7 +1,7 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"; import { useActiveHeading } from "@/hooks/useActiveHeading"; import useDrawerTOCState from "@/stores/useDrawerTOCState"; -import { TTOCItem } from "@/types/toc.type"; +import type { TTOCItem } from "@/types/toc.type"; import Link from "next/link"; import { MdMenuBook } from "react-icons/md"; import { twMerge } from "tailwind-merge"; @@ -13,7 +13,7 @@ export const DrawerTOC = (props: { data: TTOCItem[] }) => { return (
setIsTOCOpen(!isTOCOpen)} title="Open the table of contents"> @@ -24,12 +24,12 @@ export const DrawerTOC = (props: { data: TTOCItem[] }) => { {"TABLE OF CONTENTS"} -
    +
      {props.data?.map((item) => ( { return (
      - {props.allowShare != false ? ( +
      + {props.allowShare !== false ? ( <> @@ -39,13 +39,13 @@ export const ShareButtons = (props: { text={copyShareText} > ) : ( -
      {"SHARING IS NOT ALLOWED"}
      +
      {"SHARING IS NOT ALLOWED"}
      )}
      ); diff --git a/components/readerpage/TOC.tsx b/components/readerpage/TOC.tsx index e026555..7e2e0af 100644 --- a/components/readerpage/TOC.tsx +++ b/components/readerpage/TOC.tsx @@ -1,5 +1,5 @@ import { useActiveHeading } from "@/hooks/useActiveHeading"; -import { TTOCItem } from "@/types/toc.type"; +import type { TTOCItem } from "@/types/toc.type"; import Link from "next/link"; import { twMerge } from "tailwind-merge"; @@ -8,16 +8,16 @@ export const TOC = (props: { data: TTOCItem[] }) => { return (
      -
      +
      {"TABLE OF CONTENTS"}
      -
      +
      {props.data?.map((item) => (
      { setIsCopiedList(Config.Sponsor?.Crypto?.map(() => false) ?? []); }} > -
      +
      {Config.Sponsor?.Crypto && ( -
      +
      -

      {"Crypto"}

      +

      {"Crypto"}

      {"Supports BTC, USDT and ETH."}
      @@ -40,11 +40,11 @@ export const SponsorBoard = () => {
      )} {Config.Sponsor?.Github && Config.SocialLinks.github && ( -
      +
      -

      {"Github Sponsor"}

      +

      {"Github Sponsor"}

      @@ -57,11 +57,11 @@ export const SponsorBoard = () => {
      )} {!isEmptyString(Config.Sponsor?.WechatPayQRCodeContent) && ( -
      +
      -

      {"Wechat Pay"}

      +

      {"Wechat Pay"}

      @@ -70,11 +70,11 @@ export const SponsorBoard = () => {
      )} {!isEmptyString(Config.Sponsor?.AlipayLink) && ( -
      +
      -

      {"Alipay"}

      +

      {"Alipay"}

      @@ -87,11 +87,11 @@ export const SponsorBoard = () => {
      )} {!isEmptyString(Config.Sponsor?.PaypalId) && ( -
      +
      -

      {"Paypal"}

      +

      {"Paypal"}

      @@ -104,11 +104,11 @@ export const SponsorBoard = () => {
      )} {!isEmptyString(Config.Sponsor?.PatreonId) && ( -
      +
      -

      {"Patreon"}

      +

      {"Patreon"}

      @@ -125,7 +125,7 @@ export const SponsorBoard = () => { {"CRYPTO"}
      -
      +
      NOTE: Please confirm the corresponding block network and address before transferring money to avoid loss. @@ -133,9 +133,9 @@ export const SponsorBoard = () => {
      {Config.Sponsor?.Crypto?.map((cryptoItem, cryptoItemIndex) => ( -
      +
      -
      {`${cryptoItem.Name} - ${cryptoItem.Blockchain}`}
      +
      {`${cryptoItem.Name} - ${cryptoItem.Blockchain}`}
      @@ -148,7 +148,7 @@ export const SponsorBoard = () => { text={cryptoItem.Address} > + )}
      @@ -39,20 +41,20 @@ export const Footer = () => { - + {"RSS Feed"}
      -
      +
      NOTE: Some RSS Feed Reader may has deficient in rendering SVG formulations, graphs. Such as the Inoreader, Feedly. If it happens, please read the origin web page for better experience.
      -
      +
      { @@ -61,7 +63,7 @@ export const Footer = () => { text={RSSFeedURL} > )} -
      +
      { export const getStaticProps: GetStaticProps = async (context) => { const params = (context.params?.slug as string[]) ?? []; - const pageNumber = params[0] ? parseInt(params[0]) : 1; + const pageNumber = params[0] ? Number.parseInt(params[0]) : 1; - let postList: TPostListItem[] = paginateArray(sortedPosts.allPostList, PostCountPerPagination, pageNumber); + const postList: TPostListItem[] = paginateArray(sortedPosts.allPostList, PostCountPerPagination, pageNumber); const pageAmount = Math.ceil(sortedPosts.allPostList.length / PostCountPerPagination); diff --git a/pages/search.tsx b/pages/search.tsx index d9a2d1e..78fd568 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -8,14 +8,14 @@ import { NavBar } from "@/components/utils/NavBar"; import { SEO } from "@/components/utils/SEO"; import { Config } from "@/data/config"; import { isEmptyString } from "@/lib/utils"; -import { TSearchResultItem } from "@/types/search-result"; +import type { TSearchResultItem } from "@/types/search-result"; import axios from "axios"; import { isArray } from "lodash"; import { nanoid } from "nanoid"; -import { GetServerSideProps } from "next"; +import type { GetServerSideProps } from "next"; import Link from "next/link"; import { useRouter } from "next/router"; -import { ChangeEvent, KeyboardEvent, useEffect, useState } from "react"; +import { type ChangeEvent, type KeyboardEvent, useEffect, useState } from "react"; type SearchPageProps = { query: string | null }; @@ -88,8 +88,8 @@ export default function SearchPage(props: SearchPageProps) { -

      {"SEARCH POSTS"}

      -
      +

      {"SEARCH POSTS"}

      +
      -
      -
      +
      {searchResult.map((item, index) => (
      -
      {item.title}
      +
      {item.title}
      {item.summary &&
      {item.summary}
      }
      -
      +
      {item.tags?.map((tagitem) => ( -
      +
      {tagitem}
      ))} @@ -125,7 +125,7 @@ export default function SearchPage(props: SearchPageProps) { ))}
      -
      +

      {"For search efficiency, only the first 20 results are displayed."}

      diff --git a/pages/sponsor.tsx b/pages/sponsor.tsx index 6895623..d5c35bc 100644 --- a/pages/sponsor.tsx +++ b/pages/sponsor.tsx @@ -20,15 +20,15 @@ export default function SponsorPage() { -
      +
      -

      +

      {"SPONSOR"}

      -
      +
      diff --git a/pages/tags/[...slug].tsx b/pages/tags/[...slug].tsx index 82a3e2f..d6e2cea 100644 --- a/pages/tags/[...slug].tsx +++ b/pages/tags/[...slug].tsx @@ -10,11 +10,11 @@ import { PostCountPerPagination } from "@/consts/consts"; import { Config } from "@/data/config"; import { sortedPosts } from "@/lib/post-process"; import { paginateArray } from "@/lib/utils"; -import { TPostListItem } from "@/types/post-list"; -import { GetStaticPaths, GetStaticProps } from "next"; +import type { TPostListItem } from "@/types/post-list"; +import type { GetStaticPaths, GetStaticProps } from "next"; import Link from "next/link"; import { useRouter } from "next/router"; -import { ChangeEvent, KeyboardEvent, useEffect, useState } from "react"; +import { type ChangeEvent, type KeyboardEvent, useEffect, useState } from "react"; type TagsContentPageProps = { tagName: string | null; @@ -29,7 +29,7 @@ export default function TagsContentPage(props: TagsContentPageProps) { const handleEnterKeyJump = (event: KeyboardEvent) => { setPageNumber(pageNumber.replace(/[^\d]/g, "")); - if (parseInt(pageNumber) > 0 && parseInt(pageNumber) < props.pageAmount + 1) { + if (Number.parseInt(pageNumber) > 0 && Number.parseInt(pageNumber) < props.pageAmount + 1) { (event.key === "Go" || event.key === "Enter") && router.push(`/tags/${props.tagName}/${pageNumber}`); return; } @@ -52,13 +52,13 @@ export default function TagsContentPage(props: TagsContentPageProps) { /> -

      +

      {`Posts of ${props.tagName}`}

      -
      +
      {props.pageNumber !== 1 && ( )} -
      +
      = async (conte const params = (context.params?.slug as string[]) ?? []; const tagName = params[0] ?? null; - const pageNumber = params[1] ? parseInt(params[1]) : 1; + const pageNumber = params[1] ? Number.parseInt(params[1]) : 1; let postList: TPostListItem[] = []; postList = paginateArray(sortedPosts.postsByTag[tagName], PostCountPerPagination, pageNumber); diff --git a/scripts/archive.ts b/scripts/archive.ts index cecce40..e467331 100644 --- a/scripts/archive.ts +++ b/scripts/archive.ts @@ -1,11 +1,11 @@ +import * as fs from "fs"; +import * as path from "path"; import { UserDataDirectory } from "@/consts/consts"; import { getCurrentTime } from "@/lib/date"; import { checkAndCreateDirectory, isDirectoryEmptySync } from "@/lib/file"; import archiver from "archiver"; import Color from "colors"; -import * as fs from "fs"; import inquirer from "inquirer"; -import * as path from "path"; import * as tar from "tar"; function packageDirectory(sourceDir: string, outputFilePath: string) { diff --git a/scripts/newpost.ts b/scripts/newpost.ts index ca556fa..d1303cb 100644 --- a/scripts/newpost.ts +++ b/scripts/newpost.ts @@ -1,11 +1,11 @@ +import { type ChildProcessWithoutNullStreams, type SpawnSyncReturns, spawn, spawnSync } from "child_process"; +import fs from "fs"; +import path from "path"; import { PostFilesDirectory } from "@/consts/consts"; import { getCurrentTime } from "@/lib/date"; -import { ChildProcessWithoutNullStreams, SpawnSyncReturns, spawn, spawnSync } from "child_process"; import colors from "colors"; -import fs from "fs"; -import inquirer, { QuestionCollection } from "inquirer"; +import inquirer, { type QuestionCollection } from "inquirer"; import _ from "lodash"; -import path from "path"; import { titleCase } from "title-case"; type TAnswer = { diff --git a/tailwind.config.js b/tailwind.config.js index d82de32..f0eedc1 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -19,20 +19,6 @@ module.exports = { }, }, extend: { - keyframes: { - "accordion-down": { - from: { height: "0" }, - to: { height: "var(--radix-accordion-content-height)" }, - }, - "accordion-up": { - from: { height: "var(--radix-accordion-content-height)" }, - to: { height: "0" }, - }, - }, - animation: { - "accordion-down": "accordion-down 0.2s ease-out", - "accordion-up": "accordion-up 0.2s ease-out", - }, fontFamily: { fangzhengxiaobiaosong: "--font-fangzhengxiaobiaosong", sourceSerifScreenCN: "--content-font-cn", diff --git a/types/frontmatter.type.ts b/types/frontmatter.type.ts index 60e5094..690df3d 100644 --- a/types/frontmatter.type.ts +++ b/types/frontmatter.type.ts @@ -1,4 +1,4 @@ -import { NonEmptyArray } from "./utils.type"; +import type { NonEmptyArray } from "./utils.type"; export type TFrontmatter = { title: string; diff --git a/types/post-list.ts b/types/post-list.ts index 34fff3f..a774aa8 100644 --- a/types/post-list.ts +++ b/types/post-list.ts @@ -1,4 +1,4 @@ -import { TFrontmatter } from "./frontmatter.type"; +import type { TFrontmatter } from "./frontmatter.type"; export type TPostListItem = { id: string;