Skip to content

fix(linter/exhaustive-deps): fix fixer incorrectly adding property chain from destructuring pattern#17167

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/12-20-fix_linter_exhaustive-deps_fix_fixer_incorrectly_adding_property_chain_from_destructuring_pattern
Dec 20, 2025
Merged

fix(linter/exhaustive-deps): fix fixer incorrectly adding property chain from destructuring pattern#17167
graphite-app[bot] merged 1 commit intomainfrom
c/12-20-fix_linter_exhaustive-deps_fix_fixer_incorrectly_adding_property_chain_from_destructuring_pattern

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Dec 20, 2025

Fixes #17159

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Dec 20, 2025
Copy link
Contributor Author

camc314 commented Dec 20, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@camc314 camc314 self-assigned this Dec 20, 2025
@camc314 camc314 marked this pull request as ready for review December 20, 2025 12:14
Copilot AI review requested due to automatic review settings December 20, 2025 12:14
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
Copy link
Contributor Author

camc314 commented Dec 20, 2025

Merge activity

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #17159 where the exhaustive-deps linter rule's fixer was incorrectly suggesting property chains from destructuring patterns when the identifier was used inside a function call rather than directly destructured.

Key Changes:

  • Added logic to check if an identifier is inside a CallExpression before applying destructuring property chain logic
  • Updated error message in snapshot from foo.bar to foo for the affected test case
  • Added a new test case to verify the fix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/oxc_linter/src/rules/react/exhaustive_deps.rs Adds a check to prevent applying destructuring logic when an identifier is nested inside a call expression, and adds a test case for the fix
crates/oxc_linter/src/snapshots/react_exhaustive_deps.snap Updates the expected diagnostic message to correctly identify foo instead of foo.bar as the missing dependency

The implementation is correct and handles the issue appropriately. When an identifier like booleanValue is used as an argument in a function call fn(booleanValue) where the result is destructured (const { headers } = fn(booleanValue)), the dependency should be just booleanValue, not booleanValue.headers. The fix correctly distinguishes this from the case where the identifier is directly destructured (const { headers } = booleanValue), where booleanValue.headers would be the correct dependency.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 20, 2025

CodSpeed Performance Report

Merging #17167 will not alter performance

Comparing c/12-20-fix_linter_exhaustive-deps_fix_fixer_incorrectly_adding_property_chain_from_destructuring_pattern (5c46a39) with main (c7cbe69)

Summary

✅ 4 untouched
⏩ 41 skipped1

Footnotes

  1. 41 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.

@graphite-app graphite-app bot force-pushed the c/12-20-fix_linter_exhaustive-deps_fix_fixer_incorrectly_adding_property_chain_from_destructuring_pattern branch from 5c46a39 to c08e6df Compare December 20, 2025 12:19
@graphite-app graphite-app bot merged commit c08e6df into main Dec 20, 2025
20 checks passed
@graphite-app graphite-app bot deleted the c/12-20-fix_linter_exhaustive-deps_fix_fixer_incorrectly_adding_property_chain_from_destructuring_pattern branch December 20, 2025 12:24
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: Invalid/incorrect fix suggested for react/exhaustive-deps

2 participants