Add ESLint rule to catch broken internal links and standardize on npm
評估
這個 Issue 還沒有評估資料。
描述
Problem
Internal links in JSX pages are prone to formatting bugs that break navigation. For example, PR #155 fixed links in gsoc.js where relative paths like href="gsoc_ideas" and href="gsoc_ideas.html" were used instead of the correct absolute path href="/gsoc_ideas/".
The same class of issues still exists in other files (e.g. news.js has href="gsoc.html" and URLs with leading whitespace like href=" https://...").
Currently nothing catches these at development time because:
- The project has no linting setup
onBrokenLinksis set to"ignore"indocusaurus.config.js
Additionally, the project has both a yarn.lock and package-lock.json even though CI exclusively uses npm, which causes confusion.
Proposed Solution
-
Add ESLint with a custom
no-bad-internal-linksrule that flagshrefandtoattributes in JSX where:- Whitespace in URLs: leading/trailing spaces (e.g.
href=" https://...") - Relative internal links: missing leading
/(e.g.href="gsoc.html"should behref="/gsoc/") .htmlextensions: Docusaurus uses clean URLs, so.htmlshould not be used- Missing trailing slash: internal links should end with
/
- Whitespace in URLs: leading/trailing spaces (e.g.
-
Add a GitHub Actions workflow so the lint check runs on every PR and push to master.
-
Fix all existing lint violations across the codebase.
-
Remove
yarn.lockand standardize on npm, consistent with all CI workflows.
- 主要語言
- CSS
- 星號
- 7
- 分支
- 25
- 平均合併
- 3 天 13 小時
- 30 天內合併 PR
- 2
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
PecanProject/PecanProject.github.io 的其他 Issue
-
Reloading /package-documentation/ shows pkgdown README instead of version chooser可能已有人在做 @ANAMASGARD 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 77/100
PecanProject/PecanProject.github.io#206 · 1 則留言 ·
-
Add lychee GitHub action to automatically check for broken links可能已有人在做 @Avneetsingh18-doit 於 261 天前認領。 未關閉good first issue
PecanProject/PecanProject.github.io#134 · 8 則留言 · 1 個 reaction · 已指派 1 人 ·
-
Enhance Site Navigation: Add Search Bar to Navbar可能已有人在做 @divine7022 於 653 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 25/100
PecanProject/PecanProject.github.io#90 · 23 則留言 ·