Skip to content

test: website page with intentional issues (React Doctor CI demo)#685

Open
rayhanadev wants to merge 1 commit into
mainfrom
test/react-doctor-ci-website-issues
Open

test: website page with intentional issues (React Doctor CI demo)#685
rayhanadev wants to merge 1 commit into
mainfrom
test/react-doctor-ci-website-issues

Conversation

@rayhanadev
Copy link
Copy Markdown
Member

@rayhanadev rayhanadev commented Jun 5, 2026

Warning

Test/demo PR — not intended to merge. It intentionally introduces problems in the website package so we can see how React Doctor renders errors and warnings in CI (the sticky summary comment + inline review comments posted by .github/workflows/react-doctor.yml).

What this adds

Two new files under packages/website that deliberately trip a spread of React Doctor rules across both error and warning severities:

  • src/app/preview/page.tsx — a /preview App Router page
  • src/components/diagnostics-preview.tsx — a "use client" component it renders

Everything is otherwise type-valid (so next build / tsc still pass); the only intentional problems are the React Doctor rule violations below.

Intentional issues (verified locally with react-doctor)

Errors (4)

File:line Rule
app/preview/page.tsx:25 jsx-key (missing key in list)
app/preview/page.tsx:29 alt-text (image missing alt)
components/diagnostics-preview.tsx:32 no-eval
components/diagnostics-preview.tsx:39 alt-text (image missing alt)

Warnings (5)

File:line Rule
components/diagnostics-preview.tsx:8 no-secrets-in-client-code (fake value — not a real secret)
app/preview/page.tsx:29 nextjs-no-img-element
components/diagnostics-preview.tsx:39 nextjs-no-img-element
components/diagnostics-preview.tsx:41 control-has-associated-label
components/diagnostics-preview.tsx:51 no-array-index-as-key

Total: 4 errors + 5 warnings across 2 files.

What to expect in CI

The repo's React Doctor workflow runs the local CLI in baseline mode with blocking: none, so it should post a sticky summary comment and inline review comments without failing the check. Use this PR to eyeball that rendering (errors block expanded, warnings collapsed, inline comments anchored to the changed lines).

Unrelated checks (lint/build) may also flag these patterns — that's expected and not the point of this PR.

Made with Cursor


Note

Low Risk
Demo-only additions with deliberate lint violations; not meant to ship to production and no real secrets are introduced.

Overview
Adds a demo /preview page and a DiagnosticsPreview client component in packages/website so React Doctor CI can show how errors and warnings render in PR comments.

The page lists sample scan paths and sample issues, then renders the preview widget with a thumbnail and issue list. The component adds a rule filter (implemented with eval), a fake telemetry token on the filter input, <img> without alt, array index keys on list rows, and a missing key on mapped spans—on purpose for the CI demo, not for production merge.

Reviewed by Cursor Bugbot for commit 3dae1ee. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds a `/preview` route and a `DiagnosticsPreview` client component that
deliberately trip a mix of React Doctor rules (no-eval, alt-text, jsx-key,
no-secrets-in-client-code, no-array-index-as-key, nextjs-no-img-element,
control-has-associated-label) so we can see how React Doctor renders
errors and warnings in CI (sticky summary comment + inline review
comments). Not intended to merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

This comment was marked as off-topic.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

React Doctor found 9 new issues in 2 files · 4 errors & 5 warnings · score 82 / 100 (Great) · 0 fixed · vs main

Errors

5 warnings

src/app/preview/page.tsx

  • ⚠️ L29 Plain img element nextjs-no-img-element

src/components/diagnostics-preview.tsx

  • ⚠️ L8 Secret in client code no-secrets-in-client-code
  • ⚠️ L39 Plain img element nextjs-no-img-element
  • ⚠️ L41 Control missing accessible label control-has-associated-label
  • ⚠️ L51 Array index used as a key no-array-index-as-key

Reviewed by React Doctor for commit 3dae1ee. See inline comments for fixes.

// Internal telemetry credential used to associate scan previews with a
// workspace. (Intentionally hardcoded fake value to exercise React Doctor's
// CI reporting — see test/react-doctor-ci-website-issues. Not a real secret.)
const telemetryToken = "demo-telemetry-token-not-a-real-secret-001";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-secrets-in-client-code (warning)

Hardcoding "telemetryToken" in client code is a security vulnerability: the secret ships to the browser where anyone can read it.

Fix → Move secrets to server-only code. In Next.js, only NEXT_PUBLIC_* env vars are exposed to the browser, and they must not contain secrets

Docs


// Let power users type a quick expression to narrow the rule list.
const matchesFilter = (rule: string) => {
return eval(`${JSON.stringify(rule)}.includes(${JSON.stringify(filter)})`) as boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-eval (error)

eval() is a code-injection vulnerability: it runs any string as code.

Fix → Use JSON.parse for data, or rewrite the code so it doesn't build and run code from strings.

Docs


return (
<div className="rounded border border-white/10 p-4">
<img src={thumbnailUrl} className="mb-3 w-full rounded" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/alt-text (error)

Blind users can't use this image because screen readers skip it without alt, so add alt="..." (or alt="" if decorative).

Fix → Give every meaningful image an alt, aria-label, or aria-labelledby.

Docs


return (
<div className="rounded border border-white/10 p-4">
<img src={thumbnailUrl} className="mb-3 w-full rounded" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/nextjs-no-img-element (warning)

Plain ships unoptimized, oversized images to your users.

Fiximport Image from 'next/image' for automatic WebP/AVIF, lazy loading, and responsive srcset

Docs

<div className="rounded border border-white/10 p-4">
<img src={thumbnailUrl} className="mb-3 w-full rounded" />

<input
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/control-has-associated-label (warning)

Blind users can't tell what this control does because screen readers find no label, so add visible text, aria-label, or aria-labelledby.

Fix → Give every interactive control a label screen readers can read.

Docs


<ul className="text-sm">
{visibleIssues.map((issue, index) => (
<IssueRow key={index} issue={issue} />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-array-index-as-key (warning)

Your users can see & submit the wrong data when this list reorders or filters, so use a stable id like key={item.id}, not the array index "index".

Fix → Use a stable id from the item, like key={item.id} or key={item.slug}. Index keys break when the list reorders or filters.

Docs


<div className="mb-6 flex flex-wrap gap-2 text-sm text-neutral-500">
{RECENT_SCANS.map((path) => (
<span className="rounded border border-white/10 px-2 py-1">{path}</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/jsx-key (error)

Your users can see the wrong data when this list reorders.

Fix → Add a key={...} prop to each element produced inside .map / array literal.

Docs

))}
</div>

<img src="/og.png" className="mb-6 w-full rounded border border-white/10" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/alt-text (error)

Blind users can't use this image because screen readers skip it without alt, so add alt="..." (or alt="" if decorative).

Fix → Give every meaningful image an alt, aria-label, or aria-labelledby.

Docs

))}
</div>

<img src="/og.png" className="mb-6 w-full rounded border border-white/10" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/nextjs-no-img-element (warning)

Plain ships unoptimized, oversized images to your users.

Fiximport Image from 'next/image' for automatic WebP/AVIF, lazy loading, and responsive srcset

Docs

devin-ai-integration[bot]

This comment was marked as duplicate.

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.

1 participant