Skip to content

Commit 83bd290

Browse files
committed
Valid self reference jsx element.
1 parent 9a657cc commit 83bd290

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/rules/forbid-component-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = {
4848
return {
4949
JSXAttribute: function(node) {
5050
var tag = node.parent.name.name;
51-
if (tag[0] !== tag[0].toUpperCase()) {
51+
if (tag && tag[0] !== tag[0].toUpperCase()) {
5252
// This is a DOM node, not a Component, so exit.
5353
return;
5454
}

tests/lib/rules/forbid-component-props.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ ruleTester.run('forbid-component-props', rule, {
8181
].join('\n'),
8282
options: [{forbid: ['style', 'foo']}],
8383
parserOptions: parserOptions
84+
}, {
85+
code: [
86+
'var First = React.createClass({',
87+
' propTypes: externalPropTypes,',
88+
' render: function() {',
89+
' return <this.Foo className="bar" />;',
90+
' }',
91+
'});'
92+
].join('\n'),
93+
options: [{forbid: ['style', 'foo']}],
94+
parserOptions: parserOptions
8495
}],
8596

8697
invalid: [{

0 commit comments

Comments
 (0)