jsx-eslint/eslint-plugin-react

Object composition in propTypes causes 'default-props-match-prop-types' error

オープン

#1,674 opened on 2018/02/02

 (13 件のコメント) (15 件のリアクション) (0 人の担当者)JavaScript (2,731 件のフォーク)batch import
bugenhancementhelp wanted

Repository metrics

Stars
 (9,293 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Consider the following functioning example:

elementEventCardBaseShape = {
  calendarLink: mediaFileShape,
  mapLink: PropTypes.string,
  startDate: PropTypes.string,
  locationName: PropTypes.string,
  street: PropTypes.string,
  city: PropTypes.string,
  region: PropTypes.string
};

ElementEventCard.propTypes = {
  ...elementEventCardBaseShape,
  lang: PropTypes.string
};

ElementEventCard.defaultProps = {
  lang: 'en',
  calendarLink: {},
  mapLink: '',
  startDate: '',
  locationName: '',
  street: '',
  city: '',
  region: ''
};

Where all but 'lang' throw an error for said prop supposedly having no matching propType. Am I missing something?

コントリビューターガイド