Skip Navigation

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 wrote an ESLint rule to prevent me from forgetting to set the sizes attribute on <Image>s, which results in bigger than required images to be sent to users.

An ESLint rule to require the sizes attribute for Next.js’s <Image>

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
0 comments