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

Preserve single space before self-closing tag

Open MorevM opened this issue 3 years ago • 4 comments
trafficstars

Hello!

I noticed that rule @html-eslint/no-extra-spacing-attrs reports if there a space before self-closing tag.

no-extra-spacing

I think it's more comfortable to be able to customize this behavior. Maybe it's a personal issue, but the rule is in the "style" category, so guess it should be configurable to fit any preferences.

Maybe this can be covered in separate rule because it's also related to this case in terms of style:

no-reports

What do you think? Can we implement it? How can I help?

MorevM avatar Feb 26 '22 11:02 MorevM

@MorevM Thanks for the report. :)

Maybe this can be covered in separate rule

I agree. It would be nice if we can handle it. What about a new general rule no-extra-spacing which check all extra spaces not only around attributes? Then we can deprecate no-extra-spacing-attrs

yeonjuan avatar Feb 27 '22 10:02 yeonjuan

@yeonjuan yes, such new rule looks good to me with parameter { spaceBeforeSelfClosing: boolean } or similar.

  • I'm not familiar with the ESLint API for plugin developers. While this looks interesting to dig into, I'm a little limited on time so I can't seem to get it done before a week or even two if you don't have time to do it before. :)

MorevM avatar Feb 27 '22 11:02 MorevM

@MorevM Sure, :) please let me know if you can't take any time to do it. Then I'll take it. 👍

yeonjuan avatar Feb 27 '22 13:02 yeonjuan

I tried to off this rule by "@html-eslint/no-extra-spacing-attrs": "off",

but it is still report them as errors.

penghouho avatar Mar 21 '22 08:03 penghouho