# biome complexity/noUselessLoneBlockStatements: fix changes program behavior

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: biome 2.5.15
- Rule: complexity/noUselessLoneBlockStatements (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): real, severity high. The fix removes a standalone block `{}` inside a try block that contains a `let x = 1` declaration. According to the documentation, a block is not redundant when a block-level binding like `let` is present in the enclosing scope, because the block creates a new scope for that binding. Removing the block changes the scope structure, which can alter runtime behavior (here, the `forEach` callback no longer executes, as shown by the missing stdout output). The rule incorrectly treats this block as useless and its removal as safe, but it is not semantically equivalent.
- Program: minimized from 13 to 6 lines

## Reproducer

```js
try {
  let x = 1
{}
[1,2,3].forEach(v => console.log(v))
} catch(e) {
}
```

## Commands

```sh
node prog.js
bunx @biomejs/biome lint --only=complexity/noUselessLoneBlockStatements --write prog.js
node prog.js
```

## Observed

```
stdout before:
1
2
3
stdout after:
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 13:25:45.273300884 -0400
+++ fixed.js	2026-10-22 13:25:47.321334748 -0400
@@ -1,6 +1,5 @@
 try {
   let x = 1
-{}
 [1,2,3].forEach(v => console.log(v))
 } catch(e) {
 }
```

## Why the rewrite is not equivalent (model draft, verify before use)

The removed empty block `{}` was part of the `try` statement’s body; deleting it changes which statements belong to the `try`. After removal, `[1,2,3].forEach(...)` executes outside any `try`, so if its callback threw (it does not here), it would not be caught. More importantly, JavaScript’s automatic semicolon insertion treats the line break before `[1,2,3]` as ending the `let x = 1` statement, making the array literal a standalone expression statement whose value is discarded—so nothing is printed. Originally, the empty block prevented ASI from interfering, allowing the `forEach` call to remain inside the `try` and execute normally. Thus the fix alters control flow and output.

## Upstream search

Queries: "noUselessLoneBlockStatements fix", "complexity noUselessLoneBlockStatement empty block", "biome lint rule remove useless lone blocks", "fix behavior removes standalone braces in try"

- related: https://github.com/biomejs/biome/issues/11935
  same rule but different construct (block-scoped functions in strict scripts/class bodies vs lone block in try body)
- related: https://github.com/biomejs/biome/issues/834
  same rule (noUselessLoneBlockStatements) but different construct (switch statement interaction with useSingleCaseStatement)
- related: https://github.com/biomejs/biome/issues/8685
  same rule (noUselessLoneBlockStatements) but different construct (empty block with comments)
- related: https://github.com/biomejs/biome/issues/39
  same rule family (noUselessLoneBlockStatements/noEmptyBlockStatements) but different construct (empty block statements generally)

<details><summary>All hits</summary>

- [github, open] 💅 `noUselessLoneBlockStatements` unwraps block-scoped functions in strict scripts and class bodies — https://github.com/biomejs/biome/issues/11935
- [github, open] 💅 noDuplicateTestHooks: false positive on a local function named `before` called twice in a test — https://github.com/biomejs/biome/issues/12231
- [github, open] 💅 `useSortedProperties` can produce invalid CSS when the final semicolon is omitted — https://github.com/biomejs/biome/issues/12417
- [github, open] 💅 `useSortedProperties` moves Sass variable declarations below their uses — https://github.com/biomejs/biome/issues/12414
- [github, open] 💅 `useSortedProperties` can change behavior when reordering nested CSS rules — https://github.com/biomejs/biome/issues/12413
- [github, open] 💅 `noUnnecessaryConditions`: false positive on an overloaded call with `undefined` as the default argument (Vue `inject`) — https://github.com/biomejs/biome/issues/12040
- [github, open] 💅 `noSkippedTests` conditionally skip fix suggestion — https://github.com/biomejs/biome/issues/9295
- [github, open] 💅 Actually used private method considered unused — https://github.com/biomejs/biome/issues/8185
- [github, open] 💅 cannot detect that the StrictMode component of React is being exported. — https://github.com/biomejs/biome/issues/10609
- [github, open] 💅 noUnnecessaryConditions callback overload false positive — https://github.com/biomejs/biome/issues/11439
- [tavily] 💅 noUselessLoneBlockStatements collides with useSingleCaseStatement when using switch · Issue #834 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/834
- [tavily] 📝 Biome format removes empty block with comments · Issue #8685 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8685
- [tavily] 💅 `useSimplifiedLogicExpression` "safe" fix breaks code · Issue #11351 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/11351
- [github, open] 💅 `useSortedClasses` cannot sort TailwindCSS classname corretly — https://github.com/biomejs/biome/issues/6498
- [github, closed] 🐛 Astro: Parse error for empty or comment-only template expression starting from `2.4.0` — https://github.com/biomejs/biome/issues/9165
- [github, closed] 💅 Linter: `lint --write` is not idempotent on Astro frontmatter, while `lint` reports no issues — https://github.com/biomejs/biome/issues/7912
- [github, closed] 💅 Assertion Failed in Text Range Calculation — https://github.com/biomejs/biome/issues/7932
- [tavily] 💅 The --only option is ignored when using the --unsafe option · Issue #3663 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/3663
- [tavily] 📎 Implement `lint/noEmptyBlockStatements` - `eslint/no-empty` `eslint/no-empty-static-block` · Issue #39 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/39
- [tavily] 💅 `lint/complexity/noUselessEmptyExport` should not trigger warnings on `.d.ts` files with exported + unexported symbols · Issue #8603 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8603
- [tavily] docs(lint): update documentation, rule sources for `lint/complexity/noBannedTypes` by Bertie690 · Pull Request #8632 · biomejs/biome · GitHub — https://github.com/biomejs/biome/pull/8632
- [tavily] One does not simply enable just one lint rule · Issue #1768 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/1768

</details>
