setup-react-doctor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetup React Doctor
配置React Doctor
What This Sets Up
配置内容
- react-doctor package for codebase health scoring (0-100)
- package.json script
doctor - disabling biome-overlapping rules
react-doctor.config.json - Stop hook running doctor on changed files, failing on score drop
- react-doctor 包:用于代码库健康度评分(分值范围0-100)
- package.json脚本
doctor - 配置文件,禁用与biome重叠的规则
react-doctor.config.json - Stop钩子:文件变更时运行doctor检查,评分下降时直接报错终止
Steps
步骤
1. Install
1. 安装
bash
bun add -D react-doctor --yarnbash
bun add -D react-doctor --yarn2. Add package.json script
2. 添加package.json脚本
json
{
"scripts": {
"doctor": "react-doctor ."
}
}json
{
"scripts": {
"doctor": "react-doctor ."
}
}3. Create react-doctor.config.json
react-doctor.config.json3. 创建react-doctor.config.json
react-doctor.config.jsonjson
{
"ignore": {
"rules": [
"react-hooks/exhaustive-deps",
"react/no-nested-component"
]
}
}json
{
"ignore": {
"rules": [
"react-hooks/exhaustive-deps",
"react/no-nested-component"
]
}
}4. Create Stop hook script
4. 创建Stop钩子脚本
Copy into . Make executable.
scripts/react-doctor-stop.sh.claude/hooks/将复制到目录下,赋予可执行权限。
scripts/react-doctor-stop.sh.claude/hooks/5. Configure hook in .claude/settings.json
.claude/settings.json5. 在.claude/settings.json
中配置钩子
.claude/settings.jsonAdd to hooks config: Stop:
.claude/hooks/react-doctor-stop.sh在钩子配置中添加以下内容:Stop:
.claude/hooks/react-doctor-stop.sh6. Codex compatibility (optional)
6. Codex兼容(可选)
If the project also uses OpenAI Codex, run to generate from the Claude Code config.
codex-compat.codex/hooks.json如果项目同时使用OpenAI Codex,运行命令基于Claude Code配置生成文件。
codex-compat.codex/hooks.json7. Verify & Commit
7. 验证与提交
- works
bun run doctor - exists
react-doctor.config.json - Stop hook is executable
Commit:
Add react-doctor health scoring with Stop hook- 可正常执行
bun run doctor - 文件已存在
react-doctor.config.json - Stop钩子已具备可执行权限
提交信息:
Add react-doctor health scoring with Stop hook