@@ -782,14 +782,6 @@ function componentRule(rule, context) {
782782 components . add ( node , 2 ) ;
783783 } ,
784784
785- 'ClassProperty, PropertyDefinition' ( node ) {
786- node = utils . getParentComponent ( ) ;
787- if ( ! node ) {
788- return ;
789- }
790- components . add ( node , 2 ) ;
791- } ,
792-
793785 ObjectExpression ( node ) {
794786 if ( ! componentUtil . isES5Component ( node , context ) ) {
795787 return ;
@@ -812,7 +804,7 @@ function componentRule(rule, context) {
812804 components . add ( node , 0 ) ;
813805 return ;
814806 }
815- components . add ( component , 1 ) ;
807+ components . add ( component , 2 ) ;
816808 } ,
817809
818810 FunctionDeclaration ( node ) {
@@ -825,7 +817,7 @@ function componentRule(rule, context) {
825817 if ( ! node ) {
826818 return ;
827819 }
828- components . add ( node , 1 ) ;
820+ components . add ( node , 2 ) ;
829821 } ,
830822
831823 ArrowFunctionExpression ( node ) {
@@ -843,34 +835,17 @@ function componentRule(rule, context) {
843835 components . add ( node , 0 ) ;
844836 return ;
845837 }
846- if ( component . expression && utils . isReturningJSX ( component ) ) {
847- components . add ( component , 2 ) ;
848- } else {
849- components . add ( component , 1 ) ;
850- }
838+ components . add ( component , 2 ) ;
851839 } ,
852840
853841 ThisExpression ( node ) {
854- const component = utils . getParentComponent ( ) ;
842+ const component = utils . getParentStatelessComponent ( ) ;
855843 if ( ! component || ! / F u n c t i o n / . test ( component . type ) || ! node . parent . property ) {
856844 return ;
857845 }
858846 // Ban functions accessing a property on a ThisExpression
859847 components . add ( node , 0 ) ;
860848 } ,
861-
862- ReturnStatement ( node ) {
863- if ( ! utils . isReturningJSX ( node ) ) {
864- return ;
865- }
866- node = utils . getParentComponent ( ) ;
867- if ( ! node ) {
868- const scope = context . getScope ( ) ;
869- components . add ( scope . block , 1 ) ;
870- return ;
871- }
872- components . add ( node , 2 ) ;
873- } ,
874849 } ;
875850
876851 // Detect React import specifiers
0 commit comments