Closed samhh closed 6 months ago
"name": "React.useEffect",
This won't work, because we expect name
to be a function call, not a static member expression, and I think we want to keep it this way; due to the nature of JavaScript, we must set some expectations, otherwise it would be impossible to retrieve the information we need.
Could we at least consider allowing custom hooks definitions to override the default ones if they share the same name?
@samhh Doesn't this provide what you are looking for? https://biomejs.dev/linter/rules/use-exhaustive-dependencies/#options
Doesn't this provide what you are looking for? https://biomejs.dev/linter/rules/use-exhaustive-dependencies/#options
It seems something has changed since I raised this issue as this now works. Thanks for the prompt 🙂
Environment information
Rule name
useExhaustiveDependencies
Playground link
https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUARQBmAGYAZQBjAHQAIABhAHMAIAB1AHMAZQBFAGYAZgBlAGMAdABfACAAfQAgAGYAcgBvAG0AIAAiAHIAZQBhAGMAdAAiADsACgAKAGMAbwBuAHMAdAAgAHUAcwBlAEUAZgBmAGUAYwB0ACAAPQAgAHUAcwBlAEUAZgBmAGUAYwB0AF8AOwAKAAoALwAvACAAVABoAGkAcwAgAGkAcwAgAGwAaQBuAHQAZQBkACAAYQBzACAAZQB4AHAAZQBjAHQAZQBkAAoAZgB1AG4AYwB0AGkAbwBuACAAYwBvAG0AcABvAG4AZQBuAHQAKAApACAAewAKACAAIAAgACAAbABlAHQAIABhACAAPQAgADEAOwAKACAAIAAgACAAdQBzAGUARQBmAGYAZQBjAHQAKAAoACkAIAA9AD4AIAB7AAoAIAAgACAAIAAgACAAIAAgAGMAbwBuAHMAbwBsAGUALgBsAG8AZwAoAGEAKQA7AAoAIAAgACAAIAB9ACwAIABbAF0AKQA7AAoAfQA%3D
Expected result
In the linked playground the hook isn't linted because import was renamed before being used. This is a simplification of what led me here, which is that if you have a facade module that re-exports React hooks they also won't be linted.
Worse yet, if you add the following Biome config only
useEffect2
will be linted - you can't encourage the linter to consider any other import path foruseEffect
, even with namespace imports:This isn't an issue with ESLint's
react-hooks/exhaustive-deps
.Code of Conduct