Eslint-plugin-react: react/no-unused-prop-types Not working for destructed argument props in getDerivedStateFromProps

Created on 26 Jun 2018  路  2Comments  路  Source: yannickcr/eslint-plugin-react

class MyComp {
  static propTypes = {
    myProp: PropTypes.any
  };

  static getDerivedStateFromProps({ myProp }) {
    return { 
      myStateProp: myProp.something 
    };
  }
}

The following code gives me:
[eslint] 'myProp' PropType is defined but prop is never used
Tested with v7.9.1

bug help wanted

Most helpful comment

@hornta ah, have you specified your react version in your settings? gDSFP only applies in react 16.3+

All 2 comments

Wasn't able to reproduce this on 7.9.1 or latest master 馃

@hornta ah, have you specified your react version in your settings? gDSFP only applies in react 16.3+

Was this page helpful?
0 / 5 - 0 ratings