jsx-eslint/eslint-plugin-react

New rule: lifecycle param name

オープン

#2,289 opened on 2019/05/25

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (2,731 件のフォーク)batch import
acceptedhelp wantednew rule

Repository metrics

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

説明

The rule enforces that lifecycle parameter names exactly matches the well known names. For example, a prevProps should not be named as props, because people might confuse it with this.props.

This are considered warnings:

class Foo extends Component {
  componentDidUpdate(props) {}
//                   ~~~~~ Error: should be `prevProps`.
  shouldComponentUpdate(prevProps, nextState) {}
//                      ~~~~~~~~~ Error: should be `nextProps`.
}

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