我们有严格的零 Lint 问题政策。这意味着需要修复所有错误和警告。
在我们的 React typescript 项目中面对这个 lint 错误:
warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
在 Google 和 lint 网站上搜索。我没有找到这样的解决方案!
试过这个:
// eslint:@typescript-eslint/no-explicit-any: "off"
这不起作用有谁知道如何绕过这个
eslint
React typescript 项目中的规则?
最佳答案
在尝试绕过相同的规则时对我有用的东西,特别是对于重载方法是使用:// eslint-disable-next-line
如果您可以简单地在问题行的正上方添加评论。
或者您可以通过以下方式忽略代码的一部分的规则/* eslint-disable rule-name */ your-block-of-code /* eslint-enable rule-name */
这里的注释必须是块注释。
关于typescript - 如何绕过警告 Unexpected any。指定不同的类型 @typescript-eslint/no-explicit-any,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58467000/