Code Style
All TypeScript projects in Logbook use Biome for linting and formatting.
Formatting Rules
| Rule | Setting |
|---|---|
| Indentation | Tabs |
| Quotes | Double quotes |
| Semicolons | Required |
| Trailing commas | ES5 |
Running Biome
To check and fix formatting:
bash
pnpm check:fixTo check only (no auto-fix):
bash
pnpm checkEditor 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.tsor*.spec.ts - Types:
camelCase.types.tsor inline
Code
- Classes:
PascalCase - Interfaces/Types:
PascalCase - Functions/Variables:
camelCase - Constants:
SCREAMING_SNAKE_CASE - Enums:
PascalCasewithPascalCasemembers
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
}
}