Skip to content

chore(eslint): enable @eslint-react/static-components rule#1050

Draft
carlosthe19916 wants to merge 5 commits into
guacsec:mainfrom
carlosthe19916:hotfix/enable-static-components
Draft

chore(eslint): enable @eslint-react/static-components rule#1050
carlosthe19916 wants to merge 5 commits into
guacsec:mainfrom
carlosthe19916:hotfix/enable-static-components

Conversation

@carlosthe19916
Copy link
Copy Markdown
Collaborator

@carlosthe19916 carlosthe19916 commented May 27, 2026

Summary

  • Remove the @eslint-react/static-components override from ESLint config
  • Move presets object and IconWithOptionalTooltip component outside of IconedStatus render to avoid re-creation on each render

Test plan

  • npm run lint passes with 0 warnings

🤖 Generated with Claude Code

Summary by Sourcery

Enable stricter React ESLint rules and refactor IconedStatus to use static configuration and components.

Enhancements:

  • Hoist IconedStatus presets configuration and IconWithOptionalTooltip component outside the render function to make them static and reusable.
  • Adjust IconWithOptionalTooltip to accept an explicit tooltip message prop for more flexible usage.

Build:

  • Remove the override that disabled the @eslint-react/static-components rule in the ESLint configuration.

Move presets object and IconWithOptionalTooltip component outside
the IconedStatus render function to avoid re-creation on each render.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 27, 2026

Reviewer's Guide

Enables the @eslint-react/static-components rule by refactoring IconedStatus so its presets map and tooltip wrapper are defined as top-level static components instead of being recreated on each render, and by removing the rule override from the ESLint config.

File-Level Changes

Change Details Files
Make IconedStatus presets and tooltip wrapper static to satisfy @eslint-react/static-components.
  • Move the presets mapping object definition outside of the IconedStatus component so it is no longer recreated on each render.
  • Introduce a top-level IconWithOptionalTooltip component that takes an optional tooltipMessage prop and conditionally wraps children in Tooltip.
  • Update IconedStatus to compute presetProps from the external presets object and pass presetProps?.tooltipMessage down to IconWithOptionalTooltip.
  • Remove the in-component IconWithOptionalTooltip definition that closed over presetProps.
client/src/app/components/IconedStatus.tsx
Enable @eslint-react/static-components ESLint rule.
  • Remove the override that disabled @eslint-react/static-components in the ESLint configuration so the rule now runs with its default severity.
eslint.config.mjs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In IconWithOptionalTooltip, consider widening the children type from React.ReactElement to React.ReactNode (or at least React.ReactElement | React.ReactNode) so the wrapper can be used with fragments or text nodes without additional casting.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `IconWithOptionalTooltip`, consider widening the `children` type from `React.ReactElement` to `React.ReactNode` (or at least `React.ReactElement | React.ReactNode`) so the wrapper can be used with fragments or text nodes without additional casting.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Move LogButton to module level and pass messages, setLogData,
toggleLogModal as explicit props.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.68%. Comparing base (16a6bec) to head (45de4f4).

Files with missing lines Patch % Lines
...ient/src/app/pages/importer-list/importer-list.tsx 10.00% 9 Missing ⚠️
client/src/app/components/IconedStatus.tsx 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1050   +/-   ##
=======================================
  Coverage   50.68%   50.68%           
=======================================
  Files         253      253           
  Lines        5499     5499           
  Branches     1660     1660           
=======================================
  Hits         2787     2787           
  Misses       2440     2440           
  Partials      272      272           
Flag Coverage Δ
e2e 68.93% <33.33%> (ø)
unit 2.01% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@carlosthe19916 carlosthe19916 marked this pull request as draft May 27, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant