jsx-eslint/eslint-plugin-react

Add prefer-flow-prop-types rule

Open

#1,205 创建于 2017年5月18日

在 GitHub 查看
 (3 评论) (9 反应) (0 负责人)JavaScript (8,630 star) (2,797 fork)batch import
flowhelp wantednew rule

描述

I would love a rule for preferring Flow types instead of propTypes. Our team is migrating and it would be great to use the linter for this purpose.

For example, it would produce an error on the following code:

export default class Statements extends React.Component {
  static propTypes = {
    items: PropTypes.array.isRequired,
    fetchStatements: PropTypes.func,
    isLoading: PropTypes.bool
  };
  // ...
}

But this code would remain valid:

export default class Statements extends React.Component {
  props : {
    items: string[],
    fetchStatements?: () => void,
    isLoading?: boolean
  };
  // ...
}

贡献者指南