react-native - 将属性声明为样式时,Eslint react/no-typos 规则会引发错误
问题描述
我在反应本机应用程序中遇到了 eslint 的问题。我正在为我的组件声明样式属性。看起来像:
Component.propTypes = {
styles: ViewPropTypes.style,
textStyle: Text.propTypes.style,
}
Component.defaultProps = {
styles: null,
textStyle: null,
}
我收到以下 eslint 错误:
295:25 error Typo in declared prop type: style react/no-typos
296:20 error Typo in declared prop type: propTypes react/no-typos
296:30 error Typo in prop type chain qualifier: style react/no-typos
我注意到我正在使用 es6 语法来获取它们。当我使用 es7 时,一切都很好。你能告诉我我做错了什么吗?
我的库版本是:
"prop-types": "15.6.1",
"react": "16.0.0",
"react-native": "0.50.0",
"eslint": "^4.11.0",
"eslint-import-resolver-babel-module": "^4.0.0",
"eslint-plugin-flowtype": "^2.41.0",
"eslint-plugin-import": "^2.11.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "7.9.1",
"eslint-plugin-react-native": "^3.1.0",
感谢并为我的英语水平感到抱歉。
解决方案
您可以尝试使用 eslint-plugin-react@7.10.0 吗?我认为他们修复了一些与无错别字规则相关的错误。
推荐阅读
- java - 无法自动接线。没有JacksonTester的豆子
找到类型 - asp.net-core - WCF 客户端配置 SSL 和 HTTP 选项
- php - 使用通过 ftp 上传的文件创建下载/媒体库
- powershell - 检查powershell字符串是否包含星号
- uninstallation - 由于运行时异常,卸载程序无法正常工作
- angular - 在 Angular + WebAPI 应用程序中管理会话
- c# - AspNetCore Identity 在运行时更新 DbContext
- c++ - 如何使函数参数在 C++ 中以单行方式传递之前和之后执行某些操作
- javascript - 从 AWS S3 到 Node.js 服务器的文件检索,然后到 React 客户端
- r - 与 R 中另一个数据框中的列匹配时替换数据框列中的值