@@ -12,86 +12,39 @@ language: "zh-CN"
1212# -----------------
1313
1414reviews :
15- # 高级摘要配置
16- high_level_summary : true
17- high_level_summary_placeholder : " 这是 Open Source Bazaar 项目的 PR 变更摘要"
18-
19- # 路径过滤 - 排除 Next.js 项目中不需要审查的文件和目录
20- path_filters :
21- - " src/**"
22- - " pages/**"
23- - " components/**"
24- - " models/**"
25- - " !**/*.md"
26- - " !**/*.{bin,csv}"
27- - " !node_modules/**"
28- - " !.next/**"
29- - " !public/**"
30- - " !out/**"
31- - " !next-env.d.ts"
32- - " !package-lock.json"
33- - " !pnpm-lock.yaml"
34- - " !yarn.lock"
35- - " !**/__snapshots__/**"
36-
37- # 代码生成指令
38- code_generation :
39- docstrings :
40- path_instructions :
41- " pages/** " : " 确保所有用户界面文本使用 t() 函数进行国际化翻译"
42- " components/** " : " 必须使用 React Bootstrap 组件替代自定义 HTML 元素"
43- " models/** " : " 检查 MobX store 的正确使用,包括 @observer、@observable、@action、@computed"
44-
45- # 工具配置
46- tools :
47- typescript :
48- enabled : true
49- config : " tsconfig.json"
50- eslint :
51- enabled : true
52- config : " eslint.config.ts"
15+ # 高级摘要配置
16+ high_level_summary : true
17+ high_level_summary_placeholder : " 这是 Open Source Bazaar 项目的 PR 变更摘要"
18+
19+ # 路径过滤 - 排除 Next.js 项目中不需要审查的文件和目录
20+ path_filters :
21+ - " src/**"
22+ - " pages/**"
23+ - " components/**"
24+ - " models/**"
25+ - " !**/*.md"
26+ - " !**/*.{bin,csv}"
27+ - " !node_modules/**"
28+ - " !.next/**"
29+ - " !public/**/*.{png,jpg,jpeg,gif,webp,svg,ico,mp4,mp3,woff,woff2,ttf,otf}"
30+ - " !out/**"
31+ - " !next-env.d.ts"
32+ - " !package-lock.json"
33+ - " !pnpm-lock.yaml"
34+ - " !yarn.lock"
35+ - " !**/__snapshots__/**"
36+
37+ # 代码生成指令
38+ code_generation :
39+ docstrings :
40+ path_instructions :
41+ " pages/** " : " 确保所有用户界面文本使用 t() 函数进行国际化翻译"
42+ " components/** " : " 必须使用 React Bootstrap 组件替代自定义 HTML 元素"
43+ " models/** " : " 检查 MobX store 的正确使用,包括 @observer、@observable、@action、@computed"
5344
5445# 全局语气指令
5546tone_instructions : |
56- 这是一个基于 Next.js 15 (Pages Router) + TypeScript + MobX + React Bootstrap 的项目。请像一位资深的开发者一样进行审查,并严格遵循以下规则:
57-
58- 1. **React Bootstrap 组件使用**:
59- - 必须使用 React Bootstrap 组件替代自定义 HTML 元素
60- - 使用 `<Button variant="outline-primary">` 而不是 `<a className="btn btn-outline-primary">`
61- - 使用 `<Badge bg="secondary">` 而不是 `<span className="badge bg-secondary">`
62- - 优先使用现有的 Bootstrap 组件库
63-
64- 2. **MobX 状态管理**:
65- - 检查 MobX store 的正确使用,包括 `@observer` 装饰器
66- - 确保 `@observable`、`@action`、@computed` 的正确使用
67- - 验证组件正确连接到 MobX store
68-
69- 3. **国际化 (i18n) 要求**:
70- - 所有用户界面文本必须使用 `t()` 函数进行翻译
71- - 检查翻译键是否在所有语言文件中存在 (zh-CN.ts, en-US.ts, zh-TW.ts)
72- - 使用通用术语如 `t('knowledge_base')` 而不是特定术语
73-
74- 4. **GitHub API 集成**:
75- - 检查是否从 `models/Base.ts` 导入配置的 `githubClient`
76- - 验证 GitHub API 认证和错误处理的正确实现
77- - 确保 Base64 内容编解码使用 `web-utility` 包中的 `encodeBase64()`、`decodeBase64()`,以便正确处理 Unicode
78-
79- 5. **Pages Router 最佳实践**:
80- - 检查 `getStaticProps` 和 `getServerSideProps` 的正确使用
81- - 验证 API 路由的结构和错误处理
82- - 确保静态生成时的错误处理(让错误自然冒泡)
83-
84- 6. **TypeScript 类型安全**:
85- - 强类型定义,避免使用 `any` 类型
86- - 正确使用泛型和接口
87- - 确保 React 组件 props 正确类型化
88-
89- 7. **性能优化**:
90- - 使用 `next/image` 组件进行图片优化
91- - 检查不必要的重新渲染
92- - 确保 MobX 的响应式性能优化
93-
94- 8. **代码组织**:
95- - 遵循现有的项目结构
96- - 使用现有的工具库(如 `web-utility`)
97- - 保持代码的可读性和模块化
47+ 使用专业中文语气。重点关注:1) 统一用 React Bootstrap;2) MobX
48+ observer/observable/action/computed 是否正确;3) 全部 UI 文本用 t();4) GitHub
49+ API 认证/错误处理与 Base64 统一用 web-utility;5) Pages Router 的数据获取正确;
50+ 6) TypeScript 强类型;7) 性能(next/image、避免多余渲染);8) 结构清晰。
0 commit comments