在EsLint中禁用“ react / jsx-props-no-spreading” Reactjs中的错误 [英] Disable in EsLint "react / jsx-props-no-spreading" error in Reactjs
问题描述
在安装EsLint之后,出现在我面前的错误之一是:
After installing EsLint one of the errors that appears to me is the following:
禁止传播道具(react / jsx-props -no-spreading)
Prop spreading is forbiddeneslint(react/jsx-props-no-spreading)
我想在EsLint配置中创建规则以忽略此错误,但是我发现的示例不起作用。
I want to create a rule in the EsLint configuration to ignore this error but the examples I found do not work.
以下是创建全局异常的格式:
This is the format to create a global exception:
...
"react/jsx-props-no-spreading": [{
"html": "ignore" / "enforce",
"custom": "ignore" / "enforce",
"exceptions": [<string>]
}]
...
这是在特定文件中创建异常的格式:
And this is the format to create an exception in a specific file:
{
"rules": {...},
"overrides": [
{
"files": ["*-test.js","*.spec.js"],
"rules": {
"no-unused-expressions": "off"
}
}
]
}
在这里,代码t我目前有这顶帽子:
And here, the code that I currently have:
module.exports = {
extends: "../../.eslintrc.js",
rules: {
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
},
env: {
"jest": true
}
};
此刻,我只是不断给出相同的错误。
At the moment, I just keep giving the same error continuously.
谢谢。
推荐答案
尝试关闭 react / jsx- props-no-spreading
规则:
module.exports = {
extends: "../../.eslintrc.js",
rules: {
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
"react/jsx-props-no-spreading": "off",
},
env: {
"jest": true
}
};
这篇关于在EsLint中禁用“ react / jsx-props-no-spreading” Reactjs中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!