prettier-plugin-multiline-arrays
prettier-plugin-multiline-arrays copied to clipboard
Doesn't work with zod
I have files I'm trying to generate, and then prettier, so I use this plugin via prettier API not CLI. But I have tested this via CLI too, and it doesn't seem to work.
Input file:
import { z } from "zod";
export const Params = z.tuple([
z.number(),
z.number(),
z.number(),
z.number(),
z.number(),
z.union([z.number(), z.null()]),
]);
export type Params = z.infer<typeof Params>;
I would expect (and want) that last line, z.union([ z.number(), z.null() ]) to be split into multiple newlines, so that the output would be:
import { z } from "zod";
export const Params = z.tuple([
z.number(),
z.number(),
z.number(),
z.number(),
z.number(),
z.union([
z.number(),
z.null()
]),
]);
export type Params = z.infer<typeof Params>;
But this doesn't seem to be happening.
Package json details:
"prettier": "^3.5.3",
"prettier-plugin-multiline-arrays": "^4.0.3",
API usage:
await format(zodStringOutput, {
parser: 'typescript',
plugins: [
await import("prettier-plugin-multiline-arrays")
],
})