<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58550>58550</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
JavaScript JSON object structures are incorrectly formatted when using AlignArrayOfStructures
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohnC32
</td>
</tr>
</table>
<pre>
Given:
```javascript
function() {
const options = {
foobar: {
itemOne: true,
anotherItemTwo: false
}
};
return options;
}
```
and `_clang-format`:
```yaml
---
BasedOnStyle: Google
IndentWidth: 4
AlignArrayOfStructures: Right
ColumnLimit: 0
...
```
clang-format 15 produces:
```javascript
function() {
const options = {
foobar: {
itemOne: true,
anotherItemTwo: false
}
};
return options;
}
```
The align array of structure option doc has examples for C/C++ but not JavaScript. For JavaScript, I
would expect from the doc that this option would have no impact on JavaScript or produce the
following where clang-format would treat the colon like a comma:
```javascript
function() {
const options = {
foobar: {
itemOne: true,
anotherItemTwo: false
}
};
return options;
}
```
If we use `AlignArrayOfStructures: Right` in the above _clang-format, clang-format produces the following
which is even less expected in that the closing brace was moved up a line despite ColumnLimit being
set to 0.
```javascript
function() {
const options = {
foobar: {
itemOne: true,
anotherItemTwo: false}
};
return options;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVEuP2jAQ_jXJZURkEghwyGEBsWJVFams1GPlJE7irWNHtgPl33echJe2r8NKxTIPz4zn9X2eVOWn5JkfmPSiJ4-sPXL-jkm_3-iBmkzzxvaKopWZ5Up64dwLF-DNlr0ccGVKGguqcXoDXrS-V7tVKJVSjcHeq9ziltU7yZze6pZ54eq9DZXKVkxv0fT1qJxpQYVh94bebH0VuEN0E00z22p5TvSiuty5FH_bESpzQNG3TFBZjgqla2qdyW_6dqK16EWj0aj_s6SG5Tu5tyfRVfisVCmGvLcyZ9J-5bmtnGrSS58EL-WT1vS0K_bYkAzzZsYZfOFlNSCyUqKt5Sdec-s0Q9JBEPyhmNsiYDyFRqu8zTrXD8CCf6bC_-TDa8WAOnyAOoBAFWDOEA2uIFcZVNQA-0HrRjCDhWtYeeEGP0vckLYWMH14wf7uu_4GsEGb6xnrhm0f8ahakaOvhmUWCq1qwLq7GLZCGG3FzTlwb1rRA0P3wOuG4hWUX_0CRhlQd24GWJUQ6shlCUfsKIM7mvQ-rWZdLFQqgR4F_459wENd08dgzw1xhvVoo2RbwJFBa5gbKH974zEBLruG01QhnvcDCNlxB9L5IXcXLnAO_Kl4VgGShOG8B6SjGcjE8j7EGVihjONAqimS44j8rTFwDm2DQAsukXPMNNhmuBk9kLJLIMPQkQISPAAbPmaWfCAFfJaM4ziezGfRJPLzJMoX0YL6llvBkpv3-bLffQaVvrnHfhksBocNQ7AypTUqxAl63B2E-GQlksoh92tO-a0WSWVt0435cIO75LZq0wBfLx6EOJx_RsgjFxmP3JgW-RhupvPplPhVQiaTaTqL6XyeFnEejrNwvEinRUHILA5TEvmCpkyYxJsuvena50lIwnBMwoiMyYJEQTYhIc2idBEXkyycz70JYTXlInCBA6VLXyddDmlbGlQKbqy5KqkxWBxjZ_-0tZXSyYuq5CoK_S7dpMv1J-M4lGw">