diff --git a/pr_body.md b/pr_body.md new file mode 100644 index 0000000..adbb8e8 --- /dev/null +++ b/pr_body.md @@ -0,0 +1,11 @@ +🎯 **What:** The code health issue addressed +Replaced the plain `` element in `src/components/CardGenerator.tsx` with Next.js's `` component, which is the recommended way to handle images in Next.js applications, resolving an `@next/next/no-img-element` ESLint bypass. + +💡 **Why:** How this improves maintainability +The usage of `` component is a Next.js standard best practice that usually provides automatic optimizations. Although this particular instance requires `unoptimized` because it relies on a local dynamically generated data URL from `html-to-image`, using the uniform standard throughout the application helps remove linting suppression rules, keeping code clean and maintaining consistent components across the codebase. + +✅ **Verification:** How you confirmed the change is safe +Ran the lint check (`npm run lint`), which no longer produces the ESLint warning on `CardGenerator.tsx`. Also ran the full unit test suite (`npm run test`) which executed 100 tests with no failures, verifying that we didn't break anything. + +✨ **Result:** The improvement achieved +A clean resolution to the `@next/next/no-img-element` linting rule in `CardGenerator.tsx` by upgrading it to use the standard `` element from `next/image`. diff --git a/src/components/CardGenerator.tsx b/src/components/CardGenerator.tsx index c663121..58f731c 100644 --- a/src/components/CardGenerator.tsx +++ b/src/components/CardGenerator.tsx @@ -2,6 +2,7 @@ import { useState, useRef, useCallback, useEffect } from "react"; import { createPortal } from "react-dom"; +import Image from "next/image"; import { toPng, toBlob } from "html-to-image"; import type { @@ -394,8 +395,7 @@ export default function CardGenerator({ summary }: Props) {

Generating preview...

) : previewUrl ? ( - // eslint-disable-next-line @next/next/no-img-element -