unicorn/consistent-function-scoping
demands that functions that be moved to the outer scope, even though the function captures a block-scoped variable.
Totally contrived example:
function foo() {
for (let i = 0; i < 3; i++) {
const scoped = i + 42
const fn = () => 5 + scoped
console.log(fn())
}
}
results in:
4:19 error Move arrow function 'fn' to the outer scope unicorn/consistent-function-scoping
Of course, it's impossible to move fn
to the outer scope, as scoped
isn't defined there.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too