File tree Expand file tree Collapse file tree 3 files changed +37
-2483
lines changed Expand file tree Collapse file tree 3 files changed +37
-2483
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ export default function (babel) {
211
211
key : fnHookCalls . map ( call => call . name + '{' + call . key + '}' ) . join ( '\n' ) ,
212
212
customHooks : fnHookCalls
213
213
. filter ( call => ! isBuiltinHook ( call . name ) )
214
+ . filter ( call => scope . parent . hasBinding ( call . name ) )
214
215
. map ( call => t . cloneDeep ( call . callee ) ) ,
215
216
} ;
216
217
}
Original file line number Diff line number Diff line change
1
+ import { useState } from "react" ;
2
+
3
+ function Component1 ( ) {
4
+ function useRippleHandler ( ) { }
5
+ useRippleHandler ( ) ;
6
+ useRippleHandler ( ) ;
7
+ }
8
+
9
+ function Component2 ( ) {
10
+ const useRippleHandler = ( ) => { } ;
11
+ useRippleHandler ( ) ;
12
+ useRippleHandler ( ) ;
13
+ }
14
+
15
+ function Component3 ( ) {
16
+ const useRippleHandler = function ( ) { } ;
17
+ useRippleHandler ( ) ;
18
+ useRippleHandler ( ) ;
19
+ }
20
+
21
+ const useInnerHook = ( { useHookFromProps} ) => {
22
+ const useHookBase = ( ) => useState ( ) ;
23
+ const useHook = ( ) => useState ( useHookFromProps ( useHookBase ( ) ) ) ;
24
+ useHookFromProps ( ) ;
25
+ {
26
+ // sub scope
27
+ useHook ( ) ;
28
+ }
29
+ } ;
30
+
31
+ const OnlyThisOneUsesExternalHook = ( ) => {
32
+ useInnerHook ( ) ;
33
+ useState ( ) ;
34
+ } ;
35
+
36
+ // check for "return ["
You can’t perform that action at this time.
0 commit comments