dprint-plugin-typescript
dprint-plugin-typescript copied to clipboard
Formatting array elements to a maximum width
I'm working with a large array of data and would prefer not to have it all on one line, nor formatted as one item per line. I've seen examples in C code where data like this is formatted to fit a maximum width and then breaks onto a new line, making it easier to read.
Is there a configuration setting that allows me to do this? I've searched for array formatting options but haven't found any related to this.
example with max width 80:
test("encode - create data with checksum", () => {
const checksum = addChecksum(serializedPaymentOrder);
/** dprint-ignore */
const expected = Uint8Array.from([
0x90, 0x94, 0x19, 0x21, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x2d, 0x69,
0x64, 0x09, 0x31, 0x09, 0x31, 0x09, 0x31, 0x30, 0x30, 0x09, 0x45, 0x55,
0x52, 0x09, 0x09, 0x31, 0x32, 0x33, 0x09, 0x09, 0x09, 0x09, 0x09, 0x31,
0x09, 0x53, 0x4b, 0x39, 0x36, 0x31, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x32, 0x39, 0x31, 0x38, 0x35, 0x39, 0x39, 0x36, 0x36,
0x39, 0x09, 0x09, 0x30, 0x09, 0x30, 0x09, 0x09, 0x09
]);
assert.deepEqual(checksum, expected);
});
Sorry, I created the issue in the wrong repository. It should be in dprint-plugin-typescript