Let's say we have two functions that call each other:
const a = () => {
console.log("a");
if (Math.random() > 0.9) {
// Dodging infinite recursion.
return;
}
b(); // 'b' was used before it was defined. (@typescript-eslint/no-use-before-define) eslint
};
const b = () => {
console.log("b");
a();
};
First approach in this answer (/* global b */
at top of file) doesn't work for me, while I don't think declaring variable before initialization is possible with const
.
So what is the best way to handle this linting error?