html-eslint
html-eslint copied to clipboard
[FEATURE] New rule proposal: `no-invalid-entity`
Is your feature request related to a problem? Please describe.
I'd like to propose a new rule called no-invalid-entity.
HTML allows the use of named and numeric character references (entities) such as ,  , or  . However, it's easy to introduce typos like &nbsb; or malformed numeric references like &#zzzz;, which are silently ignored by browsers and can lead to rendering issues or confusion.
correct
<p>< > &    </p>
incorrect
<p>&nbsb;</p> <!-- typo -->
<p>&unknown;</p> <!-- undefined entity -->
<p>&#zzzz;</p> <!-- invalid numeric reference -->
Additional context https://html.spec.whatwg.org/entities.json