我正在尝试添加
informed
将包打包到我的项目中,但在添加以下组件时,eslint出现错误:
<Form id="intro-form">
<label htmlFor="intro-name">
First name:
<Text field="name" id="intro-name" />
</label>
<button type="submit">Submit</button>
</Form>
我已经加了
Text
给我的
.eslintrc
controlComponent
但我还是犯了个错误:
eslint] Form label must have ALL of the following types of associated control: nesting, id (jsx-a11y/label-has-for)
我猜这不是把这个加到我的
文件?
{
"rules": {
"jsx-a11y/label-has-associated-control": [ 2, {
"labelComponents": ["label"],
"labelAttributes": ["htmlFor"],
"controlComponents": ["Text"]
}]
},
"parser": "babel-eslint",
"extends": [
"airbnb"
]
}
当我改变
文本
到
input
错误消失了,所以我觉得我误解了这是怎么回事。关于如何允许
文本
输入
?