Skip to content
d3 Wiki
04.01

TypeScript / JavaScript style

Code that any teammate (or Claude Code) can read and extend without asking.

Updated
Oct 3, 2026
On this page

Purpose

Code that any teammate (or Claude Code) can read and extend without asking.

The standard

  • TypeScript everywhere; strict: true; no any without a // why: comment.

  • Formatting by Prettier, linting by ESLint (next/core-web-vitals + typescript-eslint). No style debates in review.

  • Named exports; default export only for Next.js pages/layouts.

  • Functions small and pure where possible; side effects in server actions or route handlers.

  • Data fetching in server components; mutations in server actions; validate every input with zod at the boundary.

  • Prefer async/await; never swallow a rejected promise.

  • Types generated from Supabase (supabase gen types typescript) and committed as src/types/database.types.ts.

  • Imports: absolute via @/; ordered external → internal → relative (lint-enforced).

Examples

// good
export async function getPanelsByProject(projectId: string): Promise<Panel[]> { … }
// avoid
export default async function getData(id: any) { … }

Owner: Matt · Last reviewed: 2026-09