Skip to content

Rule proposal: vue/img-layout-shift #2148

Open
@ahnpnl

Description

@ahnpnl

Please describe what the rule should do:

Inspired by https://github.com/mizdra/eslint-plugin-layout-shift and recently, the topic about image optimization gets more popular. One of the easiest ways to help developers to achieve such thing is providing height and width attribute to img tag. The rule will help the developers to follow one of the best practices about image optimization.

This rule should be added to recommended and strict presets too.

What category should the rule belong to?

[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

<template>
      <!-- GOOD -->
      <img alt="some text" height="10" width="10" src="<img_source>">

      <!-- BAD -->
      <img alt="some text" src="<img_source>">
</template>

Additional context

N.A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions