Skip to content

fix: prevent call stack overflow when used with prettier-plugin-tailwindcss#255

Open
shun-shobon wants to merge 1 commit intohosseinmd:masterfrom
shun-shobon:fix/tailwindcss
Open

fix: prevent call stack overflow when used with prettier-plugin-tailwindcss#255
shun-shobon wants to merge 1 commit intohosseinmd:masterfrom
shun-shobon:fix/tailwindcss

Conversation

@shun-shobon
Copy link

fix #254

The root cause was that prettier-plugin-jsdoc delegates parse/preprocess to “another plugin that provides the same parser” by scanning options.plugins, but it could accidentally pick a plugin that appears after prettier-plugin-jsdoc (e.g. tailwindcss). Since tailwindcss wraps other parsers, delegating back to it from inside jsdoc creates a circular call chain like tailwind.preprocess -> jsdoc.preprocess -> tailwind.preprocess -> ..., eventually overflowing the call stack.

To prevent this, findPluginByParser() now only considers plugins that appear before prettier-plugin-jsdoc in options.plugins, avoiding delegation back into wrapper plugins while preserving compatibility with earlier parser plugins.

@danielpza
Copy link
Collaborator

danielpza commented Mar 5, 2026

LGTM, please update the README adding a note about this behavior.
Can you also add some tests.

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