Files
millionco__react-doctor/.changeset/fix-function-resolution-stack-overflow.md
Skosh 905607f7fc fix: prevent stack overflow in function resolution with depth limiting (#1658)
* fix: prevent stack overflow in function resolution with depth limiting

Add depth limiting to resolveExactLocalFunction to prevent infinite
recursion when resolving function references through deeply nested
expressions, TypeScript path aliases, or complex import chains.

The function now enforces a configurable depth limit
(FUNCTION_RESOLUTION_MAX_DEPTH = 15) and returns null when exhausted
rather than continuing to recurse.

- Add FUNCTION_RESOLUTION_MAX_DEPTH constant (15 levels)
- Thread remainingDepth parameter through all resolution helpers
- Add unit tests for depth limiting
- Add regression test for zustand + Next.js + path aliases case

Closes #1657

Co-authored-by: Skosh <skoshx@users.noreply.github.com>

* test: exercise function resolution stack guard

* refactor: share function chain fixture builder

* test: tighten function resolution regressions

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Aiden Bai <aiden.bai05@gmail.com>
2026-08-21 18:55:21 -07:00

244 B

oxlint-plugin-react-doctor
oxlint-plugin-react-doctor
patch

Prevent stack overflows while resolving deeply nested local function references. React Doctor now stops following a reference chain after a bounded number of steps instead of aborting the lint scan.