# biome complexity/noUselessUndefined: 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/noUselessUndefined (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): real, severity high. The rule removes the default parameter `= undefined`, which changes the function's `length` property from 0 to 2 because trailing parameters without defaults are counted. The documentation claims specifying `undefined` is useless and makes no difference, but it actually affects the function's arity metadata, a semantic change the fix does not account for.
- Program: minimized from 2 to 2 lines

## Reproducer

```js
function f(a = undefined, b) {}
console.log(f.length); // should be 2 regardless of default
```

## Commands

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

## Observed

```
stdout before:
0
stdout after:
2
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 13:26:05.961643143 -0400
+++ fixed.js	2026-10-22 13:26:08.048677693 -0400
@@ -1,2 +1,2 @@
-function f(a = undefined, b) {}
+function f(a , b) {}
 console.log(f.length); // should be 2 regardless of default
```

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

The original function has two parameters; its length property counts formal parameters excluding those with defaults, so it returns 1 (only `b` counts). Removing the default makes both parameters without defaults, so length becomes 2. The change alters the function’s signature semantics, affecting a language‑defined property, thus the rewrite is not behavior‑preserving.

## Upstream search

Queries: "noUselessUndefined fix", "complexity noUselessUndefined function parameter", "rule complexity noUselessUndefined remove undefined default", "noUselessUndefined trailing comma removal"

- duplicate: https://github.com/biomejs/biome/issues/11934
  same rule removing `= undefined` default parameter and changing function `length`
- related: https://github.com/biomejs/biome/issues/12040
  same rule but different construct (overloaded call with undefined default)
- related: https://github.com/biomejs/biome/issues/11017
  same rule `noUselessUndefined` but different conflict (TypeScript TS7030)
- related: https://github.com/biomejs/biome/issues/6906
  same rule `noUselessUndefined` but different construct (union return types)
- related: https://github.com/biomejs/biome/issues/6611
  same rule `noUnnecessaryConditions` mentioned but different construct (overloaded calls)
- related: https://github.com/biomejs/biome/issues/6577
  same rule `noUselessUndefined` but different construct (false positive report)
- related: https://github.com/biomejs/biome/issues/6578
  same rule `noUselessUndefined` but different construct (parameter flagging)
- related: https://github.com/biomejs/biome/issues/3942
  same rule `noUselessUndefined` implementation tracking issue

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

- [github, open] 💅 `noUselessUndefined` safe fix removes `= undefined` parameter defaults, changing `arguments` and `length` — https://github.com/biomejs/biome/issues/11934
- [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, closed] 💅 `noUselessReturn` safe fix removes a final `return;` that TypeScript's `noImplicitReturns` needs (TS7030) — https://github.com/biomejs/biome/issues/11903
- [github, open] 💅 `lint/correctness/noUnusedImports` does not consider uses inside comments that precede non-declaration statements (start/end of file, etc.) — https://github.com/biomejs/biome/issues/8762
- [github, closed] 💅 `noUselessUndefined` conflicts with `ts(7030)` — https://github.com/biomejs/biome/issues/11017
- [github, closed] 💅 lint/nursery/noUselessUndefined fix is unsafe for functions with union return types — https://github.com/biomejs/biome/issues/6906
- [github, closed] 💅 `useSimplifiedLogicExpression` "safe" fix breaks code — https://github.com/biomejs/biome/issues/11351
- [github, closed] 💅 `useExplicitLengthCheck` false positive and broken fix — https://github.com/biomejs/biome/issues/11558
- [github, closed] 💅 `useExplicitLengthCheck` false positive — https://github.com/biomejs/biome/issues/11352
- [github, closed] 💅 Corrupted CLI safe fix for `useConsistentArrowReturn` — https://github.com/biomejs/biome/issues/8347
- [tavily] 🐛 `biome.json` JSON schema for 2.1.X requires specifying `options` for rules if `fix` is given · Issue #7217 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7217
- [tavily] 📎 Implement `noUnnecessaryConditions` · Issue #6611 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/6611
- [tavily] 💅 noParametersOnlyUsedInRecursion false positives · Issue #8004 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8004
- [tavily] 💅 `useAwaitThenable` many false positives with drizzle · Issue #8476 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8476
- [tavily] 💅 `2.3.14` introduces incorrect behavior to `useExhaustiveDeps` · Issue #8958 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8958
- [tavily] 💅 `noUnknownAttribute` doesn't support SVG opacity · Issue #7967 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7967
- [github, closed] 💅 [svelte] Linter failing on detecting use of variables and function params in svelte snippet — https://github.com/biomejs/biome/issues/10103
- [github, closed] 💅 `nusery/noShadow` should not flag parameter names of function types — https://github.com/biomejs/biome/issues/9482
- [github, closed] 💅 `noDoneCallback` reports use of Vitest context parameter in hook as a callback — https://github.com/biomejs/biome/issues/7427
- [github, closed] 💅 False positive by lint/nursery/noUselessUndefined — https://github.com/biomejs/biome/issues/6577
- [tavily] 💅 lint/nursery/noUselessUndefined does not flag parameters · Issue #6578 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/6578
- [tavily] 💅 lint/suspicious/useIterableCallbackReturn makes impossible to explicitly return undefined · Issue #9445 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/9445
- [tavily] 📎 Implement `noUselessUndefined` - `unicorn/no-useless-undefined` · Issue #3942 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/3942
- [tavily] 💅 `lint/complexity/noForEach` suggests an impossible code change when using the index parameter. · Issue #547 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/547
- [tavily] 💅 useNamingConvention is a bit too aggressive · Issue #7575 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7575
- [tavily] 💅 `useDestructuring` doesn't work with type annotations · Issue #8478 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8478

</details>
