You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have some hook usage in tests like in the playground link above. These are valid and are called unconditionally.
The eslint equivalent does not flag these as invalid.
Code of Conduct
I agree to follow Biome's Code of Conduct
The text was updated successfully, but these errors were encountered:
Hah, this one is on me, yes. The behavior was intentional, because you shouldn’t call hooks from nested functions, but that assumes the component/hook it is defined in as at the top-level of the file.
I guess I just need to check for hook calls in nested functions whether the enclosing function is a hook or component (based on naming conventions). Feel free to assign me!
Environment information
Rule name
useHookAtTopLevel
Playground link
https://biomejs.dev/playground/?indentStyle=space"eStyle=single&trailingComma=none&lintRules=all&code=aQBtAHAAbwByAHQAIAB7ACAAdABlAHMAdAAsACAAZQB4AHAAZQBjAHQAIAB9ACAAZgByAG8AbQAgACcAdgBpAHQAZQBzAHQAJwA7AAoAaQBtAHAAbwByAHQAIAB7ACAAdQBzAGUAUwB0AGEAdABlACAAfQAgAGYAcgBvAG0AIAAnAHIAZQBhAGMAdAAnADsACgBpAG0AcABvAHIAdAAgAHsAIAByAGUAbgBkAGUAcgAsACAAcgBlAG4AZABlAHIASABvAG8AawAgAH0AIABmAHIAbwBtACAAJwBAAHQAZQBzAHQAaQBuAGcALQBsAGkAYgByAGEAcgB5AC8AcgBlAGEAYwB0ACcAOwAKAGkAbQBwAG8AcgB0ACAAewAgAHUAcwBlAEgAbwBvAGsAIAB9ACAAZgByAG8AbQAgACcALgAvAHUAcwBlAEgAbwBvAGsAJwA7AAoACgB0AGUAcwB0ACgAJwBhACcALAAgACgAKQAgAD0APgAgAHsACgAgACAAZgB1AG4AYwB0AGkAbwBuACAAVABlAHMAdABDAG8AbQBwAG8AbgBlAG4AdAAoACkAIAB7AAoAIAAgACAAIAB1AHMAZQBTAHQAYQB0AGUAKAApADsACgAgACAAIAAgAHUAcwBlAEgAbwBvAGsAKAApADsACgAgACAAfQAKAAoAIAAgAHIAZQBuAGQAZQByACgAPABUAGUAcwB0AEMAbwBtAHAAbwBuAGUAbgB0ACAALwA%2BACkAOwAKAH0AKQA7AAoACgB0AGUAcwB0ACgAJwBiACcALAAgACgAKQAgAD0APgAgAHsACgAgACAAYwBvAG4AcwB0ACAAewAgAHIAZQBzAHUAbAB0ACAAfQAgAD0AIAByAGUAbgBkAGUAcgBIAG8AbwBrACgAKAApACAAPQA%2BACAAdQBzAGUASABvAG8AawAoACkAKQA7AAoACgAgACAAZQB4AHAAZQBjAHQAKAByAGUAcwB1AGwAdAAuAGMAdQByAHIAZQBuAHQAKQAuAHQAbwBCAGUARABlAGYAaQBuAGUAZAAoACkAOwAKAH0AKQA7AAoA
Expected result
We have some hook usage in tests like in the playground link above. These are valid and are called unconditionally.
The eslint equivalent does not flag these as invalid.
Code of Conduct
The text was updated successfully, but these errors were encountered: