Skip to content

Error: Could not find closing match for { #56

Description

@xemlock

There is an error thrown when processing files with commented out array elements, when comment starts with /*{. If the comment start symbol and the curly brace are separated with a space (i.e., /* {) no error occurs.

Minimal reproducible example:

test.ts:

const test = [
  /*{
  },*/
  {},
];

.prettierrc:

{
  "plugins": ["prettier-plugin-multiline-arrays"]
}

Result:

▶ npx prettier test.ts
test.ts
[error] test.ts: Error: Could not find closing match for {
[error]     at node_modules/prettier-plugin-multiline-arrays/dist/printer/insert-new-lines.js:168:39
[error]     at walkDoc (node_modules/prettier-plugin-multiline-arrays/dist/printer/child-docs.js:27:10)
[error]     at node_modules/prettier-plugin-multiline-arrays/dist/printer/child-docs.js:40:20
[error]     at Array.every (<anonymous>)
[error]     at walkDoc (node_modules/prettier-plugin-multiline-arrays/dist/printer/child-docs.js:39:18)
[error]     at node_modules/prettier-plugin-multiline-arrays/dist/printer/child-docs.js:40:20
[error]     at Array.every (<anonymous>)
[error]     at walkDoc (node_modules/prettier-plugin-multiline-arrays/dist/printer/child-docs.js:39:18)
[error]     at node_modules/prettier-plugin-multiline-arrays/dist/printer/child-docs.js:40:20
[error]     at Array.every (<anonymous>)

Environment

  • prettier@3.6.2
  • prettier-plugin-multiline-arrays@4.0.3

Activity

  1. self-assigned this
    on Jul 1, 2026
  2. added a commit that references this issue on Jul 1, 2026
    425afb6
  3. electrovir commented on Jul 1, 2026

    @electrovir
    Owner

    Released in v4.1.10!

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions