From d75ae5fc3e91d69fb7ca1614564ef0851a545db4 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Thu, 21 Apr 2022 14:14:40 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=9F=BA=E7=A1=80=20prettier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierignore | 15 +++++++++++++++ package.json | 1 + prettier.config.js | 21 +++++++++++++++++++++ src/App.vue | 19 ++++++++++--------- src/types/components.d.ts | 1 - vite.config.ts | 32 ++++++++++++++++---------------- 6 files changed, 63 insertions(+), 26 deletions(-) create mode 100644 .prettierignore create mode 100644 prettier.config.js diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..54926961 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,15 @@ +# prettier 会忽略的文件 + +/dist/* +.local +.output.js +/node_modules/** + +**/*.svg +**/*.sh + +/public/* + +.DS_Store +*.local +*.log diff --git a/package.json b/package.json index d7e00047..3fb16553 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "devDependencies": { "@types/node": "^17.0.25", "@vitejs/plugin-vue": "^2.3.1", + "prettier": "^2.6.2", "typescript": "^4.6.3", "unplugin-auto-import": "^0.7.1", "unplugin-vue-components": "^0.19.3", diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 00000000..aaec6a22 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,21 @@ +/** 配置项文档:https://prettier.io/docs/en/configuration.html */ +module.exports = { + /** 每一行的宽度 */ + printWidth: 120, + /** tab 健的空格数 */ + tabWidth: 2, + /** 在对象中的括号之间用空格来间隔 */ + bracketSpacing: true, + /** 箭头函数的参数无论有几个,都要括号包裹 */ + arrowParens: 'always', + /** 换行符的使用 */ + endOfLine: 'auto', + /** 采用单引号 */ + singleQuote: true, + /** 对象或者数组的最后一个元素后面是否要加逗号 */ + trailingComma: 'all', + /** 不加分号 */ + semi: false, + /** 不使用 tab 格式化 */ + useTabs: false, +} diff --git a/src/App.vue b/src/App.vue index 084f3112..1b90cf6e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,16 @@