我有个问题

我的 esLint 规则:
"jsx-a11y/label-has-for": [ 2, {
"components": [],
"required": {
"every": [ "nesting", "id" ]
},
"allowChildren": true
}],
Run Code Online (Sandbox Code Playgroud)
我只想解决这个错误,或者修复,请帮帮我
错误消息:表单标签必须与控件相关联。(jsx-a11y/label-has-related-control)
JSX代码:
<input
type="checkbox"
id="checkbox-2"
className="checkbox__input"
/>
<label
htmlFor="checkbox-2"
className="checkbox__label"
/>
Run Code Online (Sandbox Code Playgroud)