Skip to content

ref(eslint): bolster restrict-jsx-slot-children's getDisplayName#109725

Merged
JoshuaKGoldberg merged 1 commit intomasterfrom
eslint-restrict-jsx-slot-children-no-as
Mar 2, 2026
Merged

ref(eslint): bolster restrict-jsx-slot-children's getDisplayName#109725
JoshuaKGoldberg merged 1 commit intomasterfrom
eslint-restrict-jsx-slot-children-no-as

Conversation

@JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 2, 2026

Followup to #109310: modifies the logic in restrict-jsx-slot-children to:

  • Behavior: handle namespaces and property accesses for JSX tags
  • Internal: unified getDisplayName and the ad hoc stringification in the JSXAttribute visitor

I split this out into its own PR because the way I wrote getDisplayName triggered some reports from ESLint that I wanted to ask about.

Fixes https://linear.app/getsentry/issue/ENG-6933/followup-refactor-restrict-jsx-slot-childrens-getdisplayname

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 2, 2026
Comment on lines +111 to +113
// eslint-disable-next-line consistent-return
function getDisplayName(node: TSESTree.JSXTagNameExpression): string {
// eslint-disable-next-line default-case
Copy link
Member Author

@JoshuaKGoldberg JoshuaKGoldberg Mar 2, 2026

Choose a reason for hiding this comment

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

@natemoo-re are these lint rules a team opinion? It's been a while since I've worked in a TypeScript-y codebase -especially lint areas- that had them enabled.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the lint rules represent the team opinion/house style! Most of these decisions predate me, but we are positioned to lean in on the more opinionated rules with agentic workflows.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok cool! I'll try them out for a bit and update the PR to work with them.

For context, these two rules specifically are ones I've avoided because they cause false reports with TypeScript. I think they aren't necessary with types + @typescript-eslint/switch-exhaustiveness-check. But I haven't validated that in a while. This'll be a good excuse to 👍

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I did not know that! I'm fairly sure a lot of these decisions predate the Sentry codebase being written in TypeScript, fwiw. Type-aware linting was only enabled about a year ago 🙃

Copy link
Member Author

Choose a reason for hiding this comment

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

I filed #109743 just to play with them. If nothing comes up in a few days I think I'll try to suggest that as a tooling fix.

Comment on lines +111 to +113
// eslint-disable-next-line consistent-return
function getDisplayName(node: TSESTree.JSXTagNameExpression): string {
// eslint-disable-next-line default-case
Copy link
Member

Choose a reason for hiding this comment

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

Yes, the lint rules represent the team opinion/house style! Most of these decisions predate me, but we are positioned to lean in on the more opinionated rules with agentic workflows.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review March 2, 2026 21:57
@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team as a code owner March 2, 2026 21:57
@JoshuaKGoldberg JoshuaKGoldberg force-pushed the eslint-restrict-jsx-slot-children-no-as branch from 07bb4dd to 69107cf Compare March 2, 2026 21:57
@linear
Copy link

linear bot commented Mar 2, 2026

@JoshuaKGoldberg JoshuaKGoldberg merged commit 0a927b9 into master Mar 2, 2026
62 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the eslint-restrict-jsx-slot-children-no-as branch March 2, 2026 22:45
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