Skip to content
Sarj Code Standards

no-invalid-web-resource-hints

Keep native resource hints consistent with browser loading and preload request modes.

Why

Lazy loading delays even explicitly high-priority images until layout. Font preloads with incompatible credentials modes cannot satisfy the subsequent font request. The unsupported loading=auto value and obsolete importance attribute do not express supported native loading behavior. Oxlint 1.91 still accepts importance, so this advisory fills that verified upstream gap.

Fix

Review whether the image is critical or offscreen, use the matching loading policy, specify the preload destination, and use anonymous CORS for font preloads. Do not change request behavior automatically.

Examples

Before — flagged Review a non-reusable font preload
src/view.tsx
<link rel="preload" as="font" href="/font.woff2" />;
After — preferred Match the font request mode
src/view.tsx
<link rel="preload" as="font" href="/font.woff2" crossOrigin="anonymous" />;
Before — flagged Review conflicting image hints
src/view.tsx
<img loading="lazy" fetchPriority="high" />;
After — preferred Load a declared critical image eagerly
src/view.tsx
<img loading="eager" fetchPriority="high" />;

References