@@ -782,14 +782,6 @@ function componentRule(rule, context) {
782
782
components . add ( node , 2 ) ;
783
783
} ,
784
784
785
- 'ClassProperty, PropertyDefinition' ( node ) {
786
- node = utils . getParentComponent ( ) ;
787
- if ( ! node ) {
788
- return ;
789
- }
790
- components . add ( node , 2 ) ;
791
- } ,
792
-
793
785
ObjectExpression ( node ) {
794
786
if ( ! componentUtil . isES5Component ( node , context ) ) {
795
787
return ;
@@ -812,7 +804,7 @@ function componentRule(rule, context) {
812
804
components . add ( node , 0 ) ;
813
805
return ;
814
806
}
815
- components . add ( component , 1 ) ;
807
+ components . add ( component , 2 ) ;
816
808
} ,
817
809
818
810
FunctionDeclaration ( node ) {
@@ -825,7 +817,7 @@ function componentRule(rule, context) {
825
817
if ( ! node ) {
826
818
return ;
827
819
}
828
- components . add ( node , 1 ) ;
820
+ components . add ( node , 2 ) ;
829
821
} ,
830
822
831
823
ArrowFunctionExpression ( node ) {
@@ -843,34 +835,17 @@ function componentRule(rule, context) {
843
835
components . add ( node , 0 ) ;
844
836
return ;
845
837
}
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 ) ;
851
839
} ,
852
840
853
841
ThisExpression ( node ) {
854
- const component = utils . getParentComponent ( ) ;
842
+ const component = utils . getParentStatelessComponent ( ) ;
855
843
if ( ! component || ! / F u n c t i o n / . test ( component . type ) || ! node . parent . property ) {
856
844
return ;
857
845
}
858
846
// Ban functions accessing a property on a ThisExpression
859
847
components . add ( node , 0 ) ;
860
848
} ,
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
- } ,
874
849
} ;
875
850
876
851
// Detect React import specifiers
0 commit comments