Open
Description
Hey there!
In our codebase we have a global translation function that is shared around components. When using label-has-associated-control
the linter doesn't seem to be able to determine what that function returns and assumes that it could be an input. Is there a way to add an option for translationFunctions
or similar, where a function name could be passed?
Example
// rule config
'jsx-a11y/label-has-associated-control': [
'error',
{
assert: 'either',
}
],
// t() is a global function that returns a translation string
<label>
{t('some.translation')}
</label>
<input type="text" id="id" />
The above JSX won't fail the rule, even though there isn't an htmlFor
attribute and there isn't a nested input in the label.
Thanks!