Eslint-plugin-react: Add rule enforcing `props` are passed to `super` in constructor

Created on 22 Dec 2017  路  3Comments  路  Source: yannickcr/eslint-plugin-react

Following the advice of the React Docs react-component#constructor it would be great if there was an eslint rule that would convert:

constructor(props) {
  super();
  // ....
}

to:

constructor(props) {
  super(props);
  // ....
}

So that we would catch cases where someone tries to use this.props before it is populated. Thank you!

new rule question

Most helpful comment

Looks like a duplicate of #626

All 3 comments

Looks like a duplicate of #626

Has this rule been added?

@joetidee no, see #626.

Was this page helpful?
0 / 5 - 0 ratings