anomalyco / anomalyco/opencode

multiple formatters (prettier + biome) run in sequence and fight over the file

Open
#45,909 0 comments 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Aug 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Describe the bug

getFormatter (packages/opencode/src/format/formatter.ts) returns every enabled formatter whose extension matches, and formatFile runs them all in sequence. When both Prettier and Biome are enabled for the same extension (a very common project setup), the file is rewritten twice and the two formatters fight over style, producing flip-flop diffs on every edit. The final on-disk content depends on formatter registration order, so it can disagree with what the model just wrote (and edit re-reads the overwritten content).

The code is aware of this hazard — uvformat explicitly returns false when ruff is enabled — but there's no mutual exclusion between prettier/biome/oxfmt or rubocop/standardrb.

Suggested fix

Pick a single winning formatter per file (configurable precedence) instead of running all matches, or skip a formatter when a competing one already handled the file.

Environment
  • opencode version: latest dev

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.