Add ESLint rule to catch broken internal links and standardize on npm

未关闭
#156 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@allgandalf 已经在做这个了。

开始于 2026年2月26日。

  • #157 来自 @allgandalf —— 未关闭
  • #180 来自 @ANAMASGARD —— 未关闭

评估

这个 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
  • onBrokenLinks is set to "ignore" in docusaurus.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

  1. Add ESLint with a custom no-bad-internal-links rule that flags href and to attributes in JSX where:

    • Whitespace in URLs: leading/trailing spaces (e.g. href=" https://...")
    • Relative internal links: missing leading / (e.g. href="gsoc.html" should be href="/gsoc/")
    • .html extensions: Docusaurus uses clean URLs, so .html should not be used
    • Missing trailing slash: internal links should end with /
  2. Add a GitHub Actions workflow so the lint check runs on every PR and push to master.

  3. Fix all existing lint violations across the codebase.

  4. Remove yarn.lock and standardize on npm, consistent with all CI workflows.

主要语言
CSS
星标
7
派生
25
平均合并
3 天 13 小时
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PecanProject/PecanProject.github.io 的其他 Issue

查看 PecanProject/PecanProject.github.io 的全部 Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。