Add an example for how to force comment-only array or object to keep multiple line in blog post (#19605)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
fisker Cheungandautofix-ci[bot] authored and GitHub committed 2026-07-12 12:15:43 +08:00
1 parent 1bc83147b3
commit cb00f45d71
1 file changed
+22
+22
View File
@@ -557,6 +557,28 @@ const array = [/* comment */];
const object = {/* comment */};
```
_You can use line comment or multiline comment to force the array and object to break._
<!-- prettier-ignore -->
```js
const array = [
// comment
];
const object = {
// comment
};
const array2 = [
/*
comment
*/
];
const object2 = {
/*
comment
*/
};
```
#### Fix dangling comment print in function parameters ([#18623](https://github.com/prettier/prettier/pull/18623) by [@fisker](https://github.com/fisker)) {#change-18623}
<!-- prettier-ignore -->