Documentation

Formatting & Linting

Guide to using OXC (oxlint + oxfmt) for code quality

Dirstarter uses OXC for code formatting and linting to ensure consistent code quality across the project. OXC is a collection of high-performance JavaScript/TypeScript tools written in Rust, including oxlint for linting and oxfmt for formatting.

Key Features

  • Blazingly Fast: Written in Rust, 50-100x faster than ESLint
  • Zero Config: Works out of the box with sensible defaults
  • Two Tools: oxlint for linting, oxfmt for formatting

Running Linting & Formatting

Check Code Quality

To check and fix linting issues in your code:

npm run lint

This command will report and auto-fix any linting errors or warnings in your codebase using oxlint.

Format Code

To automatically format your code:

npm run format

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

Editor Integration

OXC works best when integrated with your editor. See the Editor Setup guide for installation links for VSCode, Cursor, Zed, JetBrains, and Neovim.

Customizing Rules

Formatting Configuration

The project's formatting configuration is defined in .oxfmtrc.json:

.oxfmtrc.json
{
  "$schema": "./node_modules/oxfmt/configuration_schema.json",
  "printWidth": 100,
  "tabWidth": 2,
  "useTabs": false,
  "semi": false,
  "singleQuote": false,
  "trailingComma": "all",
  "bracketSpacing": true,
  "arrowParens": "avoid"
}

Linting Configuration

Oxlint uses sensible defaults and can be configured via command-line flags or a configuration file. For more details, see the oxlint documentation.

TypeScript Integration

OXC works alongside TypeScript to provide comprehensive code quality checks:

  • TypeScript handles type checking
  • oxlint handles common errors and best practices
  • oxfmt handles code formatting
  • 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.

Last updated on

On this page

Join hundreds of directory builders

Build your directory, launch, earn

Don't waste time on Stripe subscriptions or designing a pricing section. Get started today with our battle-tested stack and built-in monetization features.

Get Lifetime Access