fixhunt

biome complexity/noUselessUndefinedInitialization

labelled safe
Runs / 2026-10-17T19-31-04-008Z-biome-complexity_noUselessUndefinedInitializationbiome 2.5.152026-10-17 19:31 UTC8 programs × 1 round(s)8 programs, 3 fired, 3 fixed, 0 findings, 0 rejectedmodel cost $0.0010

Programs

idresulttitlehazard
r1-p001silentTemporal Dead Zone - let redeclaration without initializertemporal dead zone: let/const accessed before declaration after code is hoisted or reordered
r1-p002silent__proto__ assignment effects object identity__proto__ keys, prototype access, Object.assign vs spread
r1-p003silent prediction offAsync function captures unitialized binding across awaitasync/await, promise ordering, generators and yield position
r1-p004fix okBreak from labeled block skips re-initializationlabel/break/continue control flow, finally blocks, early returns in nested blocks
r1-p005fix okSparse array created by accessing unset indices in loopsparse arrays, holes, Array(n) vs [n], array-likes
r1-p006fix okTemplate literal coercion depends on undefined vs absent bindingnumeric/string coercion: + vs template literal, String(x) vs ${x}, Symbol, BigInt, objects with toString/valueOf
r1-p007silentSloppy mode this binding in function called via undefined propertystrict vs sloppy mode semantics (this, octal, duplicate params, with)
r1-p008silentException thrown in initializer expression masked by fixexceptions thrown inside the code the fix removes or rewrites

Sources

r1-p001 · Temporal Dead Zone - let redeclaration without initializer
1function test() {
2 try {
3 return a;
4 } catch (e) {
5 console.log(e.name);
6 }
7 let a;
8}
9test();
ReferenceError
r1-p002 · __proto__ assignment effects object identity
1let obj = {};
2obj.__proto__ = {toString: () => 'changed'};
3console.log(obj.toString());
changed
r1-p003 · Async function captures unitialized binding across await
1async function main() {
2 let x;
3 const p = Promise.resolve().then(() => console.log(typeof x));
4 x = 42;
5 await p;
6}
7main();
number
r1-p004 · Break from labeled block skips re-initialization
1outer:
2for (let i = 0;;) {
3 let counter = undefined;
4 if (i === 0) break outer;
5 counter = 1;
6 i++;
7}
8console.log(typeof counter); // ReferenceError if fix removes declaration
--- orig.js	2026-10-17 15:31:10.474344740 -0400
+++ fixed.js	2026-10-17 15:31:10.736358785 -0400
@@ -1,6 +1,6 @@
 outer:
 for (let i = 0;;) {
-  let counter = undefined;
+  let counter ;
   if (i === 0) break outer;
   counter = 1;
   i++;
undefined
r1-p005 · Sparse array created by accessing unset indices in loop
1function test() {
2 const arr = [];
3 for (let i = 0; i < 3; i++) {
4 let val = undefined;
5 if (i !== 1) arr[i] = val;
6 }
7 console.log(arr.length, arr[1]);
8}
9test();
--- orig.js	2026-10-17 15:31:10.894367255 -0400
+++ fixed.js	2026-10-17 15:31:11.159381412 -0400
@@ -1,7 +1,7 @@
 function test() {
   const arr = [];
   for (let i = 0; i < 3; i++) {
-    let val = undefined;
+    let val ;
     if (i !== 1) arr[i] = val;
   }
   console.log(arr.length, arr[1]);
3 undefined
r1-p006 · Template literal coercion depends on undefined vs absent binding
1function show() {
2 let msg = undefined;
3 return `${msg}`;
4}
5console.log(show());
--- orig.js	2026-10-17 15:31:11.321390046 -0400
+++ fixed.js	2026-10-17 15:31:11.588404276 -0400
@@ -1,5 +1,5 @@
 function show() {
-  let msg = undefined;
+  let msg ;
   return `${msg}`;
 }
 console.log(show());
undefined
r1-p007 · Sloppy mode this binding in function called via undefined property
1function f() {
2 console.log(this === global);
3}
4const o = {m: f};
5(o.m || o.n)(); // calls f with this=global due to [[Get]] returning undefined
false
r1-p008 · Exception thrown in initializer expression masked by fix
1function bad() {
2 throw new Error('init fail');
3}
4try {
5 let x = bad();
6} catch (e) {
7 console.log(e.message);
8}
init fail