From 9e83a1fc4109483a708a77df5d95cc50edd38e60 Mon Sep 17 00:00:00 2001 From: siroi Date: Fri, 20 Sep 2024 11:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(prettier):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20prettier=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/prettier.config.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/prettier.config.ts b/src/prettier.config.ts index e7d14c6..26004da 100644 --- a/src/prettier.config.ts +++ b/src/prettier.config.ts @@ -1,6 +1,30 @@ module.exports = { - tabWidth: 2, + tabWidth: 4, semi: true, + trailingComma: 'all', singleQuote: true, - printWidth: 120 + /** + * 建议使用 80 宽度折行 + * @see https://prettier.nodejs.cn/docs/en/options.html#%E6%A0%87%E7%AD%BE%E5%AE%BD%E5%BA%A6 + * @author siroi + * */ + printWidth: 80, + /** + * 文件换行符需要用 lf 目的是为了 ci + * @see lf 在 Linux 和 macOS 以及 git repos 中很常见 + */ + endOfLine: 'lf', + bracketSameLine: true, + bracketSpacing: true, + /** + * 允许箭头函数括号 + * @author siroi + * */ + arrowParens: 'always', + overrides: [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] }; \ No newline at end of file