Eslint react / no-typos规则在将属性声明为样式时抛出错误

问题描述 投票:1回答:2

我在响应本机应用程序时遇到问题。我在为我的组件声明样式属性。它看起来像:

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",

谢谢,抱歉我的英语能力。

react-native ecmascript-6 eslint react-proptypes
2个回答
3
投票

您可以尝试使用[email protected]吗?我认为他们修复了与无错字规则相关的一些错误。


0
投票

它是.propTypes,而不是.PropTypes。

© www.soinside.com 2019 - 2024. All rights reserved.