jwarby / i18n-lint

`i18n-lint` is a tool for detecting possible hardcoded strings in HTML and HTML-based template source files. It can be used a CLI utility, a library or a Grunt plugin.
http://jwarby.github.io/i18n-lint/
MIT License
50 stars 20 forks source link

Incorrect handling of attributes with a template value #20

Open apoblock opened 3 years ago

apoblock commented 3 years ago

If the attribute has a template value and is followed by other attribute, the linter will get incorrect attribute value. For example following:

<tag attr1={val} attr2="some-other-val" attr3="">...</tag>

when run with --attributes "attr1" --templateDelimiters "{,}", will get attr2="some-other-val" as a value of attr1.

The reason is that the tool internally replaces template code with a space before processing a file what yields something like this:

<tag attr1= attr2="some-other-val" attr3="">...</tag>