mcpField
P
prettier-compare

prettier-compare

github.com/biomejsTesting & quality26.0k73 installsUpdated today
Repository

About prettier-compare

prettier-compare is a Bun CLI skill for checking Biome formatting against Prettier before formatter changes are shipped. It supports snippets, files, and stdin, with an explicit rebuild requirement for the Biome WASM bundle.

Key features

  1. 01Compare Biome and Prettier output
  2. 02Inspect intermediate representation output
  3. 03Process snippets, files, or stdin
  4. 04Rebuild Biome WASM before comparison

Use cases

  1. 01Check formatter changes before shipping
  2. 02Compare formatting for a code snippet
  3. 03Review output from a file or editor selection

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/biomejs/biome --skill prettier-compare

After installing, type/prettier-comparein Claude Code to confirm it loaded.

Details

From the project README

Purpose

Use packages/prettier-compare/ to inspect any differences between Biome and Prettier formatting (including IR output) before shipping formatter changes.

Prerequisites

  1. Run every command from the repository root so relative paths resolve correctly.
  2. Use bun (the CLI is a Bun script) and ensure dependencies have been installed.
  3. Always pass --rebuild so the Biome WASM bundle matches your current Rust changes.

Code Standards

CRITICAL: No Emojis

Emojis are BANNED in all Prettier comparison code and output:

  • NO emojis in comparison scripts
  • NO emojis in test files
  • NO emojis in output or diagnostic messages

Keep all code professional and emoji-free.

Common workflows

Snippets passed as CLI args:

bun packages/prettier-compare/bin/prettier-compare.js --rebuild 'const x={a:1,b:2}'

Force a language (useful when the tool cannot infer it from a filename):

bun packages/prettier-compare/bin/prettier-compare.js --rebuild -l ts 'const x: number = 1'

Compare files on disk:

bun packages/prettier-compare/bin/prettier-compare.js --rebuild -f src/example.tsx

Read from stdin (great for piping editor selections):

echo 'const x = 1' | bun packages/prettier-compare/bin/prettier-compare.js --rebuild -l js

Tips

  • Use -l/--language when formatting code without an extension so both formatters pick the correct parser.
  • Use -f/--file for large samples or snapshot tests so you can iterate directly on project fixtures.
  • Reference packages/prettier-compare/README.md for deeper CLI details; mirror any updates here, keeping the hard requirement that commands include --rebuild.
  • Use single quotes for code snippets passed as CLI arguments to avoid shell interpretation issues.
  • "\n" does not get escaped into a newline when passed as a CLI argument. You should write a literal newline or use a file instead.
  • The tool is OK to run in read-only/planning modes even when running it with --rebuild since it only rebuilds the Biome WASM bundle and does not modify any source files.

Comments

Markdown supported