docs-2978: separate link-check skip lists and warn on broken anchors#2839
docs-2978: separate link-check skip lists and warn on broken anchors#2839ctauchen wants to merge 3 commits into
Conversation
Move the crawler skip list and skip-origins list out of __tests__/crawler.test.js, and the default skip and ignore lists out of src/utils/linkChecker.js, into a new shared module src/utils/link-check-config.js. Both files import from it. Pure move, no behavior change: entry counts are unchanged (crawler skip 152, default skip 34, default ignore 3, skip-origins 6). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for calico-docs-preview-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview succeeded!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR centralizes link-checker skip/ignore configuration into a single shared module and tightens Docusaurus build validation by failing on broken anchors, improving maintainability and catching more link quality issues during builds.
Changes:
- Added
src/utils/link-check-config.jsas the single source of truth for link-check skip/ignore lists (engine + crawler). - Updated
src/utils/linkChecker.jsand__tests__/crawler.test.jsto import lists from the new config module. - Switched Docusaurus
onBrokenAnchorsfromignoretothrowto fail builds on broken#anchorreferences.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/utils/linkChecker.js | Uses centralized default skip/ignore lists from the new config module. |
| src/utils/link-check-config.js | New shared module containing engine + crawler skip/ignore/origin lists. |
| tests/crawler.test.js | Imports crawler skip/origin lists from the new shared config instead of inline arrays. |
| docusaurus.config.js | Enforces broken-anchor failures by setting onBrokenAnchors: 'throw'. |
| * This file holds the skip and allow lists that the link checker uses. They used to live inside | ||
| * `src/utils/linkChecker.js` and `__tests__/crawler.test.js`. Keeping them here means one place to | ||
| * edit, review, and comment. |
There was a problem hiding this comment.
Good catch — fixed in 7ea4d41. Reworded the header to "skip and ignore lists"; the per-list descriptions below already name each list correctly.
Set onBrokenAnchors to 'warn' in docusaurus.config.js. A build found 329 broken anchors, so 'throw' would break the build. This surfaces them as build warnings without blocking. Fixing them and switching to 'throw' is tracked in DOCS-2979. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2fa6c94 to
cc7e1c0
Compare
Address Copilot review: the module holds skip and ignore lists, not allow lists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Part of DOCS-2978.
What this does
Two changes to the link checker:
src/utils/link-check-config.js. The lists used to live in two places:__tests__/crawler.test.jsandsrc/utils/linkChecker.js. Now both files import from the new config. The lists are easier to find, edit, and review.onBrokenAnchorsto'warn'indocusaurus.config.js. Broken anchors now show as build warnings instead of being ignored.Why 'warn' and not 'throw'
A build found 329 broken anchors on 219 pages. Setting
'throw'would break the build on the first one.'warn'surfaces them all without blocking. Fixing the anchors and switching to'throw'is tracked in DOCS-2979.Behavior
The list move does not change behavior. Entry counts match
main:The build still succeeds. It now prints anchor warnings.
How to validate
make build && make teston this branch and onmain. TheLINK-CHECK REPORTcounts should match.make buildand confirm it succeeds and prints[WARNING] Docusaurus found broken anchors!with the list.