Skip to content

fix: handle parser re-entry from chaining plugins#262

Merged
danielpza merged 1 commit into
fardad-dev:masterfrom
iainlane:master
May 9, 2026
Merged

fix: handle parser re-entry from chaining plugins#262
danielpza merged 1 commit into
fardad-dev:masterfrom
iainlane:master

Conversation

@iainlane
Copy link
Copy Markdown
Contributor

@iainlane iainlane commented May 7, 2026

Some Prettier plugins, such as prettier-plugin-tailwindcss, compose parsers by resolving the active parser chain again during preprocess or parse. When that chain points back at this plugin, the old module-level recursion guard could either recurse indefinitely or make unrelated concurrent format calls skip JSDoc processing.

Track active preprocess and parse calls per Prettier options object instead. Recursive entries for the same format call fall back to the raw Prettier parser, while separate format calls continue to run through the JSDoc parser normally.

Add a fake chaining plugin fixture to cover both plugin orders and concurrent format calls.

Closes: #254

Some Prettier plugins, such as `prettier-plugin-tailwindcss`, compose
parsers by resolving the active parser chain again during preprocess or
parse. When that chain points back at this plugin, the old module-level
recursion guard could either recurse indefinitely or make unrelated
concurrent format calls skip JSDoc processing.

Track active preprocess and parse calls per Prettier options object
instead. Recursive entries for the same format call fall back to the raw
Prettier parser, while separate format calls continue to run through the
JSDoc parser normally.

Add a fake chaining plugin fixture to cover both plugin orders and
concurrent format calls.

Closes: fardad-dev#254
@iainlane iainlane marked this pull request as ready for review May 7, 2026 21:34
@danielpza danielpza merged commit a8b84fe into fardad-dev:master May 9, 2026
6 checks passed
@danielpza
Copy link
Copy Markdown
Collaborator

Thanks @iainlane. I also just merged #255, do you think these 2 are going to have issues together?

@iainlane
Copy link
Copy Markdown
Contributor Author

iainlane commented May 9, 2026

Thanks!

Hmm, I don't think it was necessary to merge that one. Buuuut if the new tests from this PR pass then I think it shouldn't cause any problems.

@danielpza
Copy link
Copy Markdown
Collaborator

Thanks for the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RangeError: Maximum call stack size exceeded

2 participants