code-formatting

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Formatting

代码格式化

Format JS/TS/JSON files changed on the current branch using Biome.
使用Biome对当前分支中修改的JS/TS/JSON文件进行格式化。

Quick Usage

快速使用

bash
.claude/skills/code-formatting/scripts/format-branch.sh
This formats all
.js
,
.ts
,
.jsx
,
.tsx
,
.json
,
.jsonc
files changed compared to
main
.
bash
.claude/skills/code-formatting/scripts/format-branch.sh
此命令会格式化所有相对于
main
分支修改的
.js
.ts
.jsx
.tsx
.json
.jsonc
文件。

Custom Base Branch

自定义基准分支

bash
.claude/skills/code-formatting/scripts/format-branch.sh develop
bash
.claude/skills/code-formatting/scripts/format-branch.sh develop

What It Does

功能说明

  1. Finds files changed on current branch vs base branch
  2. Filters to JS/TS/JSON files only
  3. Runs
    npx biome check --write
    on those files
  4. Uses same settings as the
    biome-check.yml
    CI workflow
  1. 找出当前分支相对于基准分支修改的文件
  2. 仅筛选JS/TS/JSON类型的文件
  3. 对这些文件执行
    npx biome check --write
    命令
  4. 使用与
    biome-check.yml
    CI工作流相同的配置

Config

配置

Biome config is at
biome.jsonc
in repo root.
Biome的配置文件位于仓库根目录的
biome.jsonc

Notes

注意事项

  • Run from repo root
  • Requires Node.js/npx
  • Only formats changed files (not entire codebase)
  • 需在仓库根目录运行
  • 要求安装Node.js/npx
  • 仅格式化修改过的文件(而非整个代码库)