-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Valid self reference jsx element. #905
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,17 @@ ruleTester.run('forbid-component-props', rule, { | |
].join('\n'), | ||
options: [{forbid: ['style', 'foo']}], | ||
parserOptions: parserOptions | ||
}, { | ||
code: [ | ||
'var First = React.createClass({', | ||
' propTypes: externalPropTypes,', | ||
' render: function() {', | ||
' return <this.Foo className="bar" />;', | ||
' }', | ||
'});' | ||
].join('\n'), | ||
options: [{forbid: ['style', 'foo']}], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm - why would "foo" lowercase catch "Foo", which is a distinct property in JS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me check the test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think i just forget remove the line |
||
parserOptions: parserOptions | ||
}], | ||
|
||
invalid: [{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also add examples with an SFC, and with a
class
-based component?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, SFC is short for self-closing component right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no - it's for "stateless functional component" - ie, a function that takes props and returns JSX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, Thanks. I know 'stateless functional component' , just have no idea what does SFC meaning. Thanks for point out