Skip to content

[FEATURE] Linter rule idea: for must match id in same file #820

@silverwind

Description

@silverwind

Feature Request

A new rule that each for attribute on <label> has a exactly one matching id in the same file would be nice.

Failure:

<label for="wine"></label>
<input id="cheese">
<label for="wine"></label>
<input id="cheese">
<input id="cheese">

Success:

<label for="cheese"></label>
<input id="cheese">

In case elements are spread across multiple files it would produce false-positives, but I think such cases would be rare enough to not present a major issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions