react-doctor/nextjs-no-vercel-og-import
Replace the @vercel/og import with import { ImageResponse } from "next/og"
- Category: Bugs
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: nextjs
- Enabled when: framework=nextjs and capabilities=nextjs
- Tags: test-noise
- Default: Enabled
- Documentation: https://nextjs.org/docs/app/api-reference/functions/image-response
Validate the diagnostic
Confirm the reported code matches this rule before you edit it.
Fires on any ImportDeclaration whose source string literal is exactly "@vercel/og" — the sole predicate is node.source?.value === "@vercel/og", so it matches default, named (ImageResponse), namespace, and side-effect imports alike, regardless of which symbols are pulled in. Because the match is exact equality, the predicate does NOT match a subpath like "@vercel/og/something" or a re-export through a local wrapper module, so those will never be flagged. Real caveat to verify before applying the fix: the detector has no version awareness, so confirm the project is on Next.js 14+ — next/og only exists from Next 14.0.0, where ImageResponse moved there from @vercel/og (on 13.3.x–13.x it lives at next/server, and Next < 13.3 must import @vercel/og directly). Suppress if the project is on Next < 14 and genuinely cannot import from next/og.
How to fix
Follow the rule guidance while preserving unrelated behavior.
Copyable fix prompt
Copy this self-contained prompt into your coding agent after you confirm the diagnostic.
Related rules
More Bugs rules from the rules reference:
react-doctor/no-adjust-state-on-prop-change: Disallow adjusting state in an effect when a prop changes.react-doctor/no-arithmetic-on-optional-chained-operand: Multiplicative math on optional-chained value can be NaNreact-doctor/no-array-find-result-member-access-without-guard: Unguarded member access on find() resultreact-doctor/no-array-index-as-key: Use a stable unique identifier: `key={item.id}` or `key={item.slug}` — index keys break on reorder/filterreact-doctor/no-array-index-deref-without-bounds-or-empty-guard: Array index result dereferenced without a guard