Skip to content

feat(eslint): add prefer-info-text lint rule and migrate existing usages#116211

Merged
TkDodo merged 22 commits into
masterfrom
tkdodo/feat/eslint-prefer-info-text
May 28, 2026
Merged

feat(eslint): add prefer-info-text lint rule and migrate existing usages#116211
TkDodo merged 22 commits into
masterfrom
tkdodo/feat/eslint-prefer-info-text

Conversation

@TkDodo
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo commented May 26, 2026

Adds a new @sentry/scraps/prefer-info-text ESLint rule that detects <Tooltip> wrapping text-like elements with showUnderline and suggests using <InfoText> instead. The rule ships with an autofix that rewrites simple cases automatically.

Alongside the rule, this PR migrates existing violations across the codebase to use <InfoText> and enhances the InfoText component itself.

InfoText component enhancements

InfoText now accepts a position prop (forwarded to the underlying Tooltip) and a variant prop that controls the underline color to match the text style (e.g. muted text gets a muted underline). variant="inherit" falls back to the default tooltip underline color.

ESLint rule: prefer-info-text

Detects <Tooltip showUnderline> wrapping a single text-like child (intrinsic elements like <span>, <abbr>, <Text>, or i18n calls) and reports with an autofix that rewrites to <InfoText>. The rule is conservative — it skips Tooltips with unsupported props, multiple children, or non-text content.

Codebase migrations

Migrates ~15 files from the manual <Tooltip showUnderline> pattern to <InfoText>, including spend allocations, customer admin views, replay columns, and various settings pages. Also fixes a tooltip on the detectors assignee view that could never actually display, and updates test files to use <button> instead of <span> for tooltip trigger elements (accessibility).


Name Before After
Tooltips hidden behind numbers Screenshot 2026-05-26 at 18 17 36 Underlined text has a tooltip and is keyboard interactive.

Screenshot 2026-05-26 at 18 17 20

Screenshot 2026-05-26 at 18 28 52
Header tooltip visibility Which headers have a tooltip? Impossible to know.

Screenshot 2026-05-22 at 16 12 39
Two out of four headers have a tooltip, which is now clearly visible to users.

Screenshot 2026-05-22 at 16 12 52

Screenshot 2026-05-22 at 16 13 11

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.59%

@TkDodo TkDodo marked this pull request as ready for review May 27, 2026 09:38
@TkDodo TkDodo requested review from a team as code owners May 27, 2026 09:38
@TkDodo TkDodo requested review from a team as code owners May 27, 2026 09:38
Comment thread static/gsApp/components/superuser/superuserWarning.tsx
Comment thread static/eslint/eslintPluginScraps/src/rules/prefer-info-text.ts
Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2ae69a3. Configure here.

'time',
'u',
]);
const TOOLTIP_PROPS_SUPPORTED_BY_INFO_TEXT = new Set(['title', 'showUnderline']);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ESLint rule missing position in supported props set

Low Severity

TOOLTIP_PROPS_SUPPORTED_BY_INFO_TEXT doesn't include position, even though InfoText explicitly declares it in its type (Pick<TooltipProps, 'position'>) and forwards it to the underlying Tooltip. This means a <Tooltip title="x" position="left">text</Tooltip> gets flagged as an error but receives no autofix suggestion, despite the conversion being straightforward and safe. Since isHoverable and skipWrapper are also implicitly handled by InfoText, they could be added to both this set and TOOLTIP_PROPS_TO_STRIP.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ae69a3. Configure here.

@TkDodo TkDodo merged commit e9c3192 into master May 28, 2026
76 checks passed
@TkDodo TkDodo deleted the tkdodo/feat/eslint-prefer-info-text branch May 28, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants