-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add more support for wrapped propTypes #1272
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
Changes from all commits
4df159b
b6e3a2f
b25d791
55e496d
bb97fc8
eda7e1d
412f44c
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ module.exports = { | |
|
||
create: Components.detect(function(context, components, utils) { | ||
var sourceCode = context.getSourceCode(); | ||
var propWrapperFunctions = new Set(context.settings.propWrapperFunctions || []); | ||
|
||
/** | ||
* Get properties name | ||
|
@@ -105,6 +106,13 @@ module.exports = { | |
if (node.type === 'Identifier') { | ||
return findVariableByName(node.name); | ||
} | ||
if ( | ||
node.type === 'CallExpression' && | ||
propWrapperFunctions.has(node.callee.name) && | ||
node.arguments && node.arguments[0] | ||
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. this should probably be 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. It shouldn't matter, if It looks like checking the arguments array this way also matches code style in other places in this project. 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. in v8, accessing an |
||
) { | ||
return node.arguments[0]; | ||
} | ||
|
||
return node; | ||
} | ||
|
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.
will
context.settings
always exist and be an object?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.
Yes, I tested both with and without settings defined -
context.settings
will always be an object.