Repository navigation
Description
Summary
perf/lcp-hints → check lcp-preload warns "N likely-LCP images loaded without preload" on pages whose actual LCP image is preloaded (<link rel="preload" as="image" fetchpriority="high">). The extra "likely-LCP" candidates are small above-fold images: SVG logos with loading="eager" and 80×80 avatars. On a real site this produced one warning per page on 88 pages, while Lighthouse's lcp-discovery-insight passes all checks there.
Minimal repro
index.html (images are 1×1 PNG / empty SVG placeholders; only the declared sizes matter):
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><title>LCP preload repro page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preload" as="image" href="/hero.png" fetchpriority="high">
</head><body>
<header>``<img src="/logo1.svg" alt="Logo one" width="120" height="40" loading="eager"><img src="/logo2.svg" alt="Logo two" width="120" height="40" loading="eager">``</header>
<main><h1>Repro</h1>
``<img src="/hero.png" alt="Hero" width="1200" height="800" fetchpriority="high">``
``<img src="/avatar1.png" alt="Avatar one" width="80" height="80"><img src="/avatar2.png" alt="Avatar two" width="80" height="80">``
</main></body></html>python3 -m http.server 8765 --bind 127.0.0.1
squirrel audit http://127.0.0.1:8765/ --http -f jsonActual
{"name":"lcp-preload","status":"warn","message":"2 likely-LCP images loaded without preload","affectedPages":["http://127.0.0.1:8765/"]}Expected
No lcp-preload warning: the page's largest above-fold image (1200×800 hero) is preloaded with fetchpriority="high". Only one element can be the LCP; once a preloaded candidate clearly dominates by declared size, smaller images (SVG logos, ≤ ~100×100 avatars/icons) should not count as additional likely-LCP candidates.
Versions
squirrel 0.0.105 (macOS arm64).
Acceptance Criteria
- The issue's repro page produces an
lcp-preloadpass fromperf/lcp-hints - SVG images, images inside
headerornav, and images whose declared width and height are both under 300px are not counted as likely-LCP, the same eligibilityperf/lcp-fetchpriorityuses - Images with no declared dimensions remain eligible
- A preload that differs from the image only by relative versus absolute URL, query string, or that matches through
imagesrcset, counts as preloading that image -
perf/lcp-hintsandperf/lcp-fetchprioritypick the same hero candidate on the same page, from one shared helper - The count is not capped at 1 in this issue (kept as a possible follow-up)
- The unused
validateCWVHintsfunction is removed if nothing calls it -
docs/rules/perf/lcp-hints.mdxdescribes the new candidate rules - Test:
apps/cli/tests/rules/lcp-hints.test.ts, the reporter's repro (two logos, then a preloaded hero): passes - Test: same file, the same page without the hero preload: warns with value 1
- Test: same file, the existing undimensioned two-image case still warns with value 2
- Test: same file, an absolute-URL preload for a relative
src: passes - Test: same file, a preload with a query string and a preload through
imagesrcset: pass - Test: same file, a small avatar image (under 300px declared) before the hero: not counted
- Test: same file, an SVG logo before the hero: not counted
- The PR description states whether the squirrelscan agent skill needs a change (the skill links to the rule pages, which are the reference, so usually none); if it does, a follow-up is filed against squirrelscan/skills
Generated by Claude Code
Activity
nc9 commentedon Oct 7, 2026
Triage notes (maintainer review):
perf/lcp-fetchpriorityalready has a better candidate finder (skips SVG, header and nav images and anything declared under 300px, normalises URLs, reads srcset), so the two LCP rules disagree today. A third copy of the "first three" logic lives inlazy-above-fold. The fix moves the better finder to a shared helper.perf/cwvrule; that function has no callers, so it is dead code and can be removed.fix(rules): share the LCP candidate finder between lcp rules (#558)
nc9 commentedon Oct 8, 2026
Acceptance check against main 1222727:
Ran on a clean main checkout: apps/cli tests/rules/lcp-hints.test.ts; packages/rules tests/cwv-reuse.test.ts, tests/lcp-fetchpriority.test.ts, tests/noscript-content.test.ts, all green.