@@ -1382,6 +1382,33 @@ ruleTester.run('no-unused-prop-types', rule, {
13821382      ] . join ( '\n' ) , 
13831383      parser : 'babel-eslint' , 
13841384      parserOptions : parserOptions 
1385+     } ,  { 
1386+       // Destructured state props in `componentDidUpdate` [Issue #825] 
1387+       code : [ 
1388+         'class Hello extends Component {' , 
1389+         '  static propTypes = {' , 
1390+         '    something: PropTypes.bool' , 
1391+         '  }' , 
1392+         '  componentDidUpdate ({something}, {state1, state2}) {' , 
1393+         '    return something;' , 
1394+         '  }' , 
1395+         '}' 
1396+       ] . join ( '\n' ) , 
1397+       parser : 'babel-eslint' , 
1398+       parserOptions : parserOptions 
1399+     } ,  { 
1400+       // Destructured state props in `componentDidUpdate` without custom parser [Issue #825] 
1401+       code : [ 
1402+         'var Hello = React.Component({' , 
1403+         '  propTypes: {' , 
1404+         '    something: PropTypes.bool' , 
1405+         '  },' , 
1406+         '  componentDidUpdate: function ({something}, {state1, state2}) {' , 
1407+         '    return something;' , 
1408+         '  }' , 
1409+         '});' 
1410+       ] . join ( '\n' ) , 
1411+       parserOptions : parserOptions 
13851412    } 
13861413  ] , 
13871414
@@ -2337,6 +2364,41 @@ ruleTester.run('no-unused-prop-types', rule, {
23372364        line : 3 , 
23382365        column : 13 
23392366      } ] 
2367+     } ,  { 
2368+       code : [ 
2369+         'class Hello extends Component {' , 
2370+         '  static propTypes = {' , 
2371+         '    something: PropTypes.bool' , 
2372+         '  }' , 
2373+         '  componentDidUpdate (prevProps, {state1, state2}) {' , 
2374+         '    return something;' , 
2375+         '  }' , 
2376+         '}' 
2377+       ] . join ( '\n' ) , 
2378+       parser : 'babel-eslint' , 
2379+       parserOptions : parserOptions , 
2380+       errors : [ { 
2381+         message : '\'something\' PropType is defined but prop is never used' , 
2382+         line : 3 , 
2383+         column : 16 
2384+       } ] 
2385+     } ,  { 
2386+       code : [ 
2387+         'var Hello = React.createClass({' , 
2388+         '  propTypes: {' , 
2389+         '    something: PropTypes.bool' , 
2390+         '  },' , 
2391+         '  componentDidUpdate: function (prevProps, {state1, state2}) {' , 
2392+         '    return something;' , 
2393+         '  }' , 
2394+         '})' 
2395+       ] . join ( '\n' ) , 
2396+       parserOptions : parserOptions , 
2397+       errors : [ { 
2398+         message : '\'something\' PropType is defined but prop is never used' , 
2399+         line : 3 , 
2400+         column : 16 
2401+       } ] 
23402402    } /* , { 
23412403      // Enable this when the following issue is fixed 
23422404      // https://github.com/yannickcr/eslint-plugin-react/issues/296 
0 commit comments