Skip to content

copperwall/oxc-no-func-loop-catch-variable-min-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

no-func-loop catch variable minimal repro

This repo is a min repro for a bug where oxc's no-func-loop rule will error/warn on a catch variable, even though catch variables are block scoped, and are not hoisted outside of the loop.

To run

pnpm install
pnpm lint

Example output

$ oxlint

  × eslint(no-loop-func): Function declared in a loop contains unsafe references to variable(s)
   ╭─[test.js:4:16]
 3 │       } catch (e) {
 4 │ ╭─▶     setTimeout(() => {
 5 │ │         console.log(e);
 6 │ ╰─▶     })
 7 │       }
   ╰────
  help: Variables declared with 'var' are function-scoped, not block-scoped. Consider using 'let' or 'const' for block-scoped variables, or move the function outside the loop.

Found 0 warnings and 1 error.
Finished in 34ms on 1 file with 96 rules using 8 threads.
[ELIFECYCLE] Command failed with exit code 1.

About

Min repro for a no-func-loop bug for catch variables

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages