From f914f8ac96682669d3520aeaba26f9c39bd46441 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 19 May 2025 19:22:46 +0800 Subject: [PATCH] chore: change prettier to biome --- .prettierignore | 4 -- .prettierrc.json | 4 -- app/p/[slug]/page.tsx | 6 +- biome.json | 51 +++++++++++++++ components/pages/nav-bar.tsx | 5 -- package.json | 7 +- pnpm-lock.yaml | 123 +++++++++++++++++++++++++++-------- 7 files changed, 152 insertions(+), 48 deletions(-) delete mode 100644 .prettierignore delete mode 100644 .prettierrc.json create mode 100644 biome.json diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 60fd5f4..0000000 --- a/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -out -.next -public diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 937375d..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "semi": true, - "singleQuote": true -} diff --git a/app/p/[slug]/page.tsx b/app/p/[slug]/page.tsx index dbf2d2d..17afe62 100644 --- a/app/p/[slug]/page.tsx +++ b/app/p/[slug]/page.tsx @@ -72,9 +72,9 @@ const Page = async ({
{mdxSource.content} -
- -
+ {/*
*/} + {/* */} + {/*
*/}
diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..582d13c --- /dev/null +++ b/biome.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false }, + "files": { + "ignoreUnknown": false, + "ignore": [ + "**/node_modules", + "**/out", + "**/.next", + "**/public", + "**/.git", + "**/public/libs", + "**/public/models" + ] + }, + "formatter": { + "enabled": true, + "useEditorconfig": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 80, + "attributePosition": "auto", + "bracketSpacing": true, + "ignore": [ + "**/node_modules", + "**/out", + "**/.next", + "**/public", + "**/.git", + "**/public/libs", + "**/public/models" + ] + }, + "organizeImports": { "enabled": true }, + "linter": { "enabled": true, "rules": { "recommended": false } }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSameLine": false, + "quoteStyle": "single", + "attributePosition": "auto", + "bracketSpacing": true + } + } +} diff --git a/components/pages/nav-bar.tsx b/components/pages/nav-bar.tsx index 4147cdb..51c597c 100644 --- a/components/pages/nav-bar.tsx +++ b/components/pages/nav-bar.tsx @@ -8,11 +8,6 @@ import { FiMenu } from 'react-icons/fi'; import DarkModeBtn from './dark-mode-btn'; const txtMenu = [ - { - id: 0, - name: 'Home', - path: '/', - }, { id: 1, name: 'Blog', diff --git a/package.json b/package.json index 6d7620f..a13e922 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "build-local": "next build", "start": "next start", "lint": "next lint", - "pretty": "prettier --cache --write \"./**/*.{js,jsx,ts,tsx,json,md,mdx,css}\" --ignore-unknown --plugin=prettier-plugin-organize-imports", - "pretty-check": "prettier --cache \"./**/*.{js,jsx,ts,tsx,json,md,mdx,css}\" --ignore-unknown --check --plugin=prettier-plugin-organize-imports" + "check": "biome check", + "fix": "biome format" }, "dependencies": { "@catppuccin/highlightjs": "^1.0.1", @@ -48,6 +48,7 @@ "zustand": "^5.0.4" }, "devDependencies": { + "@biomejs/biome": "1.9.4", "@next/bundle-analyzer": "^15.3.2", "@types/node": "22.15.18", "@types/react": "19.1.4", @@ -62,8 +63,6 @@ "gray-matter": "^4.0.3", "leva": "^0.10.0", "postcss": "^8.4.47", - "prettier": "^3.5.3", - "prettier-plugin-organize-imports": "^4.1.0", "raw-loader": "^4.0.2", "sass": "^1.89.0", "tailwindcss": "^4.1.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1dcb2fb..6fa6f6a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -105,6 +105,9 @@ importers: specifier: ^5.0.4 version: 5.0.4(@types/react@19.1.4)(react@19.1.0)(use-sync-external-store@1.5.0(react@19.1.0)) devDependencies: + '@biomejs/biome': + specifier: 1.9.4 + version: 1.9.4 '@next/bundle-analyzer': specifier: ^15.3.2 version: 15.3.2 @@ -147,12 +150,6 @@ importers: postcss: specifier: ^8.4.47 version: 8.4.47 - prettier: - specifier: ^3.5.3 - version: 3.5.3 - prettier-plugin-organize-imports: - specifier: ^4.1.0 - version: 4.1.0(prettier@3.5.3)(typescript@5.8.3) raw-loader: specifier: ^4.0.2 version: 4.0.2(webpack@5.95.0) @@ -271,6 +268,63 @@ packages: resolution: {integrity: sha512-1x3D2xEk2fRo3PAhwQwu5UubzgiVWSXTBfWpVd2Mx2AzRqJuDJCsgaDVZ7HB5iGzDW1Hl1sWN2mFyKjmR9uAog==} engines: {node: '>=6.9.0'} + '@biomejs/biome@1.9.4': + resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==} + engines: {node: '>=14.21.3'} + hasBin: true + + '@biomejs/cli-darwin-arm64@1.9.4': + resolution: {integrity: sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + + '@biomejs/cli-darwin-x64@1.9.4': + resolution: {integrity: sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + + '@biomejs/cli-linux-arm64-musl@1.9.4': + resolution: {integrity: sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@biomejs/cli-linux-arm64@1.9.4': + resolution: {integrity: sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@biomejs/cli-linux-x64-musl@1.9.4': + resolution: {integrity: sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@biomejs/cli-linux-x64@1.9.4': + resolution: {integrity: sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@biomejs/cli-win32-arm64@1.9.4': + resolution: {integrity: sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + + '@biomejs/cli-win32-x64@1.9.4': + resolution: {integrity: sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + '@catppuccin/highlightjs@1.0.1': resolution: {integrity: sha512-wnagsNQbJroHQMalkprwRoapfGV1hHRx46d7GXp4kf6rlShImBlgpqPCt9OD471Gq4qpHdfFH/GJFIvY1CLqHA==} @@ -2953,21 +3007,6 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier-plugin-organize-imports@4.1.0: - resolution: {integrity: sha512-5aWRdCgv645xaa58X8lOxzZoiHAldAPChljr/MT0crXVOWTZ+Svl4hIWlz+niYSlO6ikE5UXkN1JrRvIP2ut0A==} - peerDependencies: - prettier: '>=2.0' - typescript: '>=2.9' - vue-tsc: ^2.1.0 - peerDependenciesMeta: - vue-tsc: - optional: true - - prettier@3.5.3: - resolution: {integrity: sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==} - engines: {node: '>=14'} - hasBin: true - promise-worker-transferable@1.0.4: resolution: {integrity: sha512-bN+0ehEnrXfxV2ZQvU2PetO0n4gqBD4ulq3MI1WOPLgr7/Mg9yRQkX5+0v1vagr74ZTsl7XtzlaYDo2EuCeYJw==} @@ -3853,6 +3892,41 @@ snapshots: '@babel/runtime@7.27.1': {} + '@biomejs/biome@1.9.4': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.9.4 + '@biomejs/cli-darwin-x64': 1.9.4 + '@biomejs/cli-linux-arm64': 1.9.4 + '@biomejs/cli-linux-arm64-musl': 1.9.4 + '@biomejs/cli-linux-x64': 1.9.4 + '@biomejs/cli-linux-x64-musl': 1.9.4 + '@biomejs/cli-win32-arm64': 1.9.4 + '@biomejs/cli-win32-x64': 1.9.4 + + '@biomejs/cli-darwin-arm64@1.9.4': + optional: true + + '@biomejs/cli-darwin-x64@1.9.4': + optional: true + + '@biomejs/cli-linux-arm64-musl@1.9.4': + optional: true + + '@biomejs/cli-linux-arm64@1.9.4': + optional: true + + '@biomejs/cli-linux-x64-musl@1.9.4': + optional: true + + '@biomejs/cli-linux-x64@1.9.4': + optional: true + + '@biomejs/cli-win32-arm64@1.9.4': + optional: true + + '@biomejs/cli-win32-x64@1.9.4': + optional: true + '@catppuccin/highlightjs@1.0.1': {} '@catppuccin/palette@1.7.1': {} @@ -7099,13 +7173,6 @@ snapshots: prelude-ls@1.2.1: {} - prettier-plugin-organize-imports@4.1.0(prettier@3.5.3)(typescript@5.8.3): - dependencies: - prettier: 3.5.3 - typescript: 5.8.3 - - prettier@3.5.3: {} - promise-worker-transferable@1.0.4: dependencies: is-promise: 2.2.2