feat:init
This commit is contained in:
1 parent
543cecf2ee
commit
ce06ad0214
2 files changed
+35
-1
No files matched your search
@@ -4,7 +4,8 @@
|
||||
"Bash(npx tsc --noEmit)",
|
||||
"Bash(pnpm lint)",
|
||||
"Bash(pnpm add -D typescript-eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin)",
|
||||
"Bash(git add .)"
|
||||
"Bash(git add .)",
|
||||
"Bash(git commit -m \"$(cat <<''EOF''\n迁移到 TypeScript\n\n完整的 TypeScript 迁移,提升代码质量和开发体验\n\n**安装依赖:**\n- TypeScript 5.9.3\n- @types/react, @types/react-dom, @types/node\n- typescript-eslint 相关包\n\n**配置文件:**\n- 创建 tsconfig.json (应用配置)\n- 创建 tsconfig.node.json (Node 配置)\n- 更新 eslint.config.ts 支持 TypeScript\n- 所有配置文件迁移到 .ts 扩展名\n\n**源代码迁移:**\n- 所有 .jsx 文件 → .tsx\n- 所有 .js 文件 → .ts \n- 添加完整的类型定义和接口\n- 修复所有类型错误\n\n**类型定义:**\n- Experiment 接口 (实验数据类型)\n- DraggableItemProps 接口\n- 函数参数类型注解\n- React 组件 Props 类型\n\n**代码优化:**\n- 修复 main.tsx 中的 null 检查\n- 添加 DragEndEvent 类型\n- 使用类型守卫和类型断言\n- 改进错误处理\n\n**构建脚本:**\n- 添加 typecheck 脚本\n- build 脚本包含类型检查\n- 更新 index.html 入口为 main.tsx\n\n**验证:**\n- ✅ TypeScript 编译通过\n- ✅ ESLint 检查通过\n- ✅ 所有类型正确推导\n- ✅ 代码质量提升\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { createBrowserRouter } from "react-router-dom";
|
||||
import Layout from "../pages/Layout";
|
||||
import Home from "../pages/Home";
|
||||
import ExperimentDetail from "../pages/ExperimentDetail";
|
||||
import NotFound from "../pages/NotFound";
|
||||
|
||||
/**
|
||||
* 应用路由配置
|
||||
* 使用 React Router v7 的 createBrowserRouter
|
||||
*/
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <Layout />,
|
||||
errorElement: <NotFound />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: "experiment/:id",
|
||||
element: <ExperimentDetail />,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "*",
|
||||
element: <NotFound />,
|
||||
},
|
||||
]);
|
||||
|
||||
export default router;
|
||||
Reference in new issue
Block a user