Skip to content

✨ feat: better biome develop experience#39

Merged
nick-cjyx9 merged 2 commits intoopen-ani:mainfrom
mcontrib:feat/better-biome-dx
Feb 10, 2026
Merged

✨ feat: better biome develop experience#39
nick-cjyx9 merged 2 commits intoopen-ani:mainfrom
mcontrib:feat/better-biome-dx

Conversation

@maxchang3
Copy link
Contributor

@maxchang3 maxchang3 commented Feb 9, 2026

改善了 Biome 相关配置,并进行了格式化。

VS Code 配置

在原有配置基础上,为常用语言显式指定 Biome 作为默认 formatter。

仅设置 "editor.defaultFormatter": "biomejs.biome" 并不能保证所有开发者环境都会生效:因为可能在全局已经针对语言配置了其他 formatter。这是目前比较通用的实践。(参考 biomejs/biome-vscode#230@maxchang3/biome-config 等)。

Biome 配置

  • 移除 "root": true,此为默认值。
  • 添加了 Astro 支持。虽然 Biome 已在 v2.3 中提供了对 Astro 的支持,但目前仍处于 experimental 状态,实际使用中仍存在部分边缘情况可能导致文件被破坏。因此仍按照官方文档进行覆盖式配置,以保证行为可控。
  • 添加 VCS(Version Control Software)相关配置,开启 useIgnoreFile,使 .gitignore 中文件自动被 Biome 忽略。
  • 基于上述调整,重新整理了 files.includes
    • 包含所有文件(**)。考虑到 Biome 实际支持的语言范围有限,此前 includes 包含的后缀要么支持,要么不支持。
    • 移除了 .gitignore 已经涵盖的文件匹配。
    • 移除了 Biome 默认会保护的文件类型(如 lock 文件)。
  • 将 scripts 中的 code:lint 修改为 biome check --write .。项目中 Biome 同时作为 linter 和 formatter 使用,并且已启用保存时自动修复;此前脚本仅执行 lint 修复,与实际使用行为不一致,此处进行统一。

@maxchang3
Copy link
Contributor Author

如果可以的话,推荐 lint-staged 也加上 biome 检查:https://biomejs.dev/recipes/git-hooks/#lint-staged

Copy link
Member

@nick-cjyx9 nick-cjyx9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

受益匪浅

@nick-cjyx9 nick-cjyx9 merged commit 58690b7 into open-ani:main Feb 10, 2026
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.

2 participants