biome icon indicating copy to clipboard operation
biome copied to clipboard

📎 Implement `noLabelWithoutControl` - `jsx-a11y/label-has-associated-control`

Open Conaclos opened this issue 9 months ago • 5 comments

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

Conaclos avatar Apr 26 '24 13:04 Conaclos

May i try this?

mdm317 avatar May 05 '24 06:05 mdm317

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.

ematipico avatar May 05 '24 07:05 ematipico

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.

mdm317 avatar May 07 '24 10:05 mdm317

Can I get this one? :)

michellocana avatar May 16 '24 11:05 michellocana

This rule also have some options:

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 👀.

michellocana avatar May 16 '24 12:05 michellocana