Code standards
The project uses Oxlint for JavaScript, TypeScript, and Vue static analysis, Prettier for consistent formatting, Stylelint for styles, and vue-tsc for type checking.
Common commands
pnpm lint # Run Oxlint across the repository
pnpm lint:fix # Apply Oxlint fixes
pnpm lint:style # Apply Stylelint fixes
pnpm format:check # Check workspace formatting
pnpm style:check # Check workspace styles
pnpm typecheck # Type-check Admin and shared packagesPackage-level tests:
pnpm --filter @vea/hooks test
pnpm --filter @vea/request testThese test suites use esno + node:assert. There is currently no Vitest or Jest test runner.
Oxlint
Rules are defined in the root .oxlintrc.json. The TypeScript and Vue plugins are enabled, and correctness issues are reported as errors.
Oxlint replaces ESLint. Do not add ESLint configuration or dependencies again. When a rule genuinely needs to be disabled locally, use an Oxlint-supported suppression comment and explain why.
Formatting
The main conventions in .prettierrc.json are:
- Two-space indentation.
- Single quotes.
- No semicolons.
- 100-character line width.
- Indentation inside Vue script and style blocks.
Do not format code manually against these settings; pre-commit lint-staged will format staged files again.
Styles
Stylelint covers Vue, CSS, Less, SCSS, and HTML files, checking style syntax and common problems.
Theme colors should use CSS variables from @vea/styles. Keep component-specific styles scoped, and move only genuinely cross-app foundational rules into packages.
Git Hooks
Husky registers hooks after dependency installation. Before a commit, it runs:
pnpm typecheck:admin
pnpm lint:lint-stagedlint-staged runs Oxlint, Prettier, and Stylelint for the corresponding staged files. Fix type-checking errors instead of carrying them into the branch with --no-verify.
Commitlint validates commit messages against Conventional Commits:
feat: add user management
fix: resolve dynamic route refresh
docs: update deployment guide
refactor: simplify request clientCommon allowed types currently include feat, fix, docs, style, refactor, perf, test, ci, chore, revert, and wip.
TypeScript naming
- Use PascalCase for Admin component directories, such as
LocaleDropdown/. Keepindex.vueas the directory entry and colocate relatedtypes.ts,helper.ts, and internal components. packages/componentsfollows the same component-directory convention, while its package-levelsrc/index.tsremains the single public entry. Do not add forwarding-onlyindex.tsfiles inside component directories.- Prefix Hooks with
useXxx, such asuseCrud. - Name API functions with a verb, domain, and
Api, such asgetRouteListApi. - Use PascalCase for types without an
Iprefix, such asLoginParamsandApiResponse. - Prefix booleans with readable words such as
is,has,can, orshould. - Use UPPER_SNAKE_CASE for constants only when the value is genuinely global and constant.
Keep types close to their domain modules. The Request layer should contain protocol types only, not the business models for every page.
Imports and directories
- Inside an application, use
@/to refer toapps/admin/src. - Import shared capabilities through
@vea/*package names instead of reaching across directories into package source files. - Keep API functions and types for the same domain in adjacent directories.
- Hooks are flattened under
src/hooks; do not add aweb/directory with only one level of content. - Do not extract utils before they have real reuse value.
Script caveat
npm:checkupdates dependency versions directly; it is not a read-only check.
CI must not invoke npm:check. Use pnpm lint:format when the entire workspace needs consistent formatting.