File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -362,13 +362,14 @@ function componentRule(rule, context) {
362362 var isFunction = / F u n c t i o n / . test ( node . type ) ; // Functions
363363 var isMethod = node . parent && node . parent . type === 'MethodDefinition' ; // Classes methods
364364 var isArgument = node . parent && node . parent . type === 'CallExpression' ; // Arguments (callback, etc.)
365- var isJSX = node . parent && node . parent . type === 'JSXExpressionContainer' ;
365+ // Attribute Expressions inside JSX Elements (<button onClick={() => props.handleClick()}></button>)
366+ var isJSXExpressionContainer = node . parent && node . parent . type === 'JSXExpressionContainer' ;
366367 // Stop moving up if we reach a class or an argument (like a callback)
367368 if ( isClass || isArgument ) {
368369 return null ;
369370 }
370- // Return the node if it is a function that is not a class method
371- if ( isFunction && ! isMethod && ! isJSX ) {
371+ // Return the node if it is a function that is not a class method and is not inside a JSX Element
372+ if ( isFunction && ! isMethod && ! isJSXExpressionContainer ) {
372373 return node ;
373374 }
374375 scope = scope . upper ;
You can’t perform that action at this time.
0 commit comments