Skip to content

RangeError: Maximum call stack size exceeded #254

Closed

Description

@samislam
{
  "semi": false,
  "tabWidth": 2,
  "printWidth": 100,
  "singleQuote": true,
  "trailingComma": "es5",
  "plugins": ["prettier-plugin-tailwindcss", "prettier-plugin-jsdoc"]
}

If you have any other plugin added next to prettier-plugin-jsdoc, you'll end up with infinite loop of errors:

Image

Some additional context:

File: package.json

{
  "name": "web",
  "description": "",
  "author": "",
  "version": "1.0.0",
  "license": "Apache-2.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "tsx ./scripts/dev.ts",
    "lint": "tsx ./scripts/lint.ts",
    "setup": "tsx ./scripts/setup.ts",
    "build": "tsx ./scripts/build.ts",
    "clean": "tsx ./scripts/clean.ts",
    "format": "tsx ./scripts/format.ts",
    "prisma": "tsx ./scripts/prisma.ts",
    "locales": "tsx ./scripts/locales.ts",
    "start": "node ./dist/scripts/start.js"
  },
  "dependencies": {
    "next": "16.0.5",
    "react": "19.2.0",
    "react-dom": "19.2.0",
    "@clscripts/cl-common": "^1.0.4",
    "@clscripts/dotenv-cli": "^8.0.1",
    "@clscripts/next": "^15.3.5",
    "@hookform/resolvers": "^3.9.1",
    "@inquirer/prompts": "^7.2.4",
    "@kodingdotninja/use-tailwind-breakpoint": "^1.0.0",
    "@mdi/js": "^7.4.47",
    "@mdi/react": "^1.6.1",
    "@prisma/client": "^6.3.1",
    "@radix-ui/react-label": "^2.1.0",
    "@radix-ui/react-select": "^2.1.2",
    "@radix-ui/react-slot": "^1.1.0",
    "@radix-ui/react-toggle": "^1.1.0",
    "@radix-ui/react-toggle-group": "^1.1.0",
    "@radix-ui/react-tooltip": "^1.2.7",
    "@t3-oss/env-nextjs": "^0.13.8",
    "@tanstack/react-query": "^5.84.1",
    "@tanstack/react-query-devtools": "^5.84.1",
    "@tolgee/format-icu": "^5.32.0",
    "@tolgee/react": "^5.31.5",
    "await-to-js": "^3.0.0",
    "axios": "^1.7.8",
    "chalk": "^4.1.2",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "compare-path": "^1.1.3",
    "concat-str": "^1.0.6",
    "conditionalize-component": "^1.4.2",
    "dotenv": "^16.4.5",
    "framer-motion": "^11.11.17",
    "iif-ts": "^2.0.0",
    "lucide-react": "^0.460.0",
    "ms": "^2.1.3",
    "next-intl": "^3.25.3",
    "next-themes": "^0.4.6",
    "nextjs-middleware-stack": "^1.0.2",
    "nuqs": "^2.4.3",
    "prisma": "^6.13.0",
    "react-hook-form": "^7.53.2",
    "tailwind-merge": "^2.5.4",
    "tailwindcss-animate": "^1.0.7",
    "tailwindest": "^2.3.6",
    "use-is-mounted-hook": "^1.0.1",
    "zod": "^3.25.20",
    "zustand": "^5.0.3"
  },
  "devDependencies": {
    "@clscripts/del-cli": "^6.0.0",
    "@clscripts/echo-cli": "^2.0.0",
    "@clscripts/prettier": "^3.6.2",
    "@clscripts/prisma": "^6.11.1",
    "@clscripts/tolgee-cli": "^2.13.0",
    "@clscripts/ts-patch": "^3.3.0",
    "@tailwindcss/postcss": "^4",
    "@tolgee/cli": "^2.13.0",
    "@types/ms": "^2.1.0",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "autoprefixer": "^10.4.21",
    "del-cli": "^6.0.0",
    "dotenv-cli": "^7.4.4",
    "echo-cli": "^2.0.0",
    "eslint": "^9",
    "eslint-config-next": "16.0.5",
    "postcss": "^8.5.3",
    "postcss-load-config": "^6.0.1",
    "prettier": "^3.7.3",
    "prettier-plugin-jsdoc": "^1.7.0",
    "prettier-plugin-tailwindcss": "^0.7.1",
    "tailwindcss": "^4",
    "ts-essentials": "^10.1.1",
    "ts-patch": "^3.3.0",
    "tsx": "^4.20.3",
    "typescript": "^5"
  }
}

regarding @CLScripts, its just a small class that lets you write something like the following, which makes your package.json scripts section a lot cleaner to read:

File: scripts/format.ts

import { Prettier } from '@clscripts/prettier'
import { runCommand } from '@clscripts/cl-common'

runCommand(
  new Prettier({
    files: ['./**/*.{htm,html,css,md,mdx,js,jsx,ts,tsx}'],
  }).command // prettier --write ./**/*.{htm,html,css,md,mdx,js,jsx,ts,tsx}
)

And thanks for supporting prettier 3.7 🌹

Activity

  1. Greenheart commented on Dec 4, 2025

    @Greenheart

    I've looked into this a bit more.

    This error only seems to happen when you run prettier format --write -. via the CLI. So the prettier JS API seems to behave differently.

    The current tests of prettier-plugin-jsdoc don't cover plugin compatibility when prettier is run via the prettier CLI.

    Cause of the infinite loop

    When running prettier format --write ., the function findPluginByParser in prettier-plugin-jsdoc (utils.js) fails to find a parser for prettier-plugin-tailwindcss, causing some other code to keep calling findPluginByParser infinitely until the maximum call stack is reached and the formatting for that file is aborted.

    Image
  2. added a commit that references this issue on Dec 7, 2025
  3. fardad-dev commented on Dec 7, 2025

    @fardad-dev
    Owner

    Thank you, i fixed the issue, released in v1.7.1

  4. bwells78 commented on Dec 8, 2025

    @bwells78

    Thank you for your work on this plugin, it's incredibly useful. I'm still struggling with this error after updating to v1.8 (or v1.7.1) - here is my output for any clues:

    "INFO" - 10:55:50 AM] PrettierInstance:
    {
      "modulePath": "/Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier/index.cjs",
      "messageResolvers": {},
      "version": "3.7.4"
    }
    ["INFO" - 10:55:50 AM] Using ignore file (if present) at /Users/bwells/Source/silver-creek-apps/portal/.prettierignore
    ["INFO" - 10:55:50 AM] File Info:
    {
      "ignored": false,
      "inferredParser": "typescript"
    }
    ["INFO" - 10:55:50 AM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
    ["INFO" - 10:55:50 AM] Prettier Options:
    {
      "filepath": "/Users/bwells/Source/silver-creek-apps/portal/types/allocations/status.ts",
      "parser": "typescript",
      "semi": false,
      "singleQuote": true,
      "tabWidth": 2,
      "trailingComma": "es5",
      "plugins": [
        "/Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js",
        "/Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs"
      ],
      "tailwindFunctions": [
        "tw",
        "cva"
      ]
    }
    ["ERROR" - 10:55:50 AM] Error formatting document.
    ["ERROR" - 10:55:50 AM] Maximum call stack size exceeded
    RangeError: Maximum call stack size exceeded
        at findPluginByParser (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/utils.js:162:28)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:257:36)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
    ["INFO" - 10:55:50 AM] Formatting completed in 64ms.
    

    If I remove prettier-plugin-tailwindcss the error goes away-

  5. fardad-dev commented on Dec 8, 2025

    @fardad-dev
    Owner

    Change order of plugins, add jsdoc to end of list

  6. bwells78 commented on Dec 8, 2025

    @bwells78

    Thank you, I should have mentioned that I tried that as well, same result for me:

    ["INFO" - 12:42:06 PM] PrettierInstance:
    {
      "modulePath": "/Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier/index.cjs",
      "messageResolvers": {},
      "version": "3.7.4"
    }
    ["INFO" - 12:42:06 PM] Using ignore file (if present) at /Users/bwells/Source/silver-creek-apps/portal/.prettierignore
    ["INFO" - 12:42:06 PM] File Info:
    {
      "ignored": false,
      "inferredParser": "typescript"
    }
    ["INFO" - 12:42:06 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
    ["INFO" - 12:42:06 PM] Prettier Options:
    {
      "filepath": "/Users/bwells/Source/silver-creek-apps/portal/lib/server/apps/allocations/operations/set-status.ts",
      "parser": "typescript",
      "semi": false,
      "singleQuote": true,
      "tabWidth": 2,
      "trailingComma": "es5",
      "plugins": [
        "/Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs",
        "/Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js"
      ],
      "tailwindFunctions": [
        "tw",
        "cva"
      ]
    }
    ["ERROR" - 12:42:06 PM] Error formatting document.
    ["ERROR" - 12:42:06 PM] Maximum call stack size exceeded
    RangeError: Maximum call stack size exceeded
        at Object.originalParser (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:8105)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11087)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
        at Object.jsDocPreprocess [as preprocess] (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
        at preprocess (file:///Users/bwells/Source/silver-creek-apps/portal/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
    ["INFO" - 12:42:06 PM] Formatting completed in 93ms.
    
  7. diego-aquino commented on Dec 14, 2025

    @diego-aquino

    I'm facing the same error using prettier-plugin-jsdoc@1.8.0:

    .prettierrc.json

    {
      "semi": true,
      "printWidth": 120,
      "tabWidth": 2,
      "useTabs": false,
      "singleQuote": true,
      "trailingComma": "all",
      "bracketSpacing": true,
      "arrowParens": "always",
      "endOfLine": "lf",
      "proseWrap": "always",
      "plugins": ["prettier-plugin-jsdoc", "prettier-plugin-tailwindcss"]
    }

    tmp.js

    console.log('tmp');

    Output:

    > prettier --log-level warn --ignore-unknown --no-error-on-unmatched-pattern --cache --write tmp.js --log-level debug
    
    [debug] normalized argv: {"_":["tmp.js"],"cache":true,"color":true,"editorconfig":true,"errorOnUnmatchedPattern":false,"ignoreUnknown":true,"write":true,"logLevel":"debug","configPrecedence":"cli-override","debugRepeat":0,"ignorePath":[".gitignore",".prettierignore"],"plugins":[],"__raw":{"_":["tmp.js"],"cache":true,"color":true,"editorconfig":true,"error-on-unmatched-pattern":false,"ignore-unknown":true,"write":true,"log-level":["warn","debug"],"config-precedence":"cli-override","debug-repeat":0,"ignore-path":[".gitignore",".prettierignore"],"plugin":[]}}
    [debug] resolve config from '/home/.../tmp.js'
    [debug] loaded options `{"useTabs":false,"tabWidth":2,"endOfLine":"lf","semi":true,"printWidth":120,"singleQuote":true,"trailingComma":"all","bracketSpacing":true,"arrowParens":"always","proseWrap":"always","plugins":["prettier-plugin-jsdoc","prettier-plugin-tailwindcss"]}`
    [debug] applied config-precedence (cli-override): {"singleQuote":true,"bracketSpacing":true,"arrowParens":"always","semi":true,"trailingComma":"all","proseWrap":"always","endOfLine":"lf","plugins":["prettier-plugin-jsdoc","prettier-plugin-tailwindcss"],"printWidth":120,"tabWidth":2,"useTabs":false}
    tmp.js
    [error] tmp.js: RangeError: Maximum call stack size exceeded
    [error]     at Object.hasOwnProperty (<anonymous>)
    [error]     at file:///home/.../node_modules/.pnpm/prettier-plugin-jsdoc@1.8.0_prettier@3.7.4/node_modules/prettier-plugin-jsdoc/dist/utils.js:171:28
    [error]     at Array.find (<anonymous>)
    [error]     at findPluginByParser (file:///home/.../node_modules/.pnpm/prettier-plugin-jsdoc@1.8.0_prettier@3.7.4/node_modules/prettier-plugin-jsdoc/dist/utils.js:163:38)
    [error]     at Object.jsDocPreprocess [as preprocess] (file:///home/.../node_modules/.pnpm/prettier-plugin-jsdoc@1.8.0_prettier@3.7.4/node_modules/prettier-plugin-jsdoc/dist/index.js:257:36)
    [error]     at preprocess (file:///home/.../node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier-plugin-jsdoc@1.8.0_prettier@3.7.4__prettier@3.7.4/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
    [error]     at Object.jsDocPreprocess [as preprocess] (file:///home/.../node_modules/.pnpm/prettier-plugin-jsdoc@1.8.0_prettier@3.7.4/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
    [error]     at preprocess (file:///home/.../node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier-plugin-jsdoc@1.8.0_prettier@3.7.4__prettier@3.7.4/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
    [error]     at Object.jsDocPreprocess [as preprocess] (file:///home/.../node_modules/.pnpm/prettier-plugin-jsdoc@1.8.0_prettier@3.7.4/node_modules/prettier-plugin-jsdoc/dist/index.js:264:33)
    [error]     at preprocess (file:///home/.../node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier-plugin-jsdoc@1.8.0_prettier@3.7.4__prettier@3.7.4/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11129)
     ELIFECYCLE  Command failed with exit code 2.
    
  8. wmertens commented on Jan 26, 2026

    @wmertens

    I'm also getting this, no matter if I put the tailwind plugin first or last

  9. borgogelli commented on Apr 18, 2026

    @borgogelli

    I'm facing the same problem with prettier-plugin-jsdoc@1.8.0 and prettier 3.8.2

  10. added a commit that references this issue on May 7, 2026
    9043f72
  11. iainlane commented on May 7, 2026

    @iainlane
    Contributor

    I've filed #262 to fully fix this. @fardad-dev it'd be good if you could reopen!

  12. added a commit that references this issue on May 9, 2026
    a8b84fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions