I have a stateless React component that looks like this:
const propTypes = exact({
fieldId: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
});
function Label({ fieldId, text }) {
return (
<label htmlFor={fieldId}>{text}</label>
);
}
Label.propTypes = propTypes;
I am using eslint extended with the airbnb config. My eslint looks like this:
{
"extends": "airbnb"
}
My React code throws this error:
error Form label must have associated control jsx-a11y/label-has-for
I have clearly set an htmlFor attribute with a valid unique id string (which matches the id on an input elsewhere). Surely this is enough to pass this rule?