Skip to content

Use Link instead of ExternalLink#48529

Merged
tbradsha merged 14 commits intotrunkfrom
update/eslint/use_wp_recommended_components_link_instead_of_external_link
May 6, 2026
Merged

Use Link instead of ExternalLink#48529
tbradsha merged 14 commits intotrunkfrom
update/eslint/use_wp_recommended_components_link_instead_of_external_link

Conversation

@tbradsha
Copy link
Copy Markdown
Contributor

@tbradsha tbradsha commented May 5, 2026

Proposed changes

The new @wordpress/use-recommended-components ESLint rule nudges people to use the Link component from @wordpress/ui instead of the ExternalLink component from @wordpress/components.

It should be a drop-in replacement with a openInNewTab prop. Styles are intended to be on par (WordPress/gutenberg#77790).

This was mostly straightforward, but a few additional tweaks were required to make CI happy:

  • Translations don't play friendly with the default Webpack configs, so I had to enable BundledWpPkgsTranspileRules() in several projects.
  • There were two local component name conflicts I adjusted: 25d05ee and 3493131
  • ai-chat was trying to bundle react as a dependency, so I switched that to a normal <a>: 41a1b2f
  • There was a TextLinkTextspan wrapper making linters unhappy, so I removed the inner Text and changed the outer Text to use its variant: f54678e
  • The above required a snapshot update: ec26b3d

Related product discussion/links

Does this pull request change what data or activity we track or use?

Testing instructions

Along with smoke testing, I'd suggest reviewing code by commit in the following order:

  1. Normal changes: bd50c86
  2. Docs, tests, and createInterpolateElement(): 6f9fc0b
  3. Go through the "additional tweaks" listed earlier.

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 5, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/modules/subscriptions/newsletter-widget/src/components/dashboard-link.tsx 10/10 (100.00%) 0.00% 0 💚

Full summary · PHP report · JS report

@tbradsha tbradsha force-pushed the update/eslint/use_wp_recommended_components_link_instead_of_external_link branch from 816e512 to 7c26d55 Compare May 5, 2026 16:40
@tbradsha tbradsha added the DO NOT MERGE don't merge it! label May 5, 2026
@tbradsha tbradsha requested a review from a team May 5, 2026 18:03
@simison
Copy link
Copy Markdown
Member

simison commented May 5, 2026

Yep 👍 This will mostly just need cursory smoke testing since the components are so similar.

I have a bit deeper-going PR to swap usage in Forms: #48407

@tbradsha tbradsha marked this pull request as ready for review May 5, 2026 19:48
@tbradsha tbradsha requested a review from a team as a code owner May 5, 2026 19:48
@tbradsha tbradsha removed the DO NOT MERGE don't merge it! label May 5, 2026
CGastrell
CGastrell previously approved these changes May 6, 2026
Copy link
Copy Markdown
Contributor

@CGastrell CGastrell left a comment

Choose a reason for hiding this comment

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

There is disparity with the styles, but it's acceptable. Checked some places to use as sample, didn't test them all. Code looks good :shipit:

Copy link
Copy Markdown
Contributor

@CGastrell CGastrell left a comment

Choose a reason for hiding this comment

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

LGTM!

@tbradsha tbradsha merged commit 8314507 into trunk May 6, 2026
119 of 121 checks passed
@tbradsha tbradsha deleted the update/eslint/use_wp_recommended_components_link_instead_of_external_link branch May 6, 2026 15:51
@github-actions github-actions Bot removed [Status] In Progress [Status] Needs Review This PR is ready for review. labels May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu [Block] Ad [Block] AI Assistant [Block] AI Chat [Block] Blog Stats [Block] Calendly [Block] Contact Form [Block] Donations [Block] Eventbrite [Block] Google Calendar [Block] Google Docs Embed [Block] Latest Instagram Posts [Block] Like [Block] Mailchimp [Block] Map [Block] OpenTable [Block] Podcast Player [Block] Related Posts [Block] Subscriptions [Block] Top Posts [Block] VideoPress Docs [Extension] AI Assistant Plugin [Extension] AI Content Lens [Extension] Likes [Extension] Payments [Extension] SEO [Extension] Sharing Block editor plugin [Feature] Contact Form [Feature] Publicize Now Jetpack Social, auto-sharing [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [JS Package] AI Client [JS Package] Components [JS Package] Connection [JS Package] Licensing [JS Package] Shared Extension Utils [mu wpcom Feature] Replace Site Visibility [Package] Activity Log [Package] Backup [Package] Forms [Package] Jetpack mu wpcom WordPress.com Features [Package] My Jetpack [Package] Newsletter [Package] Paypal Payments [Package] Publicize [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] VideoPress [Package] Yoast Promo [Plugin] Automattic For Agencies Client [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. RNA [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants