diff --git a/.eslintrc.json b/.eslintrc.json index 5343646..c60a10f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,13 +7,22 @@ ], "parser": "@typescript-eslint/parser", "parserOptions": { - "project": ["./tsconfig.json"] + "project": [ + "./tsconfig.json" + ] }, - "plugins": ["@typescript-eslint"], + "plugins": [ + "@typescript-eslint" + ], "rules": { "eqeqeq": "error", "no-else-return": "error", - "no-implicit-coercion": ["error", { "disallowTemplateShorthand": true }], + "no-implicit-coercion": [ + "error", + { + "disallowTemplateShorthand": true + } + ], "no-unneeded-ternary": "error", "no-useless-call": "error", "no-useless-computed-key": "error", @@ -23,7 +32,10 @@ "prefer-rest-params": "error", "prefer-spread": "error", "prefer-template": "error", - "radix": ["error", "always"], + "radix": [ + "error", + "always" + ], "react-hooks/exhaustive-deps": "error", "@typescript-eslint/no-misused-promises": [ "error", @@ -31,9 +43,10 @@ "checksVoidReturn": false } ], - "@typescript-eslint/no-confusing-void-expression":"off", + "@typescript-eslint/no-confusing-void-expression": "off", "@typescript-eslint/no-unsafe-return": "off", "@typescript-eslint/no-unsafe-call": "off", - "@typescript-eslint/prefer-nullish-coalescing": "off" + "@typescript-eslint/prefer-nullish-coalescing": "off", + "@typescript-eslint/no-unsafe-member-access": "warn" } -} +} \ No newline at end of file diff --git a/biome.json b/biome.json index d8b3122..caf62ad 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.5.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", "organizeImports": { "enabled": true }, @@ -18,7 +18,7 @@ "formatter": { "semicolons": "asNeeded", "lineEnding": "lf", - "trailingComma": "all" + "trailingCommas": "all" } } } diff --git a/bun.lockb b/bun.lockb index e24a9f9..ab50a32 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index b35bb01..543952b 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,13 @@ "email": "zx8244@qq.com" }, "scripts": { - "next-start": "cross-env BROWSER=none next dev", + "next-start": "cross-env BROWSER=none next dev --turbo", "next-build": "next build", "tauri": "tauri", "build": "tauri build", "dev": "tauri dev", "lint": "next lint && biome check src/", + "fix": "next lint --fix && biome check src/ --fix", "prepare": "husky" }, "dependencies": { @@ -54,8 +55,8 @@ "clsx": "^2.1.1", "cross-env": "^7.0.3", "cssnano": "^7.0.6", - "eslint": "^8.57.1", - "eslint-config-next": "^14.2.17", + "eslint": "9.14.0", + "eslint-config-next": "15.0.3", "husky": "^9.1.6", "lint-staged": "^15.2.10", "postcss": "^8.4.48", diff --git a/src/app/(main)/console/page.tsx b/src/app/(main)/console/page.tsx index 4eb958b..635ee63 100644 --- a/src/app/(main)/console/page.tsx +++ b/src/app/(main)/console/page.tsx @@ -1,3 +1,3 @@ export default function Page() { - return
Console
; + return
Console
} diff --git a/src/app/(main)/gear/page.tsx b/src/app/(main)/gear/page.tsx index 2ca8eb9..b32ea3b 100644 --- a/src/app/(main)/gear/page.tsx +++ b/src/app/(main)/gear/page.tsx @@ -1,3 +1,3 @@ export default function Page() { - return
Gear
; + return
Gear
} diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx index c90c9af..8a70f48 100644 --- a/src/app/(main)/home/page.tsx +++ b/src/app/(main)/home/page.tsx @@ -1,12 +1,12 @@ -"use client"; +"use client" -import CommonDir from "@/components/cstb/CommonDir"; -import FastLaunch from "@/components/cstb/FastLaunch"; -import ForceQuit from "@/components/cstb/ForceQuit"; -import LaunchOption from "@/components/cstb/LaunchOption"; -import Notice from "@/components/cstb/Notice"; -import PowerPlan from "@/components/cstb/PowerPlan"; -import SmartTransfer from "@/components/cstb/SmartTranser"; +import CommonDir from "@/components/cstb/CommonDir" +import FastLaunch from "@/components/cstb/FastLaunch" +import ForceQuit from "@/components/cstb/ForceQuit" +import LaunchOption from "@/components/cstb/LaunchOption" +import Notice from "@/components/cstb/Notice" +import PowerPlan from "@/components/cstb/PowerPlan" +import SmartTransfer from "@/components/cstb/SmartTranser" const Home = () => { return ( @@ -25,7 +25,7 @@ const Home = () => { - ); -}; + ) +} -export default Home; +export default Home diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index c7d1a88..b20fa42 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -1,14 +1,14 @@ "use client" -import Header from "@/components/window/Header"; -import Nav from "@/components/window/Nav"; -import SideBar from "@/components/window/SideBar"; -import clsx from "clsx"; +import Header from "@/components/window/Header" +import Nav from "@/components/window/Nav" +import SideBar from "@/components/window/SideBar" +import clsx from "clsx" // import { platform } from "@tauri-apps/plugin-os" export default function BaseLayout({ children, }: { - children: React.ReactNode; + children: React.ReactNode }) { return (
@@ -20,7 +20,7 @@ export default function BaseLayout({
diff --git a/src/app/(main)/movie/page.tsx b/src/app/(main)/movie/page.tsx index 3947bf4..1d84b4d 100644 --- a/src/app/(main)/movie/page.tsx +++ b/src/app/(main)/movie/page.tsx @@ -1,3 +1,3 @@ export default function Page() { - return
Movie
; + return
Movie
} diff --git a/src/app/(main)/preference/layout.tsx b/src/app/(main)/preference/layout.tsx index 2375372..55d8c7c 100644 --- a/src/app/(main)/preference/layout.tsx +++ b/src/app/(main)/preference/layout.tsx @@ -1,12 +1,26 @@ "use client" -import { Card, CardHeader, CardIcon, CardTool, CardBody } from "@/components/window/Card" +import { + Card, + CardBody, + CardHeader, + CardIcon, + CardTool, +} from "@/components/window/Card" import { ToolButton } from "@/components/window/ToolButton" -import { SettingConfig, UploadOne, HardDisk, AssemblyLine, Videocamera } from "@icon-park/react" +import { + AssemblyLine, + HardDisk, + SettingConfig, + UploadOne, + Videocamera, +} from "@icon-park/react" import clsx from "clsx" import { usePathname, useRouter } from "next/navigation" // import { platform } from "@tauri-apps/plugin-os" -export default function PreferenceLayout({ children }: { children: React.ReactNode }) { +export default function PreferenceLayout({ + children, +}: { children: React.ReactNode }) { const router = useRouter() const pathname = usePathname() diff --git a/src/app/(main)/tool/page.tsx b/src/app/(main)/tool/page.tsx index 4048311..92e52d0 100644 --- a/src/app/(main)/tool/page.tsx +++ b/src/app/(main)/tool/page.tsx @@ -1,3 +1,3 @@ export default function Page() { - return
Tool
; + return
Tool
} diff --git a/src/app/globals.css b/src/app/globals.css index 63007cd..cf2eba9 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -8,8 +8,8 @@ body { margin: 0; width: 100%; height: 100%; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, - Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, + Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; /* background: transparent; */ background: rgba(242, 241, 243, 0.65); border-radius: 10px; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 7137574..5a427fe 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,9 +2,9 @@ export const metadata = { title: "CS工具箱", description: "Generated by Next.js", icons: ["/favicon.ico"], -}; +} -import "./globals.css"; +import "./globals.css" export default function RootLayout({ children, diff --git a/src/app/page.tsx b/src/app/page.tsx index 6d995d1..f4aad10 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,20 +1,26 @@ -"use client"; +"use client" -import { useRouter } from "next/navigation"; +import { useRouter } from "next/navigation" const Home = () => { - const router = useRouter(); + const router = useRouter() return (
-

CS 工具箱

-
) -}; +} -export default Home; +export default Home diff --git a/src/app/prepare/layout.tsx b/src/app/prepare/layout.tsx index c94cc93..caeaf30 100644 --- a/src/app/prepare/layout.tsx +++ b/src/app/prepare/layout.tsx @@ -1,6 +1,8 @@ import Nav from "@/components/window/Nav" -export default function BaseLayout({ children }: { children: React.ReactNode }) { +export default function BaseLayout({ + children, +}: { children: React.ReactNode }) { return (
- ); + ) } diff --git a/src/components/cstb/CommonDir.tsx b/src/components/cstb/CommonDir.tsx index 6e010aa..8be9d35 100644 --- a/src/components/cstb/CommonDir.tsx +++ b/src/components/cstb/CommonDir.tsx @@ -1,17 +1,20 @@ -import { FolderFocusOne } from "@icon-park/react"; -import { Card, CardHeader, CardIcon, CardBody } from "../window/Card"; +import { FolderFocusOne } from "@icon-park/react" +import { Card, CardBody, CardHeader, CardIcon } from "../window/Card" interface RoundedButtonProps { - children?: React.ReactNode; + children?: React.ReactNode } const RoundedButton = ({ children }: RoundedButtonProps) => { return ( - - ); -}; + ) +} const CommonDir = () => { return ( @@ -33,7 +36,7 @@ const CommonDir = () => { - ); -}; + ) +} -export default CommonDir; +export default CommonDir diff --git a/src/components/cstb/FastLaunch.tsx b/src/components/cstb/FastLaunch.tsx index f808ae0..969aa30 100644 --- a/src/components/cstb/FastLaunch.tsx +++ b/src/components/cstb/FastLaunch.tsx @@ -1,6 +1,6 @@ -import { TakeOff } from "@icon-park/react"; -import { Card, CardHeader, CardIcon, CardBody } from "../window/Card"; +import { TakeOff } from "@icon-park/react" import { invoke } from "@tauri-apps/api/core" +import { Card, CardBody, CardHeader, CardIcon } from "../window/Card" const FastLaunch = () => { return ( @@ -13,6 +13,7 @@ const FastLaunch = () => {
- + +
- ); -}; + ) +} -export default ForceQuit; +export default ForceQuit diff --git a/src/components/cstb/LaunchOption.tsx b/src/components/cstb/LaunchOption.tsx index c118f91..9095b88 100644 --- a/src/components/cstb/LaunchOption.tsx +++ b/src/components/cstb/LaunchOption.tsx @@ -1,10 +1,11 @@ -import { Plus, SettingConfig, Switch } from "@icon-park/react"; -import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card"; -import { ToolButton } from "../window/ToolButton"; -import useToolStore from "@/store/tool"; +import useToolStore from "@/store/tool" +import { Plus, SettingConfig, Switch } from "@icon-park/react" +import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card" +import { ToolButton } from "../window/ToolButton" const LaunchOption = () => { - const { launchOptions, setLaunchOption, launchIndex, setLaunchIndex } = useToolStore() + const { launchOptions, setLaunchOption, launchIndex, setLaunchIndex } = + useToolStore() return ( @@ -35,7 +36,7 @@ const LaunchOption = () => { /> - ); -}; + ) +} -export default LaunchOption; +export default LaunchOption diff --git a/src/components/cstb/Notice.tsx b/src/components/cstb/Notice.tsx index d03271d..5300437 100644 --- a/src/components/cstb/Notice.tsx +++ b/src/components/cstb/Notice.tsx @@ -1,16 +1,16 @@ -import { Refresh, VolumeNotice } from "@icon-park/react"; import { + Card, + CardBody, CardHeader, CardIcon, CardTool, - CardBody, - Card, -} from "@/components/window/Card"; -import { ToolButton } from "../window/ToolButton"; -import useAppStore from "@/store/app"; +} from "@/components/window/Card" +import useAppStore from "@/store/app" +import { Refresh, VolumeNotice } from "@icon-park/react" +import { ToolButton } from "../window/ToolButton" const Notice = () => { - const app = useAppStore(); + const app = useAppStore() return ( @@ -24,9 +24,11 @@ const Notice = () => { - {app.notice || "不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl"} + + {app.notice || "不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl"} + ) -}; +} -export default Notice; +export default Notice diff --git a/src/components/cstb/PowerPlan.tsx b/src/components/cstb/PowerPlan.tsx index 8fdb9de..edc20f6 100644 --- a/src/components/cstb/PowerPlan.tsx +++ b/src/components/cstb/PowerPlan.tsx @@ -1,7 +1,7 @@ -import { BatteryCharge, Refresh } from "@icon-park/react"; -import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card"; -import { ToolButton } from "../window/ToolButton"; -import { invoke } from "@tauri-apps/api/core"; +import { BatteryCharge, Refresh } from "@icon-park/react" +import { invoke } from "@tauri-apps/api/core" +import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card" +import { ToolButton } from "../window/ToolButton" const PowerPlan = () => { return ( @@ -19,13 +19,31 @@ const PowerPlan = () => {
- - - + + +
- ); -}; + ) +} -export default PowerPlan; +export default PowerPlan diff --git a/src/components/cstb/SmartTranser.tsx b/src/components/cstb/SmartTranser.tsx index ada0eeb..7db47d8 100644 --- a/src/components/cstb/SmartTranser.tsx +++ b/src/components/cstb/SmartTranser.tsx @@ -1,6 +1,6 @@ -import { FolderConversion, FolderPlus } from "@icon-park/react"; -import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card"; -import { ToolButton } from "../window/ToolButton"; +import { FolderConversion, FolderPlus } from "@icon-park/react" +import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card" +import { ToolButton } from "../window/ToolButton" const SmartTransfer = () => { return ( @@ -22,7 +22,7 @@ const SmartTransfer = () => { - ); -}; + ) +} -export default SmartTransfer; +export default SmartTransfer diff --git a/src/components/window/Card.tsx b/src/components/window/Card.tsx index e8ff30e..560bfed 100644 --- a/src/components/window/Card.tsx +++ b/src/components/window/Card.tsx @@ -1,5 +1,5 @@ -import { ReactNode } from "react" import clsx from "clsx" +import type { ReactNode } from "react" interface CardProps { children?: ReactNode @@ -20,23 +20,41 @@ const Card = ({ children }: CardProps) => { } const CardHeader = ({ children }: CardProps) => { - return
{children}
+ return ( +
{children}
+ ) } const CardIcon = ({ children, type, className, ...rest }: CardProps) => { return ( -
+
{children}
) } const CardTool = ({ children }: CardProps) => { - return
{children}
+ return ( +
+ {children} +
+ ) } const CardBody = ({ children }: CardProps) => { - return
{children}
+ return ( +
+ {children} +
+ ) } export { Card, CardHeader, CardIcon, CardTool, CardBody } diff --git a/src/components/window/Header.tsx b/src/components/window/Header.tsx index 9463f4c..fccdb28 100644 --- a/src/components/window/Header.tsx +++ b/src/components/window/Header.tsx @@ -8,7 +8,7 @@ const Header = () => { 本周使用CS工具箱 114 小时

- ); -}; + ) +} -export default Header; +export default Header diff --git a/src/components/window/Nav.tsx b/src/components/window/Nav.tsx index c8296d3..c339880 100644 --- a/src/components/window/Nav.tsx +++ b/src/components/window/Nav.tsx @@ -1,9 +1,9 @@ "use client" -import { RocketOne, Minus, Close, Square } from "@icon-park/react" -import { /* relaunch, */ exit } from "@tauri-apps/plugin-process" +import { Close, Minus, RocketOne, Square } from "@icon-park/react" import { getCurrentWindow } from "@tauri-apps/api/window" +import { /* relaunch, */ exit } from "@tauri-apps/plugin-process" // import { platform } from "@tauri-apps/plugin-os" -import { useRouter, usePathname } from "next/navigation" +import { usePathname, useRouter } from "next/navigation" const Nav = () => { const close = async () => { @@ -35,35 +35,44 @@ const Nav = () => { const pathname = usePathname() return ( -