Skip to content

Commit d0d1e77

Browse files
committed
Merge branch 'dev'
2 parents d9a2b98 + f36ee33 commit d0d1e77

84 files changed

Lines changed: 8986 additions & 1117 deletions

Some content is hidden

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

.cursor/rules/react.mdc

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Cursor notta web 编码规范指南
2+
3+
你是以下技术栈的专家:
4+
- TypeScript
5+
- Node.js
6+
- React
7+
- Vite
8+
- Ant Design v5
9+
- React Router DOM v7
10+
11+
### 核心原则:
12+
13+
- 编写简洁、技术性的响应,并提供准确的 TypeScript 示例
14+
- 使用函数式、声明式编程,避免使用类
15+
- 优先使用迭代和模块化,而不是代码重复定义
16+
- 使用描述性变量名,包含助动词(如 isLoading)
17+
- 目录使用小写字母加横线(如 components/auth-wizard)
18+
- 组件优先使用命名导出
19+
- 使用接收对象返回对象(RORO)模式
20+
21+
### JavaScript/TypeScript 规范:
22+
23+
- 纯函数使用 "function" 关键字。省略分号
24+
- 所有代码都使用 TypeScript。优先使用接口(interface)而不是类型(type)
25+
- 文件结构:导出组件、子组件、辅助函数、静态内容、类型定义
26+
- 条件语句中避免不必要的大括号
27+
- 单行条件语句省略大括号
28+
- 简单条件语句使用简洁的单行语法(如 if (condition) doSomething())
29+
- 工具函数若 lodash-es 有提供则尽量复用,避免重复定义
30+
- 禁止三元表达式嵌套,使用阅读性更好的条件语句
31+
- if-else 过多时优化为 map 设计
32+
33+
### 错误处理优先级:
34+
- 在函数开始处处理错误和边界情况
35+
- 对错误条件使用提前返回,避免深层嵌套的 if 语句
36+
- 将正常执行路径放在函数末尾以提高可读性
37+
- 避免不必要的 else 语句;使用 if-return 模式
38+
- 使用守卫子句尽早处理前置条件和无效状态
39+
- 实现适当的错误日志记录和用户友好的错误消息
40+
- 考虑使用自定义错误类型或错误工厂以保持错误处理的一致性
41+
42+
### 依赖项:
43+
- React v19
44+
- Ant Design v5
45+
- vite
46+
- React Router DOM v7
47+
48+
### React/Next.js 规范:
49+
50+
- 使用函数组件和 TypeScript 接口
51+
- 使用声明式 TSX
52+
- 组件使用 const 声明
53+
- 使用 Ant Design v5 进行组件开发和样式设计
54+
- 采用PC端优先的响应式设计方法
55+
- 静态内容和接口放在文件末尾
56+
- 静态内容变量放在渲染函数外
57+
- 最小化 'useEffect' 和 'setState' 的使用。
58+
- 非关键组件使用动态加载
59+
- 图片优化:WebP 格式、尺寸数据、懒加载
60+
61+
### 关键约定:
62+
63+
1. 依赖 React Router DOM 进行状态变更
64+
2. 优先考虑 Web Vitals(LCP、CLS、FID)

bun.lock

Lines changed: 99 additions & 118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@
1212
},
1313
"dependencies": {
1414
"@ant-design/v5-patch-for-react-19": "^1.0.3",
15-
"@flowgram.ai/free-container-plugin": "^0.4.4",
16-
"@flowgram.ai/free-group-plugin": "^0.4.4",
17-
"@flowgram.ai/free-layout-editor": "^0.4.4",
18-
"@flowgram.ai/free-lines-plugin": "^0.4.4",
19-
"@flowgram.ai/free-node-panel-plugin": "^0.4.4",
20-
"@flowgram.ai/free-snap-plugin": "^0.4.4",
21-
"@flowgram.ai/minimap-plugin": "^0.4.4",
22-
"@tanstack/react-query": "^5.85.5",
15+
"@flowgram.ai/free-container-plugin": "^0.4.8",
16+
"@flowgram.ai/free-group-plugin": "^0.4.8",
17+
"@flowgram.ai/free-layout-editor": "^0.4.8",
18+
"@flowgram.ai/free-lines-plugin": "^0.4.8",
19+
"@flowgram.ai/free-node-panel-plugin": "^0.4.8",
20+
"@flowgram.ai/free-snap-plugin": "^0.4.8",
21+
"@flowgram.ai/minimap-plugin": "^0.4.8",
22+
"@monaco-editor/react": "^4.7.0",
23+
"@tanstack/react-query": "^5.85.9",
2324
"@zxcvbn-ts/core": "^3.0.4",
24-
"ahooks": "^3.9.4",
25-
"antd": "^5.27.1",
25+
"ahooks": "^3.9.5",
26+
"antd": "^5.27.2",
2627
"axios": "^1.11.0",
2728
"clsx": "^2.1.1",
2829
"crypto-js": "^4.2.0",
29-
"dayjs": "^1.11.13",
30+
"dayjs": "^1.11.18",
3031
"echarts": "^6.0.0",
3132
"i18next": "^25.4.2",
3233
"jsencrypt": "^3.5.4",
@@ -36,7 +37,7 @@
3637
"react-draggable": "^4.5.0",
3738
"react-error-boundary": "^6.0.0",
3839
"react-hotkeys-hook": "^5.1.0",
39-
"react-i18next": "^15.7.2",
40+
"react-i18next": "^15.7.3",
4041
"react-is": "^19.1.1",
4142
"react-router": "^7.8.2",
4243
"screenfull": "^6.0.2",
@@ -50,20 +51,20 @@
5051
"@types/crypto-js": "^4.2.2",
5152
"@types/lodash-es": "^4.17.12",
5253
"@types/node": "^22.18.0",
53-
"@types/react": "^19.1.11",
54-
"@types/react-dom": "^19.1.8",
54+
"@types/react": "^19.1.12",
55+
"@types/react-dom": "^19.1.9",
5556
"@types/react-is": "^19.0.0",
5657
"@types/react-resizable": "^3.0.8",
57-
"@vitejs/plugin-react": "^5.0.1",
58-
"babel-plugin-react-compiler": "^19.1.0-rc.2",
58+
"@vitejs/plugin-react": "^5.0.2",
59+
"babel-plugin-react-compiler": "^19.1.0-rc.3",
5960
"globals": "^16.3.0",
6061
"sass-embedded": "^1.91.0",
6162
"tailwindcss": "^4.1.12",
6263
"terser": "^5.43.1",
6364
"typescript": "~5.9.2",
6465
"vite": "npm:rolldown-vite@latest",
6566
"vite-plugin-compression": "^0.5.1",
66-
"vite-plugin-mock-dev-server": "^1.9.3"
67+
"vite-plugin-mock-dev-server": "^2.0.0"
6768
},
6869
"engines": {
6970
"node": ">=22.12.0"

src/GlobalConfigProvider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const GlobalConfigProvider: React.FC = () => {
2424
return (
2525
<ConfigProvider
2626
theme={{
27+
cssVar: true,
2728
token: {
2829
colorPrimary: colorPrimary,
2930
},

0 commit comments

Comments
 (0)