Skip to content

fix(linter): useExhaustiveDependencies proper handling of computed keys when destructuring, fixes #9744#9978

Merged
dyc3 merged 1 commit intobiomejs:mainfrom
mdevils:fix/issue9744
Apr 14, 2026
Merged

fix(linter): useExhaustiveDependencies proper handling of computed keys when destructuring, fixes #9744#9978
dyc3 merged 1 commit intobiomejs:mainfrom
mdevils:fix/issue9744

Conversation

@mdevils
Copy link
Copy Markdown
Contributor

@mdevils mdevils commented Apr 14, 2026

Summary

Fixed #9744: useExhaustiveDependencies no longer reports false positives for variables obtained via object destructuring with computed keys, e.g. const { [KEY]: key1 } = props.

Test Plan

Test is included.

Docs

Changeset is included.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: af54a5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Apr 14, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6e350f29-a017-4c70-888e-22cec42c2f67

📥 Commits

Reviewing files that changed from the base of the PR and between 3f89810 and af54a5c.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue9744.ts.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (4)
  • .changeset/green-buckets-love.md
  • crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
  • crates/biome_js_analyze/src/react/hooks.rs
  • crates/biome_js_analyze/tests/specs/correctness/useExhaustiveDependencies/issue9744.ts

Walkthrough

This pull request fixes a false positive in the useExhaustiveDependencies linter rule when variables are destructured from props using computed property keys (e.g. const { [KEY]: key1 } = props). The fix updates the stability classification logic in the rule's dependency analysis, treating unknown binding patterns as unstable rather than stable. Additionally, Debug derive is added to internal types for better tooling support, and a test case is included to prevent regression of the reported issue.

Suggested labels

A-Diagnostic

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing the useExhaustiveDependencies rule to properly handle computed keys in destructuring, with explicit issue reference.
Description check ✅ Passed The description clearly relates to the changeset, explaining the fix for #9744 regarding false positives with computed destructuring keys and confirming test and changeset inclusion.
Linked Issues check ✅ Passed The PR successfully addresses issue #9744 by updating the linter rule logic to treat variables from computed destructured keys as used, eliminating the false positive.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the useExhaustiveDependencies rule and its tests; the Debug derives for related enums are minimal, necessary adjustments to support the fix.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 14, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing mdevils:fix/issue9744 (af54a5c) with main (3f89810)

Open in CodSpeed

Footnotes

  1. 196 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3 dyc3 merged commit 4847715 into biomejs:main Apr 14, 2026
30 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 14, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 False positive for useExhaustiveDependencies with dynamic destructured keys

2 participants