Skip to content

chore(mdx): 显式豁免 no-img-element,文档图片改为懒加载 - #400

Draft
longsizhuo wants to merge 1 commit into
mainfrom
vibe/wizardly-archimedes-j666nu
Draft

longsizhuo wants to merge 1 commit into
mainfrom
vibe/wizardly-archimedes-j666nu

Conversation

@longsizhuo

Copy link
Copy Markdown
Member

背景

mdx-components.tsx 有一条 eslint warning @next/next/no-img-element,建议改用 next/image。

为什么不换 next/image

  • next.config 里设了 images.unoptimized: true(Vercel 图片优化额度已用完),换成 next/image 也不会有任何优化。
  • 文档里的外链图片没有 width/height(source.config.ts 里 external: false),next/image 会在运行时报错。

所以保留原生 <img>,和仓库里其他 5 处写法一致,用 eslint-disable-next-line 加一行说明。

改动

  • 显式豁免这条 lint 规则,消掉 warning
  • 加 loading="lazy" 和 decoding="async",首屏以外的图片等滚动到了才加载,减少带宽。props 放在后面展开,单张图片仍然可以覆盖这两个属性

验证

  • eslint 对这个文件不再报任何问题;prettier 和 tsc --noEmit 通过
  • pre-commit:vitest 89/89 通过,图片检查和 lockfile 检查通过

🤖 Generated with Claude Code

https://claude.ai/code/session_014zBGrQgQnx1eLA9jQfSJWD


Generated by Claude Code

images.unoptimized=true 下 next/image 不做任何优化,且外链图片缺
width/height 会运行时报错,保留原生 <img>(与仓库其余 5 处一致用
eslint-disable-next-line)。同时加 loading="lazy" / decoding="async",
首屏外图片延迟加载以减少带宽;props 在后展开,个别图片仍可覆盖。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014zBGrQgQnx1eLA9jQfSJWD
@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
involutionhell-github-io Ready Ready Preview Sep 29, 2026 2:28pm UTC
website-preview Ready Ready Preview Sep 29, 2026 2:28pm UTC

This branch was successfully deployed

2 active deployments
Preview – website-preview — 95115183 Deployed Sep 29, 2026 by vercel[bot]
Preview – involutionhell-github-io — 95115183 Deployed Sep 29, 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