43081j / eslint-plugin-lit

lit-html support for ESLint
120 stars 22 forks source link

Ampersand causing false positive #48

Closed krumware closed 5 years ago

krumware commented 5 years ago

(as discussed on slack) A line like this: <st-card name="S&P 500 Index"></st-card>

or

<st-card name="S&amp;P 500 Index"></st-card>

Causes: Attribute values may not contain unencoded HTML entities, e.g. use &gt; instead of >eslint(lit/attribute-value-entities)

43081j commented 5 years ago

The regex is too dumb/catch-all.

we're matching & in &amp; (my own stupidity).

better to do something like /([<>"]|&(?!(#\d+|[a-z]+);))/