djLint
djLint copied to clipboard
[FEATURE] Linter rule idea: `for` must match `id` in same file
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.