[英]eslint plugin fp, jest and react testing library causes unwanted linting errors
I installed the plugin eslint-plugin-fp
to help me write better code. 我安装了
eslint-plugin-fp
以帮助我编写更好的代码。 I'm writing a React app. 我正在写一个React应用程序。 I do TDD writing my tests with Jest and react-testing-library.
我使用Test和Jest和react-testing-library编写测试。
The problem that I have is that the plugin throws a lot of errors in the test files because describe
doesn't return anything. 我的问题是,该插件在测试文件中引发了很多错误,因为
describe
不返回任何内容。
How can you use that plugin in conjunction with tests? 如何将该插件与测试结合使用?
This isn't a great solution, but personally I would put an .eslintrc.json
file in the test directory or directories that overrides the parent configuration to disable those rules, eg: 这不是一个很好的解决方案,但是我个人将
.eslintrc.json
文件放在一个或多个覆盖父配置的测试目录中以禁用这些规则,例如:
{
"rules": {
"fp/no-nil": "off",
"fp/no-unused-expression": "off"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.