fischerX/docs/development/standards/coding-standards.md

53 lines
1.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 代码规范
> **文档版本**: v1.0.0
> **创建日期**: 2026-05-25
> **最后更新**: 2026-05-25
> **文档作者**: 开发团队
> **文档状态**: 草稿
## 目录
- [一、TypeScript 规范](#一typescript-规范)
- [二、React 规范](#二react-规范)
- [三、Git 提交规范](#三git-提交规范)
---
## 一、TypeScript 规范
- 使用 TypeScript禁止使用 `any`
- 使用 `const` 优先,`let` 其次
- 文件使用 kebab-case`user-service.ts`
- 类型使用 PascalCase`UserService`
- 变量使用 camelCase`userName`
## 二、React 规范
- 函数组件优先
- 使用 React Hooks
- 组件文件使用 PascalCase`UserProfile.tsx`
- 逻辑与 UI 分离
## 三、Git 提交规范
使用 Conventional Commits
```
<type>(<scope>): <description>
类型:
- feat: 新功能
- fix: 修复bug
- docs: 文档更新
- style: 代码格式
- refactor: 重构
- test: 测试
- chore: 构建/工具
```
---
> **文档维护**: 本文档由开发团队维护
> **最后更新**: 2026-05-25