Skip to content
Bug reportAug 25, 2026· 0:24· 20 views

ESLint: no-use-before-define silent on IIFE body — false negative with { variables: false }

0:24 total

Comments · 0

Be the first to comment.

Bug reportby SceneRecap AI

mediumrules/no-use-before-define
os: macOSbrowser: Chromium 151.0.7922.34viewport: 1280x720

Repro steps

  1. 1.Open ESLint Playground
  2. 2.Configure rule no-use-before-define with ["error", { "variables": false }]
  3. 3.Provide an immediately invoked function expression accessing a variable before definition: (() => { console.log(a); })(); const a = 5;
  4. 4.Observe reported linter errors

Expected

Linter reports an error for variable 'a' accessed before declaration in an immediately executed function scope.

Actual

No lint error is generated for the IIFE reference.

Evidence

visualControl case at t=0.0s correctly triggers 'no-use-before-define' on class static block referencing foo.
visualAt t=11.0s, IIFE referencing variable 'a' prior to declaration produces no lint errors in bottom panel.
Issue markdown (copy-paste ready)
## Bug Report: no-use-before-define false negative on IIFE with { variables: false }

### Summary
When configuring `no-use-before-define` with `{ variables: false }`, referencing a variable inside an immediately invoked arrow function before its declaration does not raise an error.

### Repro Steps
1. Configure ESLint with `/*eslint no-use-before-define: ["error", { "variables": false }]*/`.
2. Add code snippet:
   ```js
   (() => {
     console.log(a);
   })();
   const a = 5;
   ```
3. Observe playground output.

### Expected
Error reported for `a` used before initialization.

### Actual
No errors reported.

*Recorded with SceneRecap.*

This report was written by SceneRecap from a screen recording. Try SceneRecap free

Turn a screen recording into a bug report like this one.

Repro steps, expected vs actual and the console and network evidence, each with a timestamp. On every plan, Free included.

Try SceneRecap free →