File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/eslint-plugin-react-hooks/src Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ export default {
272
272
if ( pathList . has ( segment . id ) ) {
273
273
const pathArray = Array . from ( pathList ) ;
274
274
const cyclicSegments = pathArray . slice (
275
- pathArray . indexOf ( segment . id ) + 1 ,
275
+ pathArray . indexOf ( segment . id ) - 1 ,
276
276
) ;
277
277
for ( const cyclicSegment of cyclicSegments ) {
278
278
cyclic . add ( cyclicSegment ) ;
@@ -300,7 +300,14 @@ export default {
300
300
}
301
301
}
302
302
303
- cache . set ( segment . id , paths ) ;
303
+ // If our segment is reachable then there should be at least one path
304
+ // to it to the end of our code path.
305
+ if ( segment . reachable && paths === BigInt ( '0' ) ) {
306
+ cache . delete ( segment . id ) ;
307
+ } else {
308
+ cache . set ( segment . id , paths ) ;
309
+ }
310
+
304
311
return paths ;
305
312
}
306
313
You can’t perform that action at this time.
0 commit comments