Skip to content

Code Style

All TypeScript projects in Logbook use Biome for linting and formatting.

Formatting Rules

RuleSetting
IndentationTabs
QuotesDouble quotes
SemicolonsRequired
Trailing commasES5

Running Biome

To check and fix formatting:

bash
pnpm check:fix

To check only (no auto-fix):

bash
pnpm check

Editor Integration

VS Code

Install the Biome extension and add to your settings:

json
{
  "editor.defaultFormatter": "biomejs.biome",
  "editor.formatOnSave": true
}

Other Editors

See the Biome documentation for setup instructions.

TypeScript Configuration

All projects use strict TypeScript with decorators enabled:

json
{
  "compilerOptions": {
    "strict": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Naming Conventions

Files

  • Components: PascalCase.tsx (e.g., UserProfile.tsx)
  • Utilities: camelCase.ts (e.g., formatDate.ts)
  • Tests: *.test.ts or *.spec.ts
  • Types: camelCase.types.ts or inline

Code

  • Classes: PascalCase
  • Interfaces/Types: PascalCase
  • Functions/Variables: camelCase
  • Constants: SCREAMING_SNAKE_CASE
  • Enums: PascalCase with PascalCase members

Example

typescript
import { Controller, Get, Route, Tags } from "tsoa"

const MAX_RESULTS = 100

interface UserResponse {
	id: string
	name: string
}

@Route("users")
@Tags("Users")
export class UserController extends Controller {
	@Get("/")
	public async getUsers(): Promise<UserResponse[]> {
		// Implementation
	}
}

Built with VitePress