Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.04 KB

File metadata and controls

43 lines (25 loc) · 1.04 KB

Linter Rule: Always quote attribute values

Rule: html-attribute-values-require-quotes

Description

Always wrap HTML attribute values in quotes, even when they are technically optional according to the HTML specification.

Rationale

While some attribute values can be written without quotes if they don't contain spaces or special characters, omitting quotes makes the code harder to read, more error-prone, and inconsistent. Always quoting attribute values ensures:

  • consistent appearance across all attributes,
  • fewer surprises when attribute values contain special characters,
  • easier editing and maintenance.

Additionally, always quoting is the common convention in most HTML formatters, linters, and developer tools.

Examples

✅ Good

<div id="hello"></div>

<input type="text">

<a href="/profile">Profile</a>

🚫 Bad

<div id=hello></div>

<input type=text>

<a href=/profile></a>

References