Skip to content

Enable react-hooks/exhaustive-deps linter rule#3471

Merged
yurishkuro merged 8 commits into
jaegertracing:mainfrom
taanvi2205:enable-react-hooks-exhaustive-deps
Feb 3, 2026
Merged

Enable react-hooks/exhaustive-deps linter rule#3471
yurishkuro merged 8 commits into
jaegertracing:mainfrom
taanvi2205:enable-react-hooks-exhaustive-deps

Conversation

@taanvi2205
Copy link
Copy Markdown
Contributor

Closes #3445

Which problem is this PR solving?

Description of the changes

  • Add eslint-plugin-react-hooks dependency
  • Fix 12 violations across 6 files by adding missing hook dependencies
  • Add eslint-disable comment for intentional mount-only useEffect in SearchTracePage

How was this change tested?

  • npm run eslint passes with 0 errors
  • npm run test passes

Checklist

@taanvi2205 taanvi2205 requested a review from a team as a code owner January 27, 2026 18:35
@taanvi2205 taanvi2205 force-pushed the enable-react-hooks-exhaustive-deps branch from 1e752f4 to 7f247d8 Compare January 27, 2026 18:36
@taanvi2205 taanvi2205 marked this pull request as draft January 28, 2026 06:49
The component was incorrectly trying to use a navigate prop that does not exist. The withRouteProps HOC provides a history object with a push method

Signed-off-by: Taanvi Khevaria <[email protected]>
@taanvi2205 taanvi2205 marked this pull request as ready for review January 28, 2026 08:47
@taanvi2205 taanvi2205 force-pushed the enable-react-hooks-exhaustive-deps branch from 57547e6 to 01cab1b Compare January 28, 2026 08:47
@yurishkuro yurishkuro added the changelog:ci Change related to continuous integration / testing label Jan 30, 2026
viewModifiers: new Map(),
},
navigate: jest.fn(),
history: { push: jest.fn() },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how is this change related to the linter?

Copy link
Copy Markdown
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

there seem to be a lot of unrelated changes in this PR.

@taanvi2205
Copy link
Copy Markdown
Contributor Author

@yurishkuro The ~10k lines are from package-lock.json (adding the eslint-plugin-react-hooks dependency). I've removed the unrelated DeepDependencies changes.

Comment thread yarn.lock Outdated
@yurishkuro yurishkuro requested a review from Copilot February 2, 2026 14:38
@yurishkuro
Copy link
Copy Markdown
Member

all commits must be signed

@github-actions github-actions Bot added the waiting-for-author PR is waiting for author to respond to maintainer's comments label Feb 2, 2026
Copy link
Copy Markdown
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 pull request enables the react-hooks/exhaustive-deps ESLint rule to catch missing dependencies in React hooks, improving code correctness and preventing potential bugs from stale closures.

Changes:

  • Added eslint-plugin-react-hooks dependency and configured both rules-of-hooks and exhaustive-deps rules
  • Fixed 12 hook dependency violations across 6 files by adding missing dependencies to useEffect and useCallback hooks
  • Added an eslint-disable comment for an intentional mount-only useEffect in SearchTracePage

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Added eslint-plugin-react-hooks ^7.0.1 dependency; alphabetized ajv entry
package-lock.json Installed eslint-plugin-react-hooks and its dependencies (hermes-parser, zod, etc.)
eslint.config.js Configured react-hooks plugin and enabled rules-of-hooks and exhaustive-deps rules
packages/jaeger-ui/src/utils/documentTitle.ts Fixed cleanup function to capture ref value in local variable before closure
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/index.tsx Destructured props and updated useCallback dependencies to include action functions and trace.spans
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/AccordionEvents.tsx Added spanID to useEffect dependency array
packages/jaeger-ui/src/components/TracePage/ArchiveNotifier/index.tsx Destructured props and added acknowledge to useEffect dependencies
packages/jaeger-ui/src/components/SearchTracePage/index.tsx Added eslint-disable comment for intentional mount-only useEffect
packages/jaeger-ui/src/components/SearchTracePage/SearchResults/ScatterPlot.tsx Added calculateContainerWidth to useEffect dependency array
packages/jaeger-ui/src/components/Monitor/ServicesView/index.tsx Refactored to destructure props and updated useCallback/useEffect dependencies

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

Comment thread packages/jaeger-ui/src/components/Monitor/ServicesView/index.tsx Outdated
@github-actions github-actions Bot removed the waiting-for-author PR is waiting for author to respond to maintainer's comments label Feb 2, 2026
@taanvi2205 taanvi2205 force-pushed the enable-react-hooks-exhaustive-deps branch from d468f72 to 5d39a76 Compare February 2, 2026 16:17
@taanvi2205
Copy link
Copy Markdown
Contributor Author

@yurishkuro please review it now

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.31%. Comparing base (785a20f) to head (406d7a1).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3471      +/-   ##
==========================================
+ Coverage   88.26%   88.31%   +0.05%     
==========================================
  Files         299      299              
  Lines        9485     9486       +1     
  Branches     2419     2509      +90     
==========================================
+ Hits         8372     8378       +6     
+ Misses       1109     1104       -5     
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Taanvi Khevaria <[email protected]>
Comment thread packages/jaeger-ui/src/components/Monitor/ServicesView/index.tsx
// This may require "eslint-disable-next-line react-hooks/exhaustive-deps"
// in the future if we enable this linter.
// https://github.com/jaegertracing/jaeger-ui/issues/3445
// eslint-disable-next-line react-hooks/exhaustive-deps
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

disabling linter must be done with a comment explaining why

Copy link
Copy Markdown
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

mostly LGTM, just two questions

@yurishkuro yurishkuro removed the changelog:ci Change related to continuous integration / testing label Feb 3, 2026
@yurishkuro yurishkuro added the changelog:bugfix-or-minor-feature 🐞 Bug fixes, Minor Improvements label Feb 3, 2026
@yurishkuro yurishkuro enabled auto-merge February 3, 2026 15:24
@yurishkuro yurishkuro added this pull request to the merge queue Feb 3, 2026
Merged via the queue into jaegertracing:main with commit 75fdd78 Feb 3, 2026
15 checks passed
samar-703 pushed a commit to samar-703/jaeger-ui that referenced this pull request Feb 3, 2026
Closes jaegertracing#3445

## Which problem is this PR solving?
- closes jaegertracing#3445

## Description of the changes
- Add eslint-plugin-react-hooks dependency
- Fix 12 violations across 6 files by adding missing hook dependencies
- Add eslint-disable comment for intentional mount-only useEffect in
SearchTracePage

## How was this change tested?
- npm run eslint passes with 0 errors
- npm run test passes

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: Taanvi Khevaria <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:bugfix-or-minor-feature 🐞 Bug fixes, Minor Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore]: Can we enable react-hooks/exhaustive-deps linter?

3 participants