💅 useExhaustiveDependencies does not trigger if dependency is specified after it is used #4355
Open
1 task done
Labels
A-Linter
Area: linter
L-JavaScript
Language: JavaScript and super languages
S-Bug-confirmed
Status: report has been confirmed as a valid bug
Environment information
Rule name
lint/correctness/useExhaustiveDependencies
Playground link
https://biomejs.dev/playground/?code=IgB1AHMAZQAgAGMAbABpAGUAbgB0ACIAOwAKAAoAaQBtAHAAbwByAHQAIABSAGUAYQBjAHQALAAgAHsAIAB1AHMAZQBDAGEAbABsAGIAYQBjAGsALAAgAHUAcwBlAFMAdABhAHQAZQAgAH0AIABmAHIAbwBtACAAIgByAGUAYQBjAHQAIgA7AAoACgBlAHgAcABvAHIAdAAgAGMAbwBuAHMAdAAgAEYAbwBvAEMAbwBuAHQAZQB4AHQAIAA9ACAAUgBlAGEAYwB0AC4AYwByAGUAYQB0AGUAQwBvAG4AdABlAHgAdAAoAHsACgAgACAAZgBvAG8AOgAgAG4AdQBsAGwAIABhAHMAIABzAHQAcgBpAG4AZwAgAHwAIABuAHUAbABsACwACgAKACAAIABpAHMAQgBhAHIAOgAgACgAKQAgAD0APgAgAGYAYQBsAHMAZQAsAAoAIAAgAGIAYQByAGkAZgB5ADoAIAAoACkAIAA9AD4AIAB2AG8AaQBkACwACgB9ACkAOwAKAAoAZQB4AHAAbwByAHQAIABjAG8AbgBzAHQAIABXAGkAdABoAEYAbwBvACAAPQAgACgAewAgAGMAaABpAGwAZAByAGUAbgAgAH0AOgAgAHsAIABjAGgAaQBsAGQAcgBlAG4AOgAgAFIAZQBhAGMAdAAuAFIAZQBhAGMAdABOAG8AZABlACAAfQApACAAPQA%2BACAAewAKAAkAYwBvAG4AcwB0ACAAWwBmAG8AbwAsACAAcwBlAHQARgBvAG8AXQAgAD0AIAB1AHMAZQBTAHQAYQB0AGUAKAAiACIAKQA7AAoACgAgACAAIAAgAC8ALwAgAEkAbgBjAG8AcgByAGUAYwB0ADoAIABpAHMAQgBhAHIAIABpAHMAIABuAG8AdAAgAHMAcABlAGMAaQBmAGkAZQBkACAAYQBzACAAZABlAHAAZQBuAGQAZQBuAGMAeQAKACAAIAAgACAAYwBvAG4AcwB0ACAAYgBhAHIAaQBmAHkAIAA9ACAAdQBzAGUAQwBhAGwAbABiAGEAYwBrACgAKAApACAAPQA%2BACAAewAKAAkACQBpAGYAIAAoACEAaQBzAEIAYQByACgAKQApACAAcwBlAHQARgBvAG8AKAAiAGIAYQByACIAKQA7AAoACQB9ACwAIABbAF0AKQA7AAoACgAJAGMAbwBuAHMAdAAgAGkAcwBCAGEAcgAgAD0AIAB1AHMAZQBDAGEAbABsAGIAYQBjAGsAKAAoACkAIAA9AD4AIABmAG8AbwAuAHMAdABhAHIAdABzAFcAaQB0AGgAKAAiAGIAYQByACIAKQAsACAAWwBmAG8AbwBdACkAOwAKAAoACQByAGUAdAB1AHIAbgAgACgACgAJAAkAPABGAG8AbwBDAG8AbgB0AGUAeAB0AC4AUAByAG8AdgBpAGQAZQByACAAdgBhAGwAdQBlAD0AewB7ACAAZgBvAG8ALAAgAGkAcwBCAGEAcgAsACAAYgBhAHIAaQBmAHkAIAB9AH0APgAKAAkACQAJAHsAYwBoAGkAbABkAHIAZQBuAH0ACgAJAAkAPAAvAEYAbwBvAEMAbwBuAHQAZQB4AHQALgBQAHIAbwB2AGkAZABlAHIAPgAKAAkAKQA7AAoAfQA7AAoA
Expected result
Biome should recognize dependencies no matter whether they are specified before or after the hook that depends on them.
Biome handles this correctly:
In the above, Biome correctly warns that
barify
does not specify it's dependency onisBar
. However, if I reverse the order of the two functions, Biome produces no warning.Code of Conduct
The text was updated successfully, but these errors were encountered: