Skip to content

Conversation

@LooseLi
Copy link
Contributor

@LooseLi LooseLi commented Apr 16, 2025

尽量按此模板PR内容,或粘贴相关的ISSUE链接。

已知问题

不同开发者有着不同的开发风格且使用不同的编辑器和个人配置,容易导致代码风格不统一
(作为一个有代码洁癖的人🫠 管不住自己的脑子和手

解决方案

  1. 更新 .prettierrc.json 文件,使用最新推荐的配置选项
  2. 创建 .prettierignore 文件,排除不需要格式化的文件和目录
  3. 在 package.json 中添加标准化的格式化命令
  4. 运行自动格式化代码脚本

未来可以考虑以下改进:

  • 提供 VS Code 设置建议(.vscode/settings.json)
  • 添加 Husky 与 lint-staged 集成,在代码提交前自动格式化。不过可能会影响开发者的开发节奏和爽感
  • 集成 CI/CD 流程。不过 CI/CD 流程中的代码格式检查通常只能检查代码是否符合规范,而不会自动格式化代码

改动收益

  1. 可以定期运行脚本进行代码格式化
  2. 统一的代码风格有助于提高可读性和可维护性
  3. 减少由于格式差异导致的合并冲突
  4. 代码洁癖患者狂喜

具体改动

  • .prettierrc.json
  • .prettierignore
  • 添加格式化脚本到 package.json

测试确认

  • 本地开发环境测试通过
  • 生产环境构建测试通过
  • 版本号正确显示
  • 环境变量配置正常工作

@vercel
Copy link

vercel bot commented Apr 16, 2025

@LooseLi is attempting to deploy a commit to the tangly1024's projects Team on Vercel.

A member of the Team first needs to authorize it.


(!hasConverted &&
(block.type === 'bookmark' ||
ret.includes('secure.notion-static.com') ||

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
secure.notion-static.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant