An ESLint rule to require the sizes attribute for Next.js’s <Image>
An ESLint rule to require the sizes attribute for Next.js’s <Image>
axel.leroy.sh An ESLint rule to require the sizes attribute for Next.js’s <Image>
I forgot to set the sizes attribute on <Image>s, resulting in bigger than required images to be sent to users. This led me to write an ESLint rule to prevent this issue from happening again.
cross-posted from: https://lemmy.blackeco.com/post/863915
The article mentions Next.js but it also applies to vanilla React as the
sizes
attribute is useful even outside Next's<Image>
component.
0
comments