Skip to content

chore(lint): enforce Docusaurus Link and Heading with ESLint - #4830

Merged
thetaPC merged 3 commits into
mainfrom
eslint-link-heading
Nov 6, 2026
Merged

thetaPC merged 3 commits into
mainfrom
eslint-link-heading

Conversation

@thetaPC

@thetaPC thetaPC commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Issue URL: internal

What is the current behavior?

A raw <a> to a page that doesn't exist builds without errors. The build only checks links and anchors that go through Markdown or the Docusaurus Link and Heading components, and nothing stops a raw <a> or <h1> to <h6> from coming back now that #4825 converted them.

What is the new behavior?

  • npm run eslint runs the two rules Docusaurus ships for this, @docusaurus/no-html-links and @docusaurus/prefer-docusaurus-heading, on src/ and the 478 hand-written .mdx pages in docs/ and every version in versions.json
  • CI runs it in the Checks job
  • npm run eslint uses --cache, so a repeat local run takes 0.4s instead of 5s. .eslintcache is gitignored
  • Code samples are exempt: fences, inline code, and playground files in static/ are not linted. Generated native/ and cli/commands/ pages are ignored
  • CONTRIBUTING's Links and Headings section points at the command

Does this introduce a breaking change?

  • Yes
  • No

Other information

package.json overrides @typescript-eslint/utils to v8 for @docusaurus/eslint-plugin. The plugin's 3.x release depends on utils 5, which only accepts ESLint 6 to 8, so npm refuses to install it with ESLint 10. Docusaurus v4 already depends on utils 8, so remove the override when upgrading to Docusaurus v4.

eslint-plugin-mdx needs newer patch and minor versions of 8 shared MDX packages, including remark-mdx 3.0.0 to 3.1.1, which the site's MDX compile also uses. A build of main and of this branch produced identical HTML for all 2,248 pages.

@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Nov 6, 2026 12:59am UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review November 5, 2026 00:24
@thetaPC
thetaPC requested a review from a team as a code owner November 5, 2026 00:24
@thetaPC
thetaPC requested a review from brandyscarney November 5, 2026 00:24

@ShaneK ShaneK left a comment

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.

Looks good to me, great work! 🚀

@thetaPC
thetaPC merged commit f04c928 into main Nov 6, 2026
7 checks passed
@thetaPC
thetaPC deleted the eslint-link-heading branch November 6, 2026 03:54

This branch was successfully deployed

1 active deployment
Preview — 72f1a0f9 Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants