jsx-eslint/eslint-plugin-react

Add prefer-flow-prop-types rule

Offen

#1.205 geöffnet am 18.05.2017

 (3 Kommentare) (9 Reaktionen) (0 zugewiesene Personen)JavaScript (2.731 Forks)batch import
flowhelp wantednew rule

Repository-Metriken

Stars
 (9.293 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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

Contributor Guide