@@ -846,6 +846,29 @@ ruleTester.run('prop-types', rule, {
846846 'module.exports = HelloComponent();'
847847 ] . join ( '\n' ) ,
848848 parser : 'babel-eslint'
849+ } , {
850+ code : [
851+ 'class DynamicHello extends Component {' ,
852+ ' render() {' ,
853+ ' const {firstname} = this.props;' ,
854+ ' class Hello extends Component {' ,
855+ ' render() {' ,
856+ ' const {name} = this.props;' ,
857+ ' return <div>Hello {name}</div>;' ,
858+ ' }' ,
859+ ' }' ,
860+ ' Hello.propTypes = {' ,
861+ ' name: PropTypes.string' ,
862+ ' };' ,
863+ ' Hello = connectReduxForm({name: firstname})(Hello);' ,
864+ ' return <Hello />;' ,
865+ ' }' ,
866+ '}' ,
867+ 'DynamicHello.propTypes = {' ,
868+ ' firstname: PropTypes.string,' ,
869+ '};'
870+ ] . join ( '\n' ) ,
871+ parser : 'babel-eslint'
849872 }
850873 ] ,
851874
@@ -1386,6 +1409,27 @@ ruleTester.run('prop-types', rule, {
13861409 errors : [
13871410 { message : '\'name\' is missing in props validation for Hello' }
13881411 ]
1412+ } , {
1413+ code : [
1414+ 'class DynamicHello extends Component {' ,
1415+ ' render() {' ,
1416+ ' const {firstname} = this.props;' ,
1417+ ' class Hello extends Component {' ,
1418+ ' render() {' ,
1419+ ' const {name} = this.props;' ,
1420+ ' return <div>Hello {name}</div>;' ,
1421+ ' }' ,
1422+ ' }' ,
1423+ ' Hello = connectReduxForm({name: firstname})(Hello);' ,
1424+ ' return <Hello />;' ,
1425+ ' }' ,
1426+ '}'
1427+ ] . join ( '\n' ) ,
1428+ parser : 'babel-eslint' ,
1429+ errors : [
1430+ { message : '\'firstname\' is missing in props validation for DynamicHello' } ,
1431+ { message : '\'name\' is missing in props validation for Hello' }
1432+ ]
13891433 }
13901434 ]
13911435} ) ;
0 commit comments