fixhunt

eslint strict

labelled safe
Runs / 2026-10-22T18-32-36-234Z-pyqw-eslint-stricteslint 9.39.52026-10-22 18:32 UTC8 programs × 2 round(s)16 programs, 3 fired, 3 fixed, 0 findings, 2 rejectedmodel cost $0.0030

Analysis Nemotron 3 Super

Flags missing required 'use strict' directives based on context determined by parser options.

Fix: Inserts exactly one 'use strict'; directive where required—either globally before any statements/functions, or as the first statement inside each top-level function—and removes duplicate directives elsewhere.

8 hazards
  • Rewriting global scope may affect code relying on sloppy-mode behaviors like accidental globals or with-statements.
  • Adding 'use strict'; before a function containing 'with' causes a SyntaxError due to strict-mode prohibition.
  • Moving a directive past a preceding side-effectful expression (e.g., logging) changes execution order and observable behavior.
  • Removing duplicates may eliminate developer-intended comments attached to the directive literals via adjacent comment tokens.
  • In function mode, inserting directives into arrow-function bodies expressed as blocks may conflict with implicit returns if not braced properly.
  • If a top-level function is conditionally defined (e.g., inside an if-block), inserting 'use strict'; assumes hoisting, which may not match runtime expectations.
  • In CommonJS-wrapped modules, a global directive affects the entire wrapper function, potentially altering behavior of top-level var declarations.
  • Inserting 'use strict'; before a function with non-simple parameters (defaults, rest) is a syntax error in ES2016+, making the fix invalid and causing parse failure.

Programs

idresulttitlehazard
r1-p001silent prediction offnull/undefined distinction with optional chainingRule inserts 'use strict'; which changes how loosely equal comparisons behave when undefined/null interacts with optionals.
r1-p002silent prediction offASI with leading parenthesis causing IIFE misparseWithout semicolon, leading '(' after function can be misread as call; rule's inserted 'use strict'; may shift newline interpretation under ASI.
r1-p003silent prediction offthis binding in extracted method with call siteRule's inserted 'use strict'; makes 'this' undefined in extracted function, breaking non-strict implied global assignment.
r1-p004silent prediction offarguments object shadowed by rest parameter in strictIn non-strict, arguments aliases params; rule's 'use strict'; breaks that alias, exposing bug when fn uses both.
r1-p005fix ok prediction offArrow function block body with implicit return conflictIf arrow function uses block body but omits return, inserting 'use strict'; does not affect control flow—but if mistakenly braced, return missing causes undefined.
r1-p006silent prediction offName collision after hoisting shift due to inserted directiveInserting 'use strict'; at top lets a later var slip into function scope, avoiding global leak that would have occurred in non-strict sloppy mode.
r1-p007silent prediction offGetter side effect ordering changed by strict insertionRule inserts 'use strict'; before getter, converting silently ignored non-strict errors (e.g. non-writable prop throw) into observable exceptions.
r1-p008invalidFunction decl inside case block hoisted differently in strictIn non-strict, function decl in case is hoisted to enclosing scope; rule's inserted 'use strict'; keeps it block-scoped, changing which function is called.
r2-p001invalidWith statement forbidden in strict modeAdding 'use strict'; before a function containing 'with' causes a SyntaxError due to strict-mode prohibition.
r2-p002silent prediction offConditional function definition and hoisting assumptionIf a top-level function is conditionally defined (e.g., inside an if-block), inserting 'use strict'; assumes hoisting, which may not match runtime expectations.
r2-p003fix okDuplicate directive removal loses attached commentsRemoving duplicates may eliminate developer-intended comments attached to the directive literals via adjacent comment tokens.
r2-p004fix okComments attached to removed/moved code lostcomments attached to the removed or moved code
r2-p005silent prediction offVar hoisting and re-declaration inside loopsvar hoisting and re-declaration inside loops or after use
r2-p006silent prediction offThis binding: arrow vs function, extracted methodsthis binding: arrow vs function, methods extracted from objects, call/apply/bind
r2-p007silent prediction offRegular expressions: escapes, unicode flag, lastIndex with g flagregular expressions: escapes, unicode flag, lastIndex with the g flag
r2-p008silent prediction offNumeric/string coercion: + vs template literal, objects with toString/valueOf, Symbol, BigIntnumeric/string coercion: + vs template literal, objects with toString/valueOf, Symbol, BigInt

Sources

r1-p001 · null/undefined distinction with optional chaining
1let x = undefined;
2(function f() {
3 console.log(x == null);
4 let y = x?.prop ?? 'ok';
5 console.log(y);
6})();
true
ok
r1-p002 · ASI with leading parenthesis causing IIFE misparse
1function f() {
2 return
3}(
4 () => 42
5)();
6console.log(typeof f());
undefined
r1-p003 · this binding in extracted method with call site
1var obj = { m() { this.x = 1 } };
2var f = obj.m;
3f();
4try { console.log(window.x); } catch(e) { console.log(e.name); }
ReferenceError
r1-p004 · arguments object shadowed by rest parameter in strict
1function f(a, ...rest) {
2 console.log(arguments.length === 1 + rest.length);
3 arguments[0] = 99;
4 console.log(a);
5}
6f(1, 2, 3);
true
1
r1-p005 · Arrow function block body with implicit return conflict
1const f = () => {
2 'use strict';
3 42
4};
5console.log(f());
--- orig.js	2026-10-22 14:32:46.178759837 -0400
+++ fixed.js	2026-10-22 14:32:49.648794332 -0400
@@ -1,5 +1,5 @@
 const f = () => {
-  'use strict';
+  
   42
 };
 console.log(f());
undefined
r1-p006 · Name collision after hoisting shift due to inserted directive
1(function outer() {
2 function inner() { return v; }
3 var v = 1;
4 console.log(inner());
5 var v = 2;
6 console.log(inner());
7})();
1
2
r1-p007 · Getter side effect ordering changed by strict insertion
1const obj = {};
2Object.defineProperty(obj, 'prop', {
3 get() { return this.counter++; }
4});
5console.log(obj.prop);
6console.log(obj.prop);
NaN
NaN
r1-p008 · Function decl inside case block hoisted differently in strict (generated program does not parse: /home/sun/dev/diaghunt/runs/2026-10-22T18-32-3)
1switch(0) {
2 case 0:
3 function f() { return 1; }
4 break;
5 default:
6 function f() { return 2; }
7}
8console.log(f());
r2-p001 · With statement forbidden in strict mode (generated program does not parse: /home/sun/dev/diaghunt/runs/2026-10-22T18-32-3)
1(function f() {
2 with ({x: 1}) {
3 console.log(x);
4 }
5});
r2-p002 · Conditional function definition and hoisting assumption
1if (false) {
2 function g() {
3 return 1;
4 }
5}
6console.log(typeof g === 'undefined' ? 'undef' : g());
undef
r2-p003 · Duplicate directive removal loses attached comments
1"use strict"; // enabled
2"use strict"; // redundant but commented
3var x = 1;
4console.log(x);
--- orig.js	2026-10-22 14:32:59.209892814 -0400
+++ fixed.js	2026-10-22 14:33:02.403926831 -0400
@@ -1,4 +1,4 @@
-"use strict"; // enabled
-"use strict"; // redundant but commented
+ // enabled
+ // redundant but commented
 var x = 1;
 console.log(x);
1
r2-p004 · Comments attached to removed/moved code lost
1function h() {
2 // important setup
3 "use strict"; // enable checks
4 return 42;
5}
6console.log(h());
--- orig.js	2026-10-22 14:32:59.209892814 -0400
+++ fixed.js	2026-10-22 14:33:02.384926627 -0400
@@ -1,6 +1,6 @@
 function h() {
   // important setup
-  "use strict"; // enable checks
+   // enable checks
   return 42;
 }
 console.log(h());
42
r2-p005 · Var hoisting and re-declaration inside loops
1for (var i = 0; i < 2; i++) {
2 var j = i;
3 if (i === 0) {
4 var j = 99; // re-declare in same block
5 }
6 console.log(j);
7}
99
1
r2-p006 · This binding: arrow vs function, extracted methods
1const obj = {
2 value: 42,
3 getValue: function() {
4 return this.value;
5 }
6};
7const fn = obj.getValue;
8console.log(fn.call(obj)); // should be 42 in non-strict, undefined in strict
42
r2-p007 · Regular expressions: escapes, unicode flag, lastIndex with g flag
1let str = 'a\nb';
2let regex = /^.$/;
3console.log(regex.test(str)); // dot doesn't match newline without s flag
4regex.lastIndex = 0;
5let match = regex.exec('aa');
6console.log(match ? match.index : -1);
false
-1
r2-p008 · Numeric/string coercion: + vs template literal, objects with toString/valueOf, Symbol, BigInt
1const obj = {
2 toString() { return 'hello';
3 },
4 valueOf() { return 42;
5 }
6};
7console.log(String(obj));
8console.log(obj + '');
9console.log(`${obj}`);
hello
42
hello