Skip to content

Commit 4d03f8a

Browse files
Merge pull request #6 from Jerry-CodeHub/fix/code
feat: refactor components and improve error handling
2 parents 9d026ca + 65e2ae9 commit 4d03f8a

File tree

77 files changed

+5052
-3524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5052
-3524
lines changed

.all-contributorsrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@
3333
"contributorsPerLine": 7,
3434
"linkToUsage": true
3535
}
36-

.claude/CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,21 @@ config/
5252
## 代码规范
5353

5454
### 格式化 (Prettier)
55+
5556
- 行宽: 120 字符
5657
- 单引号
5758
- 尾逗号: always
5859
- 自动排序导入
5960

6061
### ESLint 规则
62+
6163
- 禁止 `console.log` (允许 warn/error)
6264
- 未使用变量警告 (`_` 前缀可忽略)
6365
- 强制使用 `===``!==`
6466
- 禁止显式 `any` (警告)
6567

6668
### 命名规范
69+
6770
- React 组件: PascalCase (`Home.tsx`)
6871
- 工具函数: camelCase (`format.ts`)
6972
- 组件目录: PascalCase (`FullCalendar/index.tsx`)
@@ -84,16 +87,19 @@ config/
8487
## 特殊说明
8588

8689
### Cesium 地图
90+
8791
- 需要设置环境变量 `CESIUM_ION_TOKEN`
8892
- Cesium 资源在构建时自动复制到 dist/Cesium/
8993
- 全局变量 `CESIUM_BASE_URL` 指向 `/Cesium`
9094

9195
### 国际化
96+
9297
- 默认语言: zh-CN
9398
- 菜单项键名前缀: `menu.`
9499
- 使用 `useIntl()` hook 获取翻译
95100

96101
### 权限控制
102+
97103
-`src/access.ts` 定义权限
98104
- 使用 `useAccess()` hook 获取权限
99105
- 路由中通过 `access` 属性控制访问

.claude/commands/review.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,43 @@
33
请对当前更改进行代码审查,重点关注以下方面:
44

55
## 审查范围
6+
67
- 分析 `git diff` 中的所有更改
78

89
## 审查要点
910

1011
### 1. 代码质量
12+
1113
- 代码是否清晰易读
1214
- 命名是否符合项目规范(组件 PascalCase,函数 camelCase)
1315
- 是否有重复代码可以抽取
1416

1517
### 2. TypeScript 类型
18+
1619
- 类型定义是否完整
1720
- 是否避免使用 `any`
1821
- 接口/类型是否合理
1922

2023
### 3. React 最佳实践
24+
2125
- Hooks 使用是否正确(依赖数组)
2226
- 是否有不必要的重渲染
2327
- 组件拆分是否合理
2428

2529
### 4. 安全性
30+
2631
- 是否有 XSS 风险
2732
- 敏感信息是否暴露
2833
- API 调用是否安全
2934

3035
### 5. 性能
36+
3137
- 是否有明显的性能问题
3238
- 大列表是否需要虚拟滚动
3339
- 是否有内存泄漏风险
3440

3541
### 6. 项目规范
42+
3643
- 是否符合 ESLint 规则
3744
- 是否符合 Prettier 格式
3845
- 国际化文案是否完整

.lintstagedrc

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
{
2-
"*.{md,json}": [
3-
"prettier --cache --write"
4-
],
5-
"*.{js,jsx}": [
6-
"max lint --fix --eslint-only",
7-
"prettier --cache --write"
8-
],
9-
"*.{css,less}": [
10-
"max lint --fix --stylelint-only",
11-
"prettier --cache --write"
12-
],
13-
"*.ts?(x)": [
14-
"max lint --fix --eslint-only",
15-
"prettier --cache --parser=typescript --write"
16-
]
2+
"*.{md,json}": ["prettier --cache --write"],
3+
"*.{js,jsx}": ["max lint --fix --eslint-only", "prettier --cache --write"],
4+
"*.{css,less}": ["max lint --fix --stylelint-only", "prettier --cache --write"],
5+
"*.ts?(x)": ["max lint --fix --eslint-only", "prettier --cache --parser=typescript --write"]
176
}

0 commit comments

Comments
 (0)