Vic*_*iro 13 reactjs eslint redux
安装 EsLint 后,我看到的错误之一如下:
Prop spreading is forbiddeneslint(react/jsx-props-no-spreading)
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>]
}]
...
Run Code Online (Sandbox Code Playgroud)
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"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
And here, the code that I currently have:
module.exports = {
extends: "../../.eslintrc.js",
rules: {
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
},
env: {
"jest": true
}
};
Run Code Online (Sandbox Code Playgroud)
At the moment, I just keep giving the same error continuously.
Thank you.
une*_*et7 31
尝试关闭"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
}
};
Run Code Online (Sandbox Code Playgroud)
小智 5
举个例子,如果没有那么多错误,你可以忽略它们
// eslint-disable-next-line
或者你可以写具体的错误,例如
// eslint-disable jsx-props-no-spreading
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21463 次 |
| 最近记录: |