Skip to content

Commit 5df82bd

Browse files
committed
Fix this.props.children marked as missing in props validation (fixes #7)
1 parent d4f339b commit 5df82bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/rules/prop-types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = function(context) {
6161
}
6262

6363
for (var i = 0, j = usedPropTypes.length; i < j; i++) {
64-
if (declaredPropTypes.indexOf(usedPropTypes[i]) === -1) {
64+
if (declaredPropTypes.indexOf(usedPropTypes[i]) === -1 && usedPropTypes[i] !== 'children') {
6565
context.report(node, '\'' + usedPropTypes[i] + '\' is missing in props validation');
6666
}
6767
}

tests/lib/rules/prop-types.js

+10
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ eslintTester.addRuleTest('lib/rules/prop-types', {
5555
ecmaFeatures: {
5656
jsx: true
5757
}
58+
}, {
59+
code: '\
60+
var Hello = React.createClass({\
61+
render: function() {\
62+
return <div>Hello World {this.props.children}</div>;\
63+
}\
64+
});',
65+
ecmaFeatures: {
66+
jsx: true
67+
}
5868
}
5969
],
6070

0 commit comments

Comments
 (0)