Incomprehensible ESlint warning about self-closing HTML void element

Viewed 6064

In my Vue project I have the following element:

<img
  class="header__branding__logo"
  src="@/assets/img/logo_desktop.svg"
/>

It is self-closing. Yet, ESlint throws this warning:

Disallow self-closing on HTML void elements (<img/>)  vue/html-self-closing

Doesn't make any sense to me, am I missing something? What's the problem?

1 Answers

Your linter is just following the coding style you have configured it to follow. Your HTML is not invalid (although the / is considered unnecessary), but you have your linter configured to disallow that / on self-closing HTML tags, so that is why it is bringing it to your attention with a warning.

Related