@@ -1439,6 +1439,51 @@ ruleTester.run('no-unused-prop-types', rule, {
1439
1439
'}'
1440
1440
] . join ( '\n' ) ,
1441
1441
parser : 'babel-eslint'
1442
+ } , {
1443
+ // The next two test cases are related to: https://github.com/yannickcr/eslint-plugin-react/issues/1183
1444
+ code : [
1445
+ 'export default function SomeComponent(props) {' ,
1446
+ ' const callback = () => {' ,
1447
+ ' props.a(props.b);' ,
1448
+ ' };' ,
1449
+ '' ,
1450
+ ' const anotherCallback = () => {};' ,
1451
+ '' ,
1452
+ ' return (' ,
1453
+ ' <SomeOtherComponent' ,
1454
+ ' name={props.c}' ,
1455
+ ' callback={callback}' ,
1456
+ ' />' ,
1457
+ ' );' ,
1458
+ '}' ,
1459
+ '' ,
1460
+ 'SomeComponent.propTypes = {' ,
1461
+ ' a: React.PropTypes.func.isRequired,' ,
1462
+ ' b: React.PropTypes.string.isRequired,' ,
1463
+ ' c: React.PropTypes.string.isRequired,' ,
1464
+ '};'
1465
+ ] . join ( '\n' )
1466
+ } , {
1467
+ code : [
1468
+ 'export default function SomeComponent(props) {' ,
1469
+ ' const callback = () => {' ,
1470
+ ' props.a(props.b);' ,
1471
+ ' };' ,
1472
+ '' ,
1473
+ ' return (' ,
1474
+ ' <SomeOtherComponent' ,
1475
+ ' name={props.c}' ,
1476
+ ' callback={callback}' ,
1477
+ ' />' ,
1478
+ ' );' ,
1479
+ '}' ,
1480
+ '' ,
1481
+ 'SomeComponent.propTypes = {' ,
1482
+ ' a: React.PropTypes.func.isRequired,' ,
1483
+ ' b: React.PropTypes.string.isRequired,' ,
1484
+ ' c: React.PropTypes.string.isRequired,' ,
1485
+ '};'
1486
+ ] . join ( '\n' )
1442
1487
}
1443
1488
] ,
1444
1489
0 commit comments