prettier-plugin-multiline-arrays
prettier-plugin-multiline-arrays copied to clipboard
don't wrap last array item when trailingComma is 'none'
Hi, thanks for the awesome plugin, but I noticed a strange behavior when trailingComma is 'none'
.prettierrc
{
printWidth: 120,
tabWidth: 4,
useTabs: false,
singleQuote: true,
trailingComma: 'none', // <---
plugins: ['prettier-plugin-multiline-arrays'],
}
source:
const { join } = require('path');
const arr = [
join('...', '...'),
join('...', '...')
]; // <---
after prettier --write:
const { join } = require('path');
const arr = [
join('...', '...'),
join('...', '...')]; // <---
Nice catch! I'll try to repro and fix.
Note: this also happens in JSON (since JSON doesn't allow trailing commas)
I have the same issue with trailingComma: 'es5'
Original code
{
"files": [],
"references": [
{"path": "./tsconfig.app.json"},
{"path": "./tsconfig.node.json"}
]
}
after this plugin is executed, I ended up with
{
"files": [],
"references": [
{"path": "./tsconfig.app.json"},
{"path": "./tsconfig.node.json"}]
}
fixed for the next release
released in v4.0.0