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 doesn't support destructuring dependencies #3407

Closed
1 task done
kosmotema opened this issue Jul 11, 2024 · 1 comment
Closed
1 task done

Comments

@kosmotema
Copy link

Environment information

CLI:
  Version:                      1.8.3
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           windows

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         unset
  JS_RUNTIME_VERSION:           "v18.19.1"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.1.2"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Linter:
  correctness/useExhaustiveDependencies
  ... other rules (don't really think, that the whole list will be helpful)

Rule name

useExhaustiveDependencies

Playground link

https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAAdQBzAGUAUwB0AGEAdABlACwAIAB1AHMAZQBNAGUAbQBvACAAfQAgAGYAcgBvAG0AIAAiAHIAZQBhAGMAdAAiADsACgAKAGUAeABwAG8AcgB0ACAAZgB1AG4AYwB0AGkAbwBuACAAVABlAHMAdABDAG8AbQBwAG8AbgBlAG4AdAAoACkAIAB7AAoAIAAgAGMAbwBuAHMAdAAgAFsAcwB0AGEAdABlAF0AIAA9ACAAdQBzAGUAUwB0AGEAdABlACgAewAgAHMAbwBtAGUAOgAgAHsAIABkAGUAZQBwADoAIAAiAG8AYgBqAGUAYwB0ACIAIAB9ACAAfQApADsACgAKACAAIAAvAC8AIABkAG8AZQBzAG4AJwB0ACAAdwBvAHIAawAsACAAcgBlAHEAdQBpAHIAZQBzACAAYABzAHQAYQB0AGUAYAAgAGEAcwAgAGEAIABkAGUAcABlAG4AZABlAG4AYwB5AAoAIAAgAGMAbwBuAHMAdAAgAGwAZQBuAGcAdABoACAAPQAgAHUAcwBlAE0AZQBtAG8AKAAoACkAIAA9AD4AIAB7AAoAIAAgACAAIABjAG8AbgBzAHQAIAB7ACAAcwBvAG0AZQA6ACAAewAgAGQAZQBlAHAAIAB9ACAAfQAgAD0AIABzAHQAYQB0AGUAOwAKAAoAIAAgACAAIAByAGUAdAB1AHIAbgAgAGQAZQBlAHAALgBsAGUAbgBnAHQAaAA7AAoAIAAgAH0ALAAgAFsAcwB0AGEAdABlAC4AcwBvAG0AZQAuAGQAZQBlAHAAXQApADsACgAKACAAIAAvAC8AIAB3AG8AcgBrAHMACgAgACAAYwBvAG4AcwB0ACAAbABlAG4AZwB0AGgAMgAgAD0AIAB1AHMAZQBNAGUAbQBvACgAKAApACAAPQA%2BACAAewAKACAAIAAgACAAYwBvAG4AcwB0ACAAZABlAGUAcAAgAD0AIABzAHQAYQB0AGUALgBzAG8AbQBlAC4AZABlAGUAcAA7AAoACgAgACAAIAAgAHIAZQB0AHUAcgBuACAAZABlAGUAcAAuAGwAZQBuAGcAdABoADsACgAgACAAfQAsACAAWwBzAHQAYQB0AGUALgBzAG8AbQBlAC4AZABlAGUAcABdACkAOwAKAAoAIAAgAHIAZQB0AHUAcgBuACAAbgB1AGwAbAA7AAoAfQA%3D

Expected result

Biome allows specifying paths for destructured properties as the dependencies (state.some.deep in the example) rather than the entire object

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@arendjr
Copy link
Contributor

arendjr commented Jul 11, 2024

I wouldn’t really consider this an issue. You’re referencing the state variable indeed, and how you end up using it is indeed tricky to understand for the analyzer, since any change in the destructured fields would cause it to break.

In this case, I think your code would be better served by moving the destructuring out of the memo callback and just specifying deep as the dependency. It would probably have slightly better runtime performance too.

@arendjr arendjr closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants