What version of Oxlint are you using?
1.73.0
What command did you run?
oxlint
What does your .oxlintrc.json (or oxlint.config.ts) config file look like?
What happened?
Minimum reproduction repository: https://github.com/copperwall/oxc-no-func-loop-catch-variable-min-repro
I noticed that I was getting a no-loop-func error when referencing a catch variable within a function within a loop. I believe this should be okay because catch variables are scoped to the catch block and shouldn't be hoisted outside of the loop.
Example file
for (let i = 0; i < 10; i++) {
try {
} catch (e) {
setTimeout(() => {
// e is scoped to the catch block, so it shouldn't be shared between loop iterations
console.log(e);
})
}
}
What version of Oxlint are you using?
1.73.0
What command did you run?
oxlint
What does your
.oxlintrc.json(oroxlint.config.ts) config file look like?{ "$schema": "./node_modules/oxlint/configuration_schema.json", "plugins": [ "typescript", "unicorn", "oxc" ], "categories": { "correctness": "error" }, "rules": { "no-loop-func": "error" }, "env": { "builtin": true } }What happened?
Minimum reproduction repository: https://github.com/copperwall/oxc-no-func-loop-catch-variable-min-repro
I noticed that I was getting a
no-loop-funcerror when referencing a catch variable within a function within a loop. I believe this should be okay because catch variables are scoped to the catch block and shouldn't be hoisted outside of the loop.Example file