biome
biome copied to clipboard
📎 Implement `noLabelWithoutControl` - `jsx-a11y/label-has-associated-control`
Description
Implement label-has-associated-control.
Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.
Suggested name: noLabelWithoutControl
May i try this?
One thing we need to deviate from the rule, is to also support the attribute for
.
The attribute htmlFor
is react specific, but we should be more broad because other libraries such as preact and solid support the for
attribute.
Thank you for letting me know.
I looked into applying this rule to preact
and solid
, but it seems too difficult for me to handle.
I'll look for other issues I can contribute to.
Can I get this one? :)
This rule also have some options:
-
labelComponents
- used less than 1k times -
labelAttributes
- used 1.2k times -
controlComponents
- used 1.8k times -
assert
- used 1.8k times, but rarely with a value other than "either", which is the default -
depth
- used 1.2k times
In my opinion we should implement the first 3, because it gives the user more control over cases the rule won't error by default.
The assert
option might not be needed as few people are using it without the default behavior.
I'm not so sure about the depth
option, the original rule accepts a max value of 25
, I don't see too much harm on having this depth by default, but I might be wrong here, let me know 👀.