fixhunt

eslint no-unused-labels

labelled safe
Runs / 2026-10-22T18-20-57-135Z-b8fi-eslint-no-unused-labelseslint 9.39.52026-10-22 18:20 UTC8 programs × 2 round(s)16 programs, 12 fired, 12 fixed, 0 findings, 2 rejectedmodel cost $0.0028

Analysis Nemotron 3 Super

The rule flags labeled statements where the label is never referenced by a break or continue statement.

Fix: Remove the label and its trailing colon, leaving only the associated statement unchanged.

10 hazards
  • Removing a label before a 'var' declaration changes nothing because labels do not affect variable scoping or hoisting.
  • Removing a label before a block statement does not alter the block's execution or variable scoping.
  • Removing a label before a loop does not affect the loop's iteration or control flow unless the label was referenced.
  • Removing a label before a 'switch' statement does not change its behavior as labels do not influence case execution.
  • Removing a label before a function declaration does not affect hoisting, name binding, or invocation semantics.
  • Removing a label before a class definition does not impact class creation, inheritance, or instantiation.
  • If a comment exists between the label and the statement, the autofix is skipped per rule design, so no hazard arises from fix application in those cases.
  • Removing a label cannot cause the following statement to become a directive prologue entry like 'use strict' because labels cannot precede such directives without being part of a block, and the rule avoids fixing when ambiguity exists.
  • Labels have no runtime semantics; their removal has no side effect on evaluation order, expression results, or state changes.
  • Label removal does not affect automatic semicolon insertion (ASI) because labels are not expressions and do not participate in ASI resolution.

Programs

idresulttitlehazard
r1-p001invalidVar Hoisting and Re-declaration HazardRemoving a label from a `var` declaration can cause early reference errors due to hoisting when combined with block-scoped redeclarations.
r1-p002fix okName Collision Across Scopes After MoveLabel removal exposes a previously shadowed variable, causing unintended capture in nested scopes.
r1-p003silentComment Between Label and Statement - Near MissIf a comment exists between label and statement, autofix is skipped — no behavioral change occurs.
r1-p004fix okASI Unaffected by Label RemovalLabels do not influence Automatic Semicolon Insertion; removing them doesn't change statement boundaries.
r1-p005fix okNull/Undefined Distinction and Optional ChainingLabel removal in a block containing optional chaining preserves null/undefined semantics; misbehavior would alter short-circuit.
r1-p006fix okThis Binding: Arrow vs FunctionLabel removal before a function expression does not alter `this` binding; arrow functions remain lexically bound.
r1-p007fix okVar Declaration Scoping Unaffected by Label RemovalLabel removal does not affect variable hoisting or scoping — `var` remains function-scoped regardless of label presence.
r1-p008invalidNumeric/String Coercion: + vs Template LiteralLabel removal before an expression involving `+` or template literals does not alter coercion behavior.
r2-p001fix okLoop Control Flow UnaffectedRemoving a label before a loop does not affect the loop's iteration or control flow unless the label was referenced.
r2-p002fix okName Collision After Label Removalname collisions across scopes after a move (shadowing)
r2-p003fix okNull/Undefined and Optional Chainingnull/undefined distinction, optional chaining short-circuit, nullish vs falsy
r2-p004silentDirective Prologue SafetyRemoving a label cannot cause the following statement to become a directive prologue entry like 'use strict' because labels cannot precede such directives without being part of a block, and the rule a
r2-p005fix okSparse Arrays and Holes Preservedsparse arrays, holes, Array(n) vs [n], array-likes
r2-p006fix okOrder of Evaluation with Side Effectsorder of evaluation when expressions are merged, duplicated or deleted (side effects run twice or never)
r2-p007fix okTemporal Dead Zone Not Affectedtemporal dead zone after code is hoisted or reordered
r2-p008fix okFunction Declaration in Block Scopefunction declarations inside blocks, switch cases, labeled statements

Sources

r1-p001 · Var Hoisting and Re-declaration Hazard (generated program does not parse: /home/sun/dev/diaghunt/runs/2026-10-22T18-20-5)
1function test() {
2 LABEL: var x = 1;
3 console.log(typeof x);
4 let x = 2;
5}
6try { test(); } catch (e) { console.log(e.name + ': ' + e.message); }
r1-p002 · Name Collision Across Scopes After Move
1function test() {
2 var x = 10;
3 LABEL: { const x = 20; }
4 console.log(x);
5}
6try { test(); } catch (e) { console.log(e.name + ': ' + e.message); }
--- orig.js	2026-10-22 14:21:04.396143871 -0400
+++ fixed.js	2026-10-22 14:21:07.211260106 -0400
@@ -1,6 +1,6 @@
 function test() {
   var x = 10;
-  LABEL: { const x = 20; }
+  { const x = 20; }
   console.log(x);
 }
 try { test(); } catch (e) { console.log(e.name + ': ' + e.message); }
10
r1-p003 · Comment Between Label and Statement - Near Miss
1function test() {
2 // LABEL:
3 // This comment prevents autofix
4 var x = 5;
5 console.log(x);
6}
7test();
5
r1-p004 · ASI Unaffected by Label Removal
1function test() {
2 LABEL: var x = 1
3 var y = 2
4 return x + y
5}
6console.log(test());
--- orig.js	2026-10-22 14:21:04.398143954 -0400
+++ fixed.js	2026-10-22 14:21:07.810284860 -0400
@@ -1,5 +1,5 @@
 function test() {
-  LABEL: var x = 1
+  var x = 1
   var y = 2
   return x + y
 }
3
r1-p005 · Null/Undefined Distinction and Optional Chaining
1function test() {
2 LABEL: { const obj = null; return obj?.prop ?? 'default'; }
3}
4console.log(test());
--- orig.js	2026-10-22 14:21:04.399143995 -0400
+++ fixed.js	2026-10-22 14:21:07.819285231 -0400
@@ -1,4 +1,4 @@
 function test() {
-  LABEL: { const obj = null; return obj?.prop ?? 'default'; }
+  { const obj = null; return obj?.prop ?? 'default'; }
 }
 console.log(test());
default
r1-p006 · This Binding: Arrow vs Function
1const obj = {
2 method: function() {
3 LABEL: return () => this;
4 }
5};
6const fn = obj.method();
7console.log(fn() === obj);
--- orig.js	2026-10-22 14:21:04.400144036 -0400
+++ fixed.js	2026-10-22 14:21:07.805284653 -0400
@@ -1,6 +1,6 @@
 const obj = {
   method: function() {
-    LABEL: return () => this;
+    return () => this;
   }
 };
 const fn = obj.method();
true
r1-p007 · Var Declaration Scoping Unaffected by Label Removal
1function test() {
2 console.log(typeof x); // undefined due to hoisting
3 LABEL: var x = 5;
4 console.log(x);
5}
6try { test(); } catch (e) { console.log(e.name + ': ' + e.message); }
--- orig.js	2026-10-22 14:21:04.431145315 -0400
+++ fixed.js	2026-10-22 14:21:07.849286471 -0400
@@ -1,6 +1,6 @@
 function test() {
   console.log(typeof x); // undefined due to hoisting
-  LABEL: var x = 5;
+  var x = 5;
   console.log(x);
 }
 try { test(); } catch (e) { console.log(e.name + ': ' + e.message); }
undefined
5
r1-p008 · Numeric/String Coercion: + vs Template Literal (generated program does not parse: /home/sun/dev/diaghunt/runs/2026-10-22T18-20-5)
1function test() {
2 LABEL: const val = { valueOf: () => 42, toString: () => 'hello' };
3 console.log(+val);
4 console.log(`${val}`);
5}
6test();
r2-p001 · Loop Control Flow Unaffected
1LABEL:
2for (let i = 0; i < 3; ++i) {
3 console.log(i);
4}
--- orig.js	2026-10-22 14:21:14.330554754 -0400
+++ fixed.js	2026-10-22 14:21:18.777739306 -0400
@@ -1,4 +1,3 @@
-LABEL:
 for (let i = 0; i < 3; ++i) {
   console.log(i);
 }
0
1
2
r2-p002 · Name Collision After Label Removal
1function test() {
2 let x = 99;
3 LABEL:
4 {
5 let x = 5;
6 console.log(x); // should be 5
7 }
8 console.log(x); // should be 99
9}
10test();
--- orig.js	2026-10-22 14:21:14.331554795 -0400
+++ fixed.js	2026-10-22 14:21:16.941663065 -0400
@@ -1,6 +1,5 @@
 function test() {
   let x = 99;
-  LABEL:
   {
     let x = 5;
     console.log(x); // should be 5
5
99
r2-p003 · Null/Undefined and Optional Chaining
1LABEL:
2{
3 const obj = { a: null };
4 console.log(obj.a ?? 'null');
5 console.log((obj.b ?? undefined) ?? 'undefined');
6}
--- orig.js	2026-10-22 14:21:14.331554795 -0400
+++ fixed.js	2026-10-22 14:21:16.377639659 -0400
@@ -1,4 +1,3 @@
-LABEL:
 {
   const obj = { a: null };
   console.log(obj.a ?? 'null');
null
undefined
r2-p004 · Directive Prologue Safety
1// Labels cannot appear before 'use strict' in a way that would make it a directive prologue
2// This is a near-miss: rule does not trigger because label cannot be before directive in same lexical unit
3'use strict';
4console.log('strict mode');
strict mode
r2-p005 · Sparse Arrays and Holes Preserved
1LABEL:
2{
3 const arr = Array(3);
4 arr[1] = 'present';
5 console.log(arr.length); // 3
6 console.log(arr[0]); // undefined (hole)
7 console.log(arr[1]); // 'present'
8}
--- orig.js	2026-10-22 14:21:14.332554837 -0400
+++ fixed.js	2026-10-22 14:21:16.386640032 -0400
@@ -1,4 +1,3 @@
-LABEL:
 {
   const arr = Array(3);
   arr[1] = 'present';
3
undefined
present
r2-p006 · Order of Evaluation with Side Effects
1let side = 0;
2LABEL:
3{
4 console.log(side++); // 0
5 console.log(side++); // 1
6}
7console.log(side); // 2
--- orig.js	2026-10-22 14:21:14.332554837 -0400
+++ fixed.js	2026-10-22 14:21:16.403640738 -0400
@@ -1,5 +1,4 @@
 let side = 0;
-LABEL:
 {
   console.log(side++); // 0
   console.log(side++); // 1
0
1
2
r2-p007 · Temporal Dead Zone Not Affected
1LABEL:
2{
3 try {
4 console.log(letX); // ReferenceError due to TDZ
5 } catch (e) {
6 console.log(e.name); // ReferenceError
7 }
8 let letX = 42;
9}
--- orig.js	2026-10-22 14:21:17.387681581 -0400
+++ fixed.js	2026-10-22 14:21:21.228841184 -0400
@@ -1,4 +1,3 @@
-LABEL:
 {
   try {
     console.log(letX); // ReferenceError due to TDZ
ReferenceError
r2-p008 · Function Declaration in Block Scope
1LABEL:
2{
3 if (true) {
4 function g() { return 'in-block'; }
5 console.log(g()); // Should work: function decl in block
6 }
7 // Note: g is not accessible here in strict mode, but we're not using strict
8}
9console.log(typeof g); // undefined (not hoisted out of block)
--- orig.js	2026-10-22 14:21:18.636733449 -0400
+++ fixed.js	2026-10-22 14:21:21.320845010 -0400
@@ -1,4 +1,3 @@
-LABEL:
 {
   if (true) {
     function g() { return 'in-block'; }
in-block
function