refactor: organize features and standardize frontend tooling

Colocate feature views, components, stores, and upload logic; centralize shared map utilities without changing API behavior.

Add ESLint, Prettier, EditorConfig, and VS Code settings; standardize four-space indentation and document the project structure and checks.

Validation: npm run check, npm run build, and git diff --check.
This commit is contained in:
2026-09-29 18:05:56 +08:00
parent c3e49bd9b4
commit ea47eec47c
104 changed files with 14116 additions and 10576 deletions
+24 -1
View File
@@ -19,6 +19,29 @@ npm run dev
## 检查与构建
```bash
npx vue-tsc -b
npm run check
npm run build
```
`check` 依次执行 ESLint、Prettier 格式检查、项目样式检查和 TypeScript 类型检查。也可以单独运行:
```bash
npm run lint # 检查 JS、TS 和 Vue 代码,警告也会导致失败
npm run lint:fix # 自动修复可修复的代码问题
npm run format:check # 检查格式,不修改文件
npm run format # 格式化源码、配置和文档
npm run check:styles # 检查项目视觉规范
npm run typecheck # Vue / TypeScript 类型检查
```
ESLint 使用 flat config,启用 JavaScript、TypeScript 和 Vue 推荐规则;Prettier 负责格式,使用 4 个空格缩进、单引号和无分号风格。通过 `eslint-config-prettier` 关闭冲突的格式规则,构建产物、依赖、环境文件和工具管理的目录不参与格式化。
VS Code 用户可安装工作区推荐的 Vue、ESLint、Prettier 扩展,保存时自动格式化并执行 ESLint 修复。
配置参考:[Vue ESLint 官方指南](https://eslint.vuejs.org/user-guide/)、[typescript-eslint 入门](https://typescript-eslint.io/getting-started/)、[Prettier 安装指南](https://prettier.io/docs/install)。
## 项目结构
业务代码按功能集中在 `src/features/`:页面、组件、store 和 composable 放入各自所属模块。跨业务的地图控件集中在 `src/shared/map/`,应用导航位于 `src/components/layout/`,API 客户端、全局样式和公共类型保留独立目录。
新增或移动文件时,参见[目录结构与依赖约定](docs/project-structure.md)。