Unifying Frontend Linting and Formatting with Biome: Replacing ESLint + Prettier in a Bun Setup

Hello, this is Lovefield.

When bootstrapping a new frontend project or maintaining a growing repository, one of the most surprisingly time-consuming chores is configuring ESLint and Prettier. Keeping dozens of plugins—like eslint-config-prettier, eslint-plugin-import, and @typescript-eslint/*—in sync while resolving rule conflicts between your linter and formatter quickly turns into maintenance overhead.

As the codebase expands, pre-commit checks via lint-staged and CI lint jobs also start taking tens of seconds per run, slowing down the entire feedback loop.

Biome—a Rust-based, all-in-one web toolchain—solves this cleanly. With Biome v2 introducing type-aware lint rules, nested monorepo configs, and built-in support for Vue, Svelte, and Astro files, adopting it in production has become much smoother. In this guide, we will walk through consolidating ESLint and Prettier into Biome within a Bun-powered workflow.

Why Switch from ESLint + Prettier to Biome?

The moment you migrate to Biome, two benefits stand out immediately: speed and simplicity.

  • One Binary, One Config File: Replace scattered files (eslint.config.mjs, .prettierrc, .prettierignore) with a single biome.json at the project root.

  • Blazing-Fast Execution: Written in Rust and designed for parallel execution, Biome handles formatting, linting, and import sorting across thousands of files in a fraction of a second.

  • Leaner Dependencies: Swapping out dozens of ESLint and Prettier plugins for a single @biomejs/biome package slims down your devDependencies and speeds up bun install.

Installing Biome and Migrating Existing Configs with Bun

Install Biome as a dev dependency with --exact to guarantee every teammate and CI runner uses the exact same formatter version:

Shell

1

2

3

4

5

# Install Biome pinned to an exact version
bun add -D --exact @biomejs/biome

# Generate a starter biome.json
bunx biome init

Automating Migration from Prettier & ESLint

If you are migrating an existing repository, Biome provides built-in migration commands so you don't have to translate rules manually:

Shell

1

2

3

4

5

# Convert existing Prettier settings into biome.json
bunx biome migrate prettier --write

# Convert existing ESLint settings into biome.json
bunx biome migrate eslint --write

Once converted and verified, you can safely delete your legacy .prettierrc, eslint.config.*, and related packages from package.json.

Production-Ready biome.json (Biome v2)

In Biome v2, file exclusions use negated patterns (!, !!) inside files.includes, and code actions like import sorting live under the assist block. Here is a clean, practical baseline for modern frontend projects:

JSON

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

{
  "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json",
  "vcs": {
    "enabled": true,
    "clientKind": "git",
    "useIgnoreFile": true
  },
  "files": {
    "ignoreUnknown": true,
    "includes": [
      "**",
      "!!**/dist",
      "!!**/.nuxt",
      "!!**/.output",
      "!!**/node_modules"
    ]
  },
  "formatter": {
    "enabled": true,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 100
  },
  "assist": {
    "enabled": true,
    "actions": {
      "source": {
        "organizeImports": "on"
      }
    }
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "correctness": {
        "noUnusedImports": "error",
        "noUnusedVariables": "warn"
      },
      "style": {
        "useConst": "error"
      }
    }
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "single",
      "semicolons": "always",
      "trailingCommas": "all"
    }
  }
}

Wiring Up package.json Scripts

The biome check command runs formatting, linting, and import sorting in a single pass:

JSON

1

2

3

4

5

6

7

{
  "scripts": {
    "check": "biome check .",
    "check:fix": "biome check --write .",
    "ci:check": "biome ci ."
  }
}

  • Use bun run check:fix during local development to apply safe fixes automatically.

  • Use bun run ci:check in CI pipelines to fail builds cleanly without mutating files.

VS Code Integration & Fast Pre-commit Hooks with Lefthook

To keep code style consistent across a team, pair format-on-save in the editor with automated Git pre-commit checks.

Shared VS Code Settings (.vscode/settings.json)

After installing the official Biome extension in VS Code, commit a shared .vscode/settings.json to your repository:

JSON

1

2

3

4

5

6

7

8

{
  "editor.defaultFormatter": "biomejs.biome",
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "quickfix.biome": "explicit",
    "source.organizeImports.biome": "explicit"
  }
}

Zero-Friction Pre-commit Hooks with Lefthook

Instead of pairing Husky with lint-staged, Lefthook (written in Go) pairs naturally with Bun and Biome for near-instant pre-commit checks:

Shell

1

bun add -D lefthook

Create a lefthook.yml file at the repository root:

YAML

1

2

3

4

5

6

7

# lefthook.yml
pre-commit:
  commands:
    biome-check:
      glob: "*.{js,ts,cjs,mjs,jsx,tsx,json,jsonc,css,vue}"
      run: bunx biome check --write --no-errors-on-unmatched --files-ignore-unknown=true {staged_files}
      stage_fixed: true

Setting stage_fixed: true automatically re-stages any files Biome formats during the commit hook. Run bunx lefthook install once to activate the hook.

Practical Considerations for Vue / Nuxt Projects

In Biome v1, .vue Single File Components (SFCs) had only partial <script> support, which held back many Vue and Nuxt teams from migrating.

With Biome v2.3+, multi-language parsing, formatting, and linting across HTML templates, CSS, and TypeScript inside .vue files are supported out of the box. Still, keep two practical points in mind when rolling it out to a Nuxt codebase:

  1. Nuxt Auto-Imports and Unused Variable Rules: Run a full bun run check early in your migration to verify how template bindings and Nuxt auto-imported composables (useFetch, ref, etc.) interact with unused-variable diagnostics.

  2. Framework-Specific Template Rules: If your team strictly enforces specialized eslint-plugin-vue template conventions that Biome doesn't yet replicate, you can adopt a pragmatic hybrid approach—letting Biome handle all formatting and general TS/JSON/CSS linting while keeping a minimal, targeted ESLint rule set only where necessary.

Summary

Linters and formatters exist to eliminate bikeshedding in code reviews and catch subtle mistakes early—not to slow developers down with fragile plugin matrices.

If you have already modernized your package manager and runtime with Bun, pairing it with Biome and Lefthook is the natural next step to streamline your code quality pipeline into a single, fast, and maintainable setup.

This article was generated by AI.

Lovefield

Web Front-End developer

하고싶은게 많고, 나만의 서비스를 만들고 싶은 변태스러운 개발자입니다.

Optimizing Bun + Nuxt 4 Container Deployments with Docker BuildKit and Multi-stage Builds

A practical guide to slashing CI/CD build times and shrinking container image sizes when deploying Bun + Nuxt 4 apps to Ubuntu and AWS using Docker BuildKit cache mounts, Multi-stage Builds, and non-root security hardening.

Docker

v5.0