Documentation

Formatting & Linting

Guide to using Biome for code quality

Dirstarter uses Biome for code formatting and linting to ensure consistent code quality across the project.

Biome is configured in the project root with biome.json. This configuration enforces consistent code style and catches common errors.

Key Features

  • Zero-config: Works out of the box with sensible defaults
  • Fast: Written in Rust for maximum performance
  • All-in-one: Combines linting, formatting, and more in a single tool

Running Linting & Formatting

Check Code Quality

To check your code without making changes:

npm run lint

This command will report any linting errors or warnings in your codebase.

Format Code

To automatically format your code:

npm run format

This will format all supported files according to the project's style rules.

Editor Integration

Biome works best when integrated with your editor:

Customizing Rules

The project's Biome configuration is defined in biome.json. If you need to modify the rules follow the Biome documentation.

biome.json
{
  "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space"
  }
}

TypeScript Integration

Biome works alongside TypeScript to provide comprehensive code quality checks:

  • TypeScript handles type checking
  • Biome handles style and common errors
  • Together they provide a robust development experience

Next Steps

Now that you understand how code quality is maintained, learn about updating the codebase to stay current with the latest improvements.

Edit on GitHub

Last updated on

On this page