GeezerVison is showing github.com — chore(mdx): 显式豁免 no-img-element,文档图片改为懒加载 by longsizhuo · Pull Request #400 · InvolutionHell/involutionhell
Conversation
背景
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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
vercel
Bot
commented
Sep 29, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch was successfully deployed
2 active
deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.