html-eslint icon indicating copy to clipboard operation
html-eslint copied to clipboard

Option to allow any element as self-closing

Open sergey-v9 opened this issue 3 years ago • 1 comments

I am trying to adopt your linter in our project to validate small HTML-like template files and found that it has no option to allow any element to be self-closing. I khow it is a non-standard HTML syntax (more like an XML Empty-element tags), but this is what we have in our templates.

Would you mind adding a way to solve this? Maybe another option for the require-closing-tags rule in addition to selfClosing? Or do you prefer to stick with HTML standard syntax?

playground example with warning

<div>
    <custom-tag />
    <div>
    </div>
</div>

sergey-v9 avatar Jun 04 '22 22:06 sergey-v9

@sergey-v9 Hi, Thanks for the new issue. I agree about the feature but it's hard to implement it quickly. Our parser follows standard HTML syntax which does not allow self-closing for custom elements so it's hard to handle at the linter level.

P.S. For solving these kinds of problems, I'm developing a new HTML parser that relaxes some restrictions. (https://github.com/yeonjuan/sa-html-parser).

yeonjuan avatar Jun 05 '22 06:06 yeonjuan