Skip to content

A rule to identify self-closed tags that shouldn't be #950

@abejfehr

Description

@abejfehr

Is your feature request related to a problem? Please describe.
jQuery recently made a breaking change, detailed here.

The new behaviour is that sibling tags that are self-closing will now contain each other, for example:

<div /><span />

will now become:

<div><span></span></div>

which is pretty unintuitive and requires me to change my Angular templates in many places to no longer have self closing tags.

Describe the solution you'd like

What I'd like is for a rule to warn me about self closed div, span, my-custom-tag tags which are negatively impacted when they're self closed.

There's a rule that's similar to what I want, empty-tag-no-self-closed but it only flags elements I don't care about (i.e. I don't care if a hr, meta, br tag, etc. is self closed or not, since they can't have children).

Describe alternatives you've considered
I was thinking of making my own rule by forking empty-tag-no-self-closed, or maybe there's a way it could be configured to target specific elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot:staleIssue marked as stale because there was no activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions