fixhunt

eslint no-useless-rename

labelled safe
Runs / 2026-10-22T18-21-52-102Z-on5g-eslint-no-useless-renameeslint 9.39.52026-10-22 18:21 UTC8 programs × 2 round(s)16 programs, 13 fired, 11 fixed, 0 findings, 2 rejectedmodel cost $0.0026

Analysis Nemotron 3 Super

Flags when imported, exported, or destructured identifiers are renamed to themselves.

Fix: Removes the redundant 'as' or colon rename, leaving only the identifier (e.g., 'import { x as x }' → 'import { x }').

8 hazards
  • The fix may remove a line comment attached to the 'as' token or colon, altering source formatting.
  • In destructuring patterns within function parameters, removing the colon could be misread if the parameter name shadows an outer variable, though semantics remain identical.
  • If the identifier is a reserved word or future keyword used as a property name (e.g., 'let { class: class }'), the fix remains valid as the shorthand form is allowed.
  • When the renamed identifier is part of a larger pattern (e.g., rest properties), the fix only applies to the specific shorthand and does not affect other parts.
  • In export statements, removing 'as' does not change the exported binding but may affect readability; no behavioral change occurs.
  • If the source module uses conditional exports or dynamic imports, the static import/export structure is unchanged by the fix.
  • In TypeScript files, the fix preserves type-only modifiers like 'import { type x as x }' only if the rule is configured to ignore such cases; otherwise, it may incorrectly strip needed syntax.
  • The fix does not adjust surrounding whitespace or semicolons, so manual formatting may be needed to match project style.

Programs

idresulttitlehazard
r1-p001fix okComment removal during fix alters formatting but not logicThe fix may remove a line comment attached to the 'as' token or colon, altering source formatting.
r1-p002invalidSparse array interaction with destructuring fixsparse arrays, holes, Array(n) vs [n], array-likes
r1-p003fix okNull/undefined distinction preserved after fixnull/undefined distinction, optional chaining short-circuit, nullish vs falsy
r1-p004fix okStatic import/export unchanged by fix despite dynamic importsIf the source module uses conditional exports or dynamic imports, the static import/export structure is unchanged by the fix.
r1-p005fix okComment attached to removed code is lost but value preservedcomments attached to the removed or moved code
r1-p006fix okArguments object and function.length unaffected by parameter fixarguments object, function.length, default parameters, rest parameters
r1-p007fix okVar hoisting and redeclaration in loop interacts with fixvar hoisting and re-declaration inside loops or after use
r1-p008fix okBlock-scoped function declaration fix interacts with switch casefunction declarations inside blocks, switch cases, labeled statements
r2-p001fix okOrder of Evaluation - Side Effects Duplicatedorder of evaluation when expressions are merged, duplicated or deleted (side effects run twice or never)
r2-p002fix okLarger Pattern - Rest Properties UnaffectedWhen the renamed identifier is part of a larger pattern (e.g., rest properties), the fix only applies to the specific shorthand and does not affect other parts.
r2-p003fix okFunction Parameter Shadowing - Colon Removal SafeIn destructuring patterns within function parameters, removing the colon could be misread if the parameter name shadows an outer variable, though semantics remain identical.
r2-p004fired, no fixComment Attached to Colon RemovedThe fix may remove a line comment attached to the 'as' token or colon, altering source formatting.
r2-p005silentBlock-Scoped Function in Switch Casefunction declarations inside blocks, switch cases, labeled statements
r2-p006invalidWhitespace and Semicolons Not AdjustedThe fix does not adjust surrounding whitespace or semicolons, so manual formatting may be needed to match project style.
r2-p007fix okTemporal Dead Zone After Hoistingtemporal dead zone after code is hoisted or reordered
r2-p008fired, no fixComment Attached to Removed Code Lostcomments attached to the removed or moved code

Sources

r1-p001 · Comment removal during fix alters formatting but not logic
1// Comment before
2let { x: x /* inline */ } = { x: 42 };
3console.log(x);
4// Comment after
--- orig.js	2026-10-22 14:21:59.794458236 -0400
+++ fixed.js	2026-10-22 14:22:03.015594430 -0400
@@ -1,4 +1,4 @@
 // Comment before
-let { x: x /* inline */ } = { x: 42 };
+let { x /* inline */ } = { x: 42 };
 console.log(x);
 // Comment after
42
r1-p002 · Sparse array interaction with destructuring fix (generated program does not parse: /home/sun/dev/diaghunt/runs/2026-10-22T18-21-5)
1const arr = Array(3);
2arr[1] = 9;
3let { 1: 1 } = arr;
4console.log(arr[1]); // Should be 9 if fix works correctly
r1-p003 · Null/undefined distinction preserved after fix
1const obj = { a: null };
2let { a: a } = obj;
3console.log(a === null ? 'null' : typeof a);
4// Fix should preserve binding to null
--- orig.js	2026-10-22 14:21:59.795458278 -0400
+++ fixed.js	2026-10-22 14:22:02.978592865 -0400
@@ -1,4 +1,4 @@
 const obj = { a: null };
-let { a: a } = obj;
+let { a } = obj;
 console.log(a === null ? 'null' : typeof a);
 // Fix should preserve binding to null
null
r1-p004 · Static import/export unchanged by fix despite dynamic imports
1export { value as value };
2const value = 123;
3// Even if dynamic import existed elsewhere, this static export must stay valid
--- orig.js	2026-10-22 14:21:59.796458320 -0400
+++ fixed.js	2026-10-22 14:22:02.977592823 -0400
@@ -1,3 +1,3 @@
-export { value as value };
+export { value };
 const value = 123;
 // Even if dynamic import existed elsewhere, this static export must stay valid
r1-p005 · Comment attached to removed code is lost but value preserved
1function test() {
2 let { y: y /* important */ } = { y: 7 };
3 return y;
4}
5console.log(test()); // Should print 7 even if comment is stripped
--- orig.js	2026-10-22 14:21:59.796458320 -0400
+++ fixed.js	2026-10-22 14:22:03.020594642 -0400
@@ -1,5 +1,5 @@
 function test() {
-  let { y: y /* important */ } = { y: 7 };
+  let { y /* important */ } = { y: 7 };
   return y;
 }
 console.log(test()); // Should print 7 even if comment is stripped
7
r1-p006 · Arguments object and function.length unaffected by parameter fix
1function foo({ a: a } = { a: 5 }) {
2 console.log(arguments.length, a);
3 return a;
4}
5console.log(foo().toString()); // Should be '5'
--- orig.js	2026-10-22 14:21:59.797458363 -0400
+++ fixed.js	2026-10-22 14:22:02.445570318 -0400
@@ -1,4 +1,4 @@
-function foo({ a: a } = { a: 5 }) {
+function foo({ a } = { a: 5 }) {
   console.log(arguments.length, a);
   return a;
 }
0 5
5
r1-p007 · Var hoisting and redeclaration in loop interacts with fix
1for (var i = 0; i < 2; i++) {
2 var { z: z } = { z: i * 10 };
3 if (i === 1) console.log(z); // Should be 10 after second iteration
4 var { z: z } = { z: 99 }; // Redeclaration
5}
--- orig.js	2026-10-22 14:21:59.827459630 -0400
+++ fixed.js	2026-10-22 14:22:03.015594430 -0400
@@ -1,5 +1,5 @@
 for (var i = 0; i < 2; i++) {
-  var { z: z } = { z: i * 10 };
+  var { z } = { z: i * 10 };
   if (i === 1) console.log(z); // Should be 10 after second iteration
-  var { z: z } = { z: 99 }; // Redeclaration
+  var { z } = { z: 99 }; // Redeclaration
 }
10
r1-p008 · Block-scoped function declaration fix interacts with switch case
1switch (1) {
2 case 1:
3 function f({ p: p }) { return p; }
4 break;
5}
6console.log(f({ p: 88 })); // Should print 88 if fix preserves function
--- orig.js	2026-10-22 14:22:04.087639795 -0400
+++ fixed.js	2026-10-22 14:22:07.325776931 -0400
@@ -1,6 +1,6 @@
 switch (1) {
   case 1:
-    function f({ p: p }) { return p; }
+    function f({ p }) { return p; }
     break;
 }
 console.log(f({ p: 88 })); // Should print 88 if fix preserves function
88
r2-p001 · Order of Evaluation - Side Effects Duplicated
1let count = 0;
2const getValue = () => {
3 return ++count;
4};
5let { a: a } = { a: getValue() };
6console.log(count);
--- orig.js	2026-10-22 14:22:12.765007649 -0400
+++ fixed.js	2026-10-22 14:22:15.396119417 -0400
@@ -2,5 +2,5 @@
 const getValue = () => {
   return ++count;
 };
-let { a: a } = { a: getValue() };
+let { a } = { a: getValue() };
 console.log(count);
1
r2-p002 · Larger Pattern - Rest Properties Unaffected
1const obj = { x: 1, y: 2, z: 3 };
2const { x: x, ...rest } = obj;
3console.log(x + Object.values(rest).reduce((a, b) => a + b, 0));
--- orig.js	2026-10-22 14:22:12.766007691 -0400
+++ fixed.js	2026-10-22 14:22:15.431120905 -0400
@@ -1,3 +1,3 @@
 const obj = { x: 1, y: 2, z: 3 };
-const { x: x, ...rest } = obj;
+const { x, ...rest } = obj;
 console.log(x + Object.values(rest).reduce((a, b) => a + b, 0));
6
r2-p003 · Function Parameter Shadowing - Colon Removal Safe
1let p = 99;
2function f({ p: p }) {
3 console.log(p);
4}
5f({ p: 5 });
--- orig.js	2026-10-22 14:22:12.767007734 -0400
+++ fixed.js	2026-10-22 14:22:16.510166773 -0400
@@ -1,5 +1,5 @@
 let p = 99;
-function f({ p: p }) {
+function f({ p }) {
   console.log(p);
 }
 f({ p: 5 });
5
r2-p004 · Comment Attached to Colon Removed
1// before
2let { z: /* keep me */ z } = { z: 42 };
3// after
4console.log(z);
42
r2-p005 · Block-Scoped Function in Switch Case
1switch (0) {
2 case 0:
3 function g() { return 1; }
4 console.log(typeof g === 'function' ? g() : 0);
5 break;
6}
1
r2-p006 · Whitespace and Semicolons Not Adjusted (generated program does not parse: /home/sun/dev/diaghunt/runs/2026-10-22T18-21-5)
1let { a:a };{b:b};console.log(a+b);
r2-p007 · Temporal Dead Zone After Hoisting
1{ let { x:x } = {x:1}; console.log(x); }
--- orig.js	2026-10-22 14:22:12.803009262 -0400
+++ fixed.js	2026-10-22 14:22:15.414120182 -0400
@@ -1 +1 @@
-{ let { x:x } = {x:1}; console.log(x); }
+{ let { x } = {x:1}; console.log(x); }
1
r2-p008 · Comment Attached to Removed Code Lost
1let y = 5;
2let { z: /* preserve this */ z } = { z: y };
3console.log(z);
5