jsx-eslint/eslint-plugin-react

Allow prop-types rule to skip non-exported SFCs

开放

#494 创建于 2016年3月9日

 (20 条评论) (5 个反应) (0 位负责人)JavaScript (2,731 个派生)batch import
help wantednew rule

仓库指标

星标
 (9,293 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

From the docs:

For now we should detect components created with:

  • React.createClass()
  • an ES6 class that inherit from React.Component or Component
  • a stateless function that return JSX or the result of a React.createElement call.

It would be great if we could enforce propTypes being defined on React.createClass() and React.Component-extended components, but not stateless functions which return JSX.

In fact, defining .propTypes in function use such as { arr.map((name, i) => <Row key={ i }>{ name }</Row>) } would increase verbosity considerably

贡献者指南