Skip to content

Linter: html-no-self-closing is flagging elements within <svg> element #415

@marcoroth

Description

@marcoroth

I noticed the new rule introduced #407 is flagging elements within <svg> elements. Since SVGs are usually just copy-pasted I'm not sure if it really makes sense to flag them too. On the other hand, if they are inlined in HTML+ERB files they might as well follow the same formatting style.

<div class="flex items-center text-xs text-gray-500 mt-1">
  <svg class="w-3 h-3 mr-1 fill-gray-400" viewBox="0 0 24 24">
    <path
      d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2
.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"
    />
  </svg>
</div>
Self-closing syntax `<path />` is not allowed in HTML. Use `<path></path>` instead. (html-no-self-closing)

From RubyEvents

Playground:
https://herb-tools.dev/playground?tab=diagnostics&diagnosticsFilter=linter#DwEwlgbgBAxgNgQwM5ILwCIBmcCmAPKMAFxwFskBaGHAOxICcoS8iK8kn9WBzehATwoBWAAwiopVgEZ0APgBQUKMCQRusRCgwB3CgGYoAC30T6FKVExg4cCrwEUALGPRQIYHNoBCAezwZxcQAmRygQuUUlZQAHBCJDSKioEAwAWSkgsIBhAA4AOikDTKEoIQKDEoBOGHEyoJKAdihCqCbCpAaKBryGxvM9Gv08nM69cq6JhoAvUnFKvKEYczy9HKgRCiD5BeWMzZ2ghaQpAqD9ksOhc7CF5tObi52TjIfry6n0RKgAegUlYG+qm4CgB4AgsiAA

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglinter

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions