programming.dev
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
BlackEco@lemmy.blackeco.com to Next.js · 2 years ago

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

axel.leroy.sh

external-link
message-square
0
link
fedilink
  • cross-posted to:
  • react
0
external-link

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

axel.leroy.sh

BlackEco@lemmy.blackeco.com to Next.js · 2 years ago
message-square
0
link
fedilink
  • cross-posted to:
  • react
I forgot to set the sizes attribute on 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.

alert-triangle
You must log in or # to comment.

Next.js

nextjs

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

A community for discussing and posting things relating to the next.js framework

Looking for mods, if you want to mod the community feel free to dm Ategon

https://nextjs.org/

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 2 users / day
  • 3 users / week
  • 3 users / month
  • 13 users / 6 months
  • 19 local subscribers
  • 100 subscribers
  • 14 Posts
  • 3 Comments
  • Modlog
  • mods:
  • Vacant
  • BE: 0.19.13
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org