# biome complexity/useFlatMap: 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/useFlatMap (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): program-bug, severity low. The program fails both before and after the fix because `arguments` is an array-like object without `map` or `flatMap` methods. The rewrite does not change the error; the failure is unrelated to the rule's transformation.
- Program: minimized from 5 to 4 lines

## Reproducer

```js
function process(a, b = [], ...rest) {
  return arguments.map(x => [x]).flat();
}
const res = process(1, 2, 3);
```

## Commands

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

## Observed

```
stderr before: TypeError: arguments.map is not a function
stderr after: TypeError: arguments.flatMap is not a function
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 13:26:29.453032259 -0400
+++ fixed.js	2026-10-22 13:26:31.505066273 -0400
@@ -1,4 +1,4 @@
 function process(a, b = [], ...rest) {
-  return arguments.map(x => [x]).flat();
+  return arguments.flatMap(x => [x]);
 }
 const res = process(1, 2, 3);
```

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

The `arguments` object is array-like but lacks built-in methods like `.map` or `.flatMap`. Both versions attempt to call these methods directly on `arguments`, which fails because they are not defined on the arguments object. The error changes from `arguments.map is not a function` to `arguments.flatMap is not a function`, but the underlying issue remains: neither method exists on `arguments`. Thus, the rewrite does not fix the core problem and still throws a TypeError, preserving the failure mode rather than correcting it. The behavior differs only in which method name appears in the error, not in semantic correctness.

## Upstream search

Queries: "useFlatMap fix", "biome complexity/useFlatMap arguments map flat", "biome complexity/useFlatMap arguments flatMap replacement", "biome complexity/useFlatMap rest parameters usage"

- related: https://github.com/biomejs/biome/issues/1768
  same rule (useFlatMap) but different construct (array literal vs arguments object)
- related: https://github.com/biomejs/biome/issues/2817
  same rule (useFlatMap) mentioned but different construct (string functions vs array flatMap)
- related: https://github.com/biomejs/biome/issues/1744
  same rule (useFlatMap) but different construct (LSP diagnostics severity vs arguments object)
- related: https://github.com/biomejs/biome-vscode/issues/241
  same rule (useFlatMap) but different construct (format-on-save garbling vs arguments object)

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

- [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
- [github, open] 💅 lint/a11y/useAnchorContent: the PascalCase component allowance is applied only to self-closing elements — https://github.com/biomejs/biome/issues/11872
- [tavily] One does not simply enable just one lint rule · Issue #1768 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/1768
- [tavily] 📎 Implement `useConsistentStringFunctions` - unicorn `prefer-string-trim-start-end` `prefer-string-slice` · Issue #2817 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/2817
- [tavily] 💅 `useSortedClasses` unsafe fix does not apply to expressions in Astro template · Issue #9181 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/9181
- [tavily] 💅 Quick Fix for `useExhaustiveDependencies` has long list of suggestions · Issue #7813 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7813
- [tavily] 💅 lint/nursery/noUselessUndefined fix is unsafe for functions with union return types · Issue #6906 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/6906
- [tavily] 🐛 LSP: diagnostics do not respect severity · Issue #1744 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/1744
- [tavily] 💅 Biome not skipping excluded, generated, file in Monorepo configuration · Issue #7372 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7372
- [tavily] 💅 False positive `lint/nursery/noUnknownPseudoElement` with `::view-transition-new(<pt-name-selector>)` · Issue #5998 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/5998
- [tavily] Biome doesn't support formatting css inside of styled() css blocks · Issue #1770 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/1770
- [tavily] 🐛 Format on save lint fixes garble the file · Issue #241 · biomejs/biome-vscode · GitHub — https://github.com/biomejs/biome-vscode/issues/241

</details>
