chore(frontend): engineering baseline per guide ch.8

- toolchain: vitest+jsdom (15 tests green: permission pure functions
  exhaustive, storage migration), prettier (printWidth 120 to fit the
  dense existing style + 700-line page budget), commitlint conventional
- npm scripts: typecheck / format / test / lint:fix; build fingerprint
  __APP_VERSION__ (version+git hash+build time) shown in Settings > about
- git hooks via core.hooksPath=frontend/.husky: pre-commit lint-staged
  (prettier + eslint --fix best-effort), commit-msg commitlint
- permission pure functions extracted to lib/permissions.ts (single
  source consumed by useAuth/useLogin); AuditLogsPage filters on URL
- backend: resp package unit tests; health version constant aligned
  with frontend package.json
This commit is contained in:
Logan.Li committed 2026-10-26 17:58:59 +08:00
1 parent ac498c7ba2
commit d867c276d4
8 files changed
+1761 -23

No files matched your search

+11 -4
View File
@@ -13,7 +13,8 @@
"format:check": "prettier --check \"src/**/*.{ts,tsx,css}\"",
"test": "vitest run",
"audit:pages": "node scripts/audit-page-size.mjs 700",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "git config core.hooksPath frontend/.husky"
},
"dependencies": {
"@codemirror/autocomplete": "^6.20.2",
@@ -39,6 +40,8 @@
"tailwind-merge": "^3.4.0"
},
"devDependencies": {
"@commitlint/cli": "^21.2.4",
"@commitlint/config-conventional": "^21.2.4",
"@eslint/js": "^9.39.1",
"@types/node": "^24.10.1",
"@types/react": "^19.2.5",
@@ -49,17 +52,21 @@
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
"jsdom": "^30.1.3",
"lint-staged": "^17.6.0",
"postcss": "^8.5.6",
"prettier": "^3.9.10",
"tailwindcss": "^3.4.19",
"tailwindcss-animate": "^1.0.7",
"typescript": "~5.9.3",
"typescript-eslint": "^8.46.4",
"vite": "^7.2.4"
"vite": "^7.2.4",
"vitest": "^5.0.5"
},
"lint-staged": {
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
"prettier --write",
"bash -c 'eslint --fix \"$@\" || true' --"
],
"*.css": [
"prettier --write"