From bfad693bd07c817d43ac66ff7db8076711416555 Mon Sep 17 00:00:00 2001 From: R2m1liA <15258427350@163.com> Date: Wed, 17 Sep 2025 14:47:56 +0800 Subject: [PATCH] =?UTF-8?q?chore(styles):=20=E4=B8=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=80=E5=8F=91=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加Prettier、ESLint用于规范代码风格 - 添加Prettier配置文件 --- package.json | 5 +++-- pnpm-lock.yaml | 16 +++++++++++++--- prettier.config.mjs | 30 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 prettier.config.mjs diff --git a/package.json b/package.json index 065e018..3a72a44 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "@vueuse/nuxt": "^13.6.0", "dompurify": "^3.2.6", "element-plus": "^2.10.7", - "eslint": "^9.0.0", "markdown-it": "^14.1.0", "meilisearch": "^0.53.0", "nuxt": "^4.0.3", @@ -38,6 +37,8 @@ "@commitlint/cli": "^19.8.1", "@commitlint/config-conventional": "^19.8.1", "@element-plus/nuxt": "^1.1.4", - "husky": "^9.1.7" + "eslint": "^9.35.0", + "husky": "^9.1.7", + "prettier": "^3.6.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b731690..e31e227 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,9 +50,6 @@ importers: element-plus: specifier: ^2.10.7 version: 2.11.2(vue@3.5.21(typescript@5.9.2)) - eslint: - specifier: ^9.0.0 - version: 9.35.0(jiti@2.5.1) markdown-it: specifier: ^14.1.0 version: 14.1.0 @@ -84,9 +81,15 @@ importers: '@element-plus/nuxt': specifier: ^1.1.4 version: 1.1.4(@element-plus/icons-vue@2.3.2(vue@3.5.21(typescript@5.9.2)))(element-plus@2.11.2(vue@3.5.21(typescript@5.9.2)))(magicast@0.3.5) + eslint: + specifier: ^9.35.0 + version: 9.35.0(jiti@2.5.1) husky: specifier: ^9.1.7 version: 9.1.7 + prettier: + specifier: ^3.6.2 + version: 3.6.2 packages: @@ -4455,6 +4458,11 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier@3.6.2: + resolution: {integrity: sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==} + engines: {node: '>=14'} + hasBin: true + pretty-bytes@7.0.1: resolution: {integrity: sha512-285/jRCYIbMGDciDdrw0KPNC4LKEEwz/bwErcYNxSJOi4CpGUuLpb9gQpg3XJP0XYj9ldSRluXxih4lX2YN8Xw==} engines: {node: '>=20'} @@ -10469,6 +10477,8 @@ snapshots: prelude-ls@1.2.1: {} + prettier@3.6.2: {} + pretty-bytes@7.0.1: {} process-nextick-args@2.0.1: {} diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..1ecb88d --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,30 @@ +/** + * @see https://prettier.io/docs/en/configuration.html + * @type {import("prettier").Config} + */ +export default { + // 打印宽度 + "printWidth": 80, + // 缩进空格数 + "tabWidth": 2, + // 使用制表符而不是空格缩进 + "useTabs": false, + // 句尾添加分号 + "semi": true, + // 使用单引号 + "singleQuote": true, + // 尾随逗号 + "trailingComma": "es5", + // 对象大括号内的空格 + "bracketSpacing": true, + // 箭头函数参数括号 + "arrowParens": "always", + // 括号行位置 + "bracketSameLine": true, + // 换行符使用 lf + "endOfLine": "lf", + // HTML 空格敏感度 + "htmlWhitespaceSensitivity": "css", + // Vue 文件脚本和样式缩进 + "vueIndentScriptAndStyle": true, +} \ No newline at end of file