jsx-eslint/eslint-plugin-react

Add prefer-flow-prop-types rule

開放

#1,205 建立於 2017年5月18日

 (3 則留言) (9 個反應) (0 位負責人)JavaScript (2,733 個分叉)batch import
flowhelp wantednew rule

倉庫指標

星標
 (9,293 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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
  };
  // ...
}

貢獻者指南