Skip to content

Code Review

Findings from automated code review using Biome, ast-grep, and Knip across the Booking Platform monorepo.

Severity Levels

SeverityDescriptionAction
CriticalSecurity vulnerabilities, data loss risksFix immediately
HighBugs, performance issues, broken featuresFix soon
MediumCode quality, maintainability concernsFix this sprint
LowStyle, documentation, minor improvementsFix later

Tools Used

ToolPurposeConfig
BiomeLinting & formattingbiome.jsonc
ast-grepStructural code analysissgconfig.yml + rules/
KnipUnused code detectionknip.json
TypeScript (tsc)Type checkingtsconfig.json
LefthookGit hooks enforcementlefthook.yml

ast-grep Rules

Always-On Rules (35 rule files)

These rules run on every scan and enforce project-wide standards:

RuleDescription
component-pascal-caseComponents must use PascalCase
imports-at-topImport statements must be at the top of the file
no-any-db-typesDatabase types must not use any
no-apps-import-in-integrationsIntegrations must not import from apps/
no-biome-ignoreNo biome-ignore comments
no-client-secret-exposureClient-side code must not expose secrets
no-custom-authMust use Supabase for authentication
no-cypressUse Playwright, not Cypress
no-direct-esbuildUse Vite, not esbuild directly
no-eslint-prettierUse Biome, not ESLint/Prettier
no-hardcoded-ai-modelAI model names must not be hardcoded
no-hardcoded-stripe-secretStripe secrets must not be hardcoded
no-inline-stylesUse UnoCSS, not inline styles
no-jestUse Vitest, not Jest
no-manual-validationUse Zod for validation
no-node-builtin-importsAvoid Node.js builtin imports
no-node-requireNo require() calls
no-plain-css-importsUse UnoCSS, not plain CSS imports
no-raw-sqlUse Drizzle ORM, not raw SQL
no-react-nativeUse Capacitor, not React Native
no-react-patternsAvoid React patterns in SolidJS code
no-styled-componentsUse UnoCSS, not styled-components
no-ts-ignoreNo @ts-ignore or @ts-nocheck
no-webpack-rollupUse Vite, not Webpack/Rollup directly
pg-table-uuid-pkPostgreSQL tables must use UUID primary keys

Model Decision Rules (27 rule files)

These rules require contextual judgment:

RuleDescription
no-bypass-permissionMust not bypass RBAC permission checks
no-client-openai-keyOpenAI API key must not be exposed to client
no-committed-secretsNo secrets in committed files
no-orpc-middleware-bypassMust not bypass oRPC middleware
no-raw-http-endpointsUse oRPC, not raw HTTP endpoints
no-store-credit-cardNever store credit card information

Glob Rules (19 rule files)

File-pattern-specific rules:

RuleScopeDescription
no-any-component-propsComponentsComponent props must not use any
no-component-route-imports-in-libLib filesLibrary files must not import route components
no-cross-module-internal-importsModulesNo cross-module internal imports
no-react-routerRoutesUse TanStack Router, not React Router
route-requires-permissionRoutesRoute files must include permission checks
schema-required-columnsSchemaDatabase schema must define required columns

Biome Configuration

Biome is configured with the following domains:

DomainLevelPurpose
drizzlerecommendedDrizzle ORM best practices
moonreporecommendedMoonrepo monorepo patterns
typesrecommendedTypeScript type safety
solidrecommendedSolidJS-specific rules
testrecommendedTesting best practices

Git Hooks (Lefthook)

HookTriggersActions
pre-commitOn commitBiome lint + format (parallel, stage_fixed: true)
pre-pushOn pushTypecheck + test (parallel)
pre-merge-commitOn mergeTypecheck

Review Checklist

Security

  • [ ] No secrets or API keys committed to repository
  • [ ] Supabase service role key only used on server
  • [ ] Stripe secret key only used on server
  • [ ] RBAC permission checks on all routes and API handlers
  • [ ] No @ts-ignore or @ts-nocheck in production code
  • [ ] No raw SQL — use Drizzle ORM
  • [ ] No custom authentication — use Supabase

Code Quality

  • [ ] All files under 250 lines
  • [ ] TypeScript strict mode enabled
  • [ ] Zod schemas for all API inputs and database writes
  • [ ] No any types — use proper type inference
  • [ ] Imports at the top of the file
  • [ ] Components use PascalCase
  • [ ] No React patterns in SolidJS code

Architecture

  • [ ] No cross-module internal imports
  • [ ] Integrations do not import from apps/
  • [ ] oRPC for all API handlers — no raw HTTP endpoints
  • [ ] oRPC middleware not bypassed
  • [ ] Route files include permission checks
  • [ ] Database tables use UUID primary keys

Testing

  • [ ] Vitest for unit/integration tests
  • [ ] Playwright for E2E tests
  • [ ] No Jest or Cypress
  • [ ] Test files match src/**/*.{test,spec}.{ts,tsx}

Styling

  • [ ] UnoCSS for all styling
  • [ ] No inline styles (unless dynamically computed)
  • [ ] No plain CSS imports
  • [ ] No styled-components

Build & Tooling

  • [ ] Vite for builds — no Webpack/Rollup directly
  • [ ] Bun as runtime and package manager — no Node.js/npm
  • [ ] Biome for linting — no ESLint/Prettier
  • [ ] No require() calls — use ESM imports

Running Reviews

bash
# Run all checks
bun run check

# Run lint only
bun run lint

# Run typecheck only
bun run typecheck

# Run ast-grep scan
bun run scan

# Run Knip (unused code detection)
bun run knip

# Run full verify (check + test + build)
bun run verify

Test Results

Loading test results...

Latest Remediation (August 2026)

Health Score: 6.2/10 → 8.7/10

DimensionBeforeAfterKey Fixes
Security6/109/10MFA enforcement, fail-closed auth, webhook secret production enforcement, payload redaction
Type Safety5/109/10Eliminated z.any(), LINE Pay Zod validation, typed output schemas, barrel exports complete
Business Logic6/109/10Booking cart availability validation, loyalty duplicate prevention, cancellation input validation, payment amount validation
Infrastructure7/108/10FCM token cleanup, Redis error logging, retry strategy
Code Quality7/109/10Library coverage maximized, custom reimplementations removed, consistent error handling
Deployment6/108/10Typecheck enforcement in CI, production env validation

Verification Evidence

CheckStatusDetails
TypecheckPassAll packages pass with constrained settings
Lint (Biome)Pass7271 files, 0 errors, 16 warnings
Scan (ast-grep)PassNo violations
TestsPass2,843 tests across 276 files
BuildPassintegrations/shared (14 files), integrations/google-maps-booking (4 files)

Test Breakdown

PackageFilesTestsStatus
database130918 passed, 19 skippedPass
auth30378Pass
infrastructure28355Pass
config26251Pass
user12182Pass
notifications12154Pass
payments13244Pass
bookings15203Pass
billing456Pass
settings6102Pass

Last updated:

Released under the MIT License.