Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 useExhaustiveDependencies: bug with useContext/useSyncExternalStore and dependency arrays? #609

Closed
1 task done
nstepien opened this issue Oct 26, 2023 · 1 comment · Fixed by #621
Closed
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

Comments

@nstepien
Copy link
Contributor

nstepien commented Oct 26, 2023

Environment information

https://biomejs.dev/playground/?indentStyle=space&quoteStyle=single&trailingComma=none&code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUARQBmAGYAZQBjAHQALAAgAHUAcwBlAFMAeQBuAGMARQB4AHQAZQByAG4AYQBsAFMAdABvAHIAZQAgAH0AIABmAHIAbwBtACAAJwByAGUAYQBjAHQAJwA7AAoACgBlAHgAcABvAHIAdAAgAGYAdQBuAGMAdABpAG8AbgAgAHUAcwBlAEQAYQB0AGEAKAApACAAewAKACAAIABjAG8AbgBzAHQAIABkAGEAdABhACAAPQAgAHUAcwBlAFMAeQBuAGMARQB4AHQAZQByAG4AYQBsAFMAdABvAHIAZQAoAHMAdQBiAHMAYwByAGkAYgBlACwAIABnAGUAdABTAG4AYQBwAHMAaABvAHQAKQA7AAoACgAgACAAdQBzAGUARQBmAGYAZQBjAHQAKAAoACkAIAA9AD4AIAB7AAoAIAAgACAAIABjAG8AbgBzAG8AbABlAC4AbABvAGcAKABkAGEAdABhACkAOwAKACAAIAB9ACwAIABbAGQAYQB0AGEAXQApADsACgB9AAoA

https://biomejs.dev/playground/?indentStyle=space&quoteStyle=single&trailingComma=none&code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUARQBmAGYAZQBjAHQALAAgAHUAcwBlAEMAbwBuAHQAZQB4AHQAIAB9ACAAZgByAG8AbQAgACcAcgBlAGEAYwB0ACcAOwAKAAoAZQB4AHAAbwByAHQAIABmAHUAbgBjAHQAaQBvAG4AIAB1AHMAZQBEAGEAdABhACgAKQAgAHsACgAgACAAYwBvAG4AcwB0ACAAZABhAHQAYQAgAD0AIAB1AHMAZQBDAG8AbgB0AGUAeAB0ACgAQwBvAG4AdABlAHgAdAApADsACgAKACAAIAB1AHMAZQBFAGYAZgBlAGMAdAAoACgAKQAgAD0APgAgAHsACgAgACAAIAAgAGMAbwBuAHMAbwBsAGUALgBsAG8AZwAoAGQAYQB0AGEAKQA7AAoAIAAgAH0ALAAgAFsAZABhAHQAYQBdACkAOwAKAH0ACgA%3D

https://biomejs.dev/playground/?indentStyle=space&quoteStyle=single&trailingComma=none&code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUARQBmAGYAZQBjAHQALAAgAHUAcwBlAFMAeQBuAGMARQB4AHQAZQByAG4AYQBsAFMAdABvAHIAZQAgAH0AIABmAHIAbwBtACAAJwByAGUAYQBjAHQAJwA7AAoACgBlAHgAcABvAHIAdAAgAGYAdQBuAGMAdABpAG8AbgAgAHUAcwBlAEQAYQB0AGEAKAApACAAewAKACAAIABjAG8AbgBzAHQAIABkAGEAdABhACAAPQAgAHUAcwBlAFMAeQBuAGMARQB4AHQAZQByAG4AYQBsAFMAdABvAHIAZQAoAHMAdQBiAHMAYwByAGkAYgBlACwAIABnAGUAdABTAG4AYQBwAHMAaABvAHQAKQA7AAoACgAgACAAdQBzAGUARQBmAGYAZQBjAHQAKAAoACkAIAA9AD4AIAB7AAoAIAAgACAAIABjAG8AbgBzAG8AbABlAC4AbABvAGcAKABkAGEAdABhACkAOwAKACAAIAB9ACwAIABbAGQAYQB0AGEAXQApADsACgB9AAoA

https://biomejs.dev/playground/?indentStyle=space&quoteStyle=single&trailingComma=none&code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUARQBmAGYAZQBjAHQALAAgAHUAcwBlAEMAbwBuAHQAZQB4AHQAIAB9ACAAZgByAG8AbQAgACcAcgBlAGEAYwB0ACcAOwAKAAoAZQB4AHAAbwByAHQAIABmAHUAbgBjAHQAaQBvAG4AIAB1AHMAZQBEAGEAdABhACgAKQAgAHsACgAgACAAYwBvAG4AcwB0ACAAZABhAHQAYQAgAD0AIAB1AHMAZQBDAG8AbgB0AGUAeAB0ACgAQwBvAG4AdABlAHgAdAApADsACgAKACAAIAB1AHMAZQBFAGYAZgBlAGMAdAAoACgAKQAgAD0APgAgAHsACgAgACAAIAAgAGMAbwBuAHMAbwBsAGUALgBsAG8AZwAoAGQAYQB0AGEAKQA7AAoAIAAgAH0ALAAgAFsAZABhAHQAYQBdACkAOwAKAH0ACgA%3D

What happened?

Biome incorrectly flags values returned by useContext/useSyncExternalStore as being unnecessary in dependency arrays (useEffect, useMemo, ...)

Expected result

Biome should allow values returned by useContext/useSyncExternalStore to be in dependency arrays.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@nstepien nstepien changed the title 🐛 useExhaustiveDependencies: bug with useSyncExternalStore and dependency arrays? 🐛 useExhaustiveDependencies: bug with useContext/useSyncExternalStore and dependency arrays? Oct 26, 2023
@unvalley unvalley added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 28, 2023
@nissy-dev nissy-dev added the S-Bug-confirmed Status: report has been confirmed as a valid bug label Oct 28, 2023
msdlisper added a commit to msdlisper/biome that referenced this issue Oct 28, 2023
msdlisper added a commit to msdlisper/biome that referenced this issue Oct 28, 2023
@msdlisper
Copy link
Contributor

Provide a reproducible link with esLint:
https://stackblitz.com/edit/node-qj3asz?file=src%2Findex.js

npm run lint

msdlisper added a commit to msdlisper/biome that referenced this issue Nov 4, 2023
msdlisper added a commit to msdlisper/biome that referenced this issue Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants