-
-
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
Conversation
@@ -81,6 +81,17 @@ ruleTester.run('forbid-component-props', rule, { | |||
].join('\n'), | |||
options: [{forbid: ['style', 'foo']}], | |||
parserOptions: parserOptions | |||
}, { | |||
code: [ | |||
'var First = React.createClass({', |
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
' }', | ||
'});' | ||
].join('\n'), | ||
options: [{forbid: ['style', 'foo']}], |
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think i just forget remove the line options: [{forbid: ['style', 'foo']}]
, it shouldn't relate to forbid
option.
hi @ljharb I just made some changes, Are there what you expect ? |
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.
LGTM! I'll let other collabs take a look first tho.
LGTM |
Cool. Thanks @ljharb and @EvNaverniouk |
Hi @ljharb When can you merge the pull request ? |
Hi @ljharb @EvNaverniouk , Do we have any other issue here for merge the PR ? |
Please check the information here #839
I'm trying to include xo in one of our projects, i hit the issue exactly the same as @pfhayes . And after dig into the codebase, i found we have a self reference linked jsx element and that cause the issue, Like this
That's cause the issue. I don't think it's a best practice, but at least it shouldn't crash the workflow.