Repository navigation
fix(rules): share the LCP candidate finder between lcp rules - #558
Conversation
perf/lcp-hints counted the first three non-lazy images, so small header logos made it warn although the real hero was preloaded. It now uses the same finder as perf/lcp-fetchpriority (skips SVG, header and nav images and images declared under 300px), moved to a shared helper. Preload matching ignores relative versus absolute URL and query string, and reads imagesrcset. Removes the unused validateCWVHints. Updates the rule docs. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review of PR 558 (shared LCP candidate finder). I read the diff and grepped for leftover references. I did not run the tests, and CI was still pending when I checked. The refactor is clean and the new tests cover the reported repro. Findings:
No blocking issues found. |
Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review of #558 (shared LCP candidate finder for lcp-hints and lcp-fetchpriority). The refactor looks sound. I found nothing that should block the merge.
|
Signed-off-by: Nik Cubrilovic <[email protected]>
…ndidates Signed-off-by: Nik Cubrilovic <[email protected]>
|
Review of #558 (shared LCP candidate finder for lcp-hints and lcp-fetchpriority). The refactor is clean and I found no blocking problems.
|
|
Re the two (low) findings: both skipped deliberately. Ignoring the query string in |
|
Review of #558 (shared LCP candidate finder for lcp-hints and lcp-fetchpriority) The refactor looks sound. Both rules now use one finder and one preload matcher, and the tests cover the reporter repro, relative vs absolute URLs, query strings and
|
|
Re the (low) findings on the latest head: skipped deliberately. The |
Closes #516
Summary
perf/lcp-hintstook the first three non-lazy images with no size check, so small header logos made it warn even when the real hero was preloaded. The better candidate finder fromperf/lcp-fetchprioritynow lives inpackages/rules/src/shared/lcp-candidate.tsand both rules use it:headerornav, and images declared under 300px on both sides are not candidates. Images with no declared dimensions stay eligible.imagesrcsetor the image'ssrcsetcounts as preloaded. A preload for another image does not.perf/lcp-hintsstill counts up to three eligible candidates; the count is not capped at 1 here (possible follow-up, per the triage comment).perf/lcp-fetchprioritynow also ignores query string and fragment when matching a preload, since it shares the matcher.validateCWVHints; nothing called it.docs/rules/perf/lcp-hints.mdxdescribes the new candidate rules, andlcp-fetchpriority.mdxnotes the shared finder and matching.The squirrelscan agent skill needs no change: it links to the rule pages, which are the reference.
Verification
bun test tests/rules/lcp-hints.test.tsinapps/cli: 14 pass (reporter repro, no-preload gives 1, undimensioned pair gives 2, absolute-URL, query-string andimagesrcsetpreloads pass, small avatar, SVG logo and header/nav images not counted, both rules agree on the hero)bun test tests/cwv-reuse.test.ts tests/lcp-fetchpriority.test.ts tests/noscript-content.test.tsinpackages/rules: 115 passbun run typecheckinpackages/rulesandapps/cli: cleanmake validateindocs/: all checks passedChecklist
Signed-off-byline (git commit -s).