With the following rule:
"unicorn/consistent-function-scoping" : ["error", {
checkArrowFunctions : true
}]
(I do really want arrow function to move upper scope when they do not use any variable or upper this
).
This is wrongly reported as a problem:
class Foo {
public bar = new FinalizationRegistry(() => {
console.log(this); // <- `this` is used in this arrow function
})
}
error Move arrow function to the outer scope unicorn/consistent-function-scoping
Same for:
function foo(this) {
const bar = () => console.log(this); // <- `this` is used in this arrow function
return [].map(() => bar);
}
error Move arrow function 'bar' to the outer scope
The cases below should be OK when an arrow function only consuming this
from outer scope.
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