Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 916 Bytes

File metadata and controls

35 lines (21 loc) · 916 Bytes

Linter Rule: No whitespace around = in HTML attributes

Rule: html-attribute-equals-spacing

Description

Disallow whitespace before or after the equals sign (=) for attribute values in HTML. Attributes must follow the canonical format (name="value") with no spaces between the attribute name, the equals sign, or the opening quote.

Rationale

Extra whitespace around the = in HTML attribute assignments is unnecessary, inconsistent, and not idiomatic. While browsers are usually forgiving, it can lead to confusing diffs, poor formatting, or inconsistent parsing in tools.

Examples

✅ Good

<div class="container"></div>
<img src="/logo.png" alt="Logo">
<input type="text" value="<%= @value %>" autocomplete="off">

🚫 Bad

<div class ="container"></div>

<img src= "/logo.png" alt="Logo">

<input  type  =  "text" autocomplete="off">

References

-