electrovir / prettier-plugin-multiline-arrays

Prettier plugin to force array elements to wrap onto new lines.
https://www.npmjs.com/package/prettier-plugin-multiline-arrays
Creative Commons Zero v1.0 Universal
135 stars 6 forks source link

Error: Found comma but its following sibling is not a line: undefined #42

Open u3u opened 1 month ago

u3u commented 1 month ago
const arr = [
  1,
  // 2,
  3,
];

When commenting on the item in the middle of the array, an error will occur during formatting:

Error: Found comma but its following sibling is not a line: undefined
    at prettier-plugin-multiline-arrays/dist/printer/insert-new-lines.js:234:39
electrovir commented 1 month ago

Thanks for the report! I'll take a look.

Alex-Sokolov commented 1 week ago

Same too :) looks like plugin will fail when there is comment inside array

SCR-20240902-qjdh SCR-20240902-qjrb

Sometimes errors message a little different:

image

"prettier": "3.3.3", "prettier-plugin-multiline-arrays": "3.0.6",