Skip to content

Enforce block statements with Biome's useBlockStatements #666

Closed

Description

@goosewobbler

Problem

Control-flow bodies are written both ways across the codebase:

if (error instanceof ReleaseKitError) return true;
if (error instanceof ReleaseKitError) {
  return true;
}

The block form should be the only one. Nothing enforces it today: biome.jsonc turns style/useBlockStatements off explicitly, and eslint.config.js has no curly rule.

Size

With the rule set to error, Biome 2.5.6 reports 703 violations in 134 files:

Area Count
packages/release/src 213
packages/version/test 89
packages/notes/src 88
packages/version/src 78
scripts/ 51
packages/publish/src 43
packages/core/src 32
packages/git/src 25
packages/notes/test 23
packages/forge/src 18
packages/release/test 15
packages/config/src 14
packages/publish/test 8
everything else 6

Every one is auto-fixable. Biome marks the fix unsafe by default, so it needs --unsafe:

biome lint --write --unsafe --only=style/useBlockStatements .

Proposal

  1. Enable the rule and mark its fix safe, so the pre-commit biome check --write (lint-staged) adds the braces automatically instead of only reporting them:

    "style": {
      "useBlockStatements": { "level": "error", "fix": "safe" }
    }

    Checked: with this config, biome check --write without --unsafe rewrites if (x) return true; into the block form.

  2. Apply the fix across the repo in one mechanical commit, and add that commit to .git-blame-ignore-revs (the file doesn't exist yet) so git blame skips it.

  3. Run pnpm lint, pnpm typecheck and pnpm test on the result. The fix only adds braces, but scripts/ and test files are in scope too.

Sequencing

The sweep touches most source files, so it will conflict with any open PR that edits them (currently #616, #617, #618 and #619). Either land it once those merge, or land it first and have each open branch run the same fix command before merging main: both sides then carry identical braces, so only real changes conflict.

Activity

  1. added 2 commits that reference this issue on Oct 22, 2026
    87bc321
    3fbee0d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions