I've encountered an issue with js-beautify where it incorrectly formats the code when an object literal follows an array declaration without a semicolon. Here's an example of the problematic code:
test()
function test(){
let a = [122, 234]
{
console.info(a)
}
}
Expected Output
The code should have looked like this after beautification:
test()
function test() {
let a = [122, 234];
{
console.info(a)
}
}
Actual Output
The code actually looked like this after beautification:
test()
function test() {
let a = [122, 234] {
console.info(a)
}
}
As you can see, the object literal's opening brace is incorrectly placed on the same line as the array declaration, causing the code to become invalid. The expected output should be:
@AryaKS01 This project does not assign issues - we have too many folks that never work on an issue after it is assigned to them. Please feel free to work on this and submit a PR.
Description
Input
I've encountered an issue with js-beautify where it incorrectly formats the code when an object literal follows an array declaration without a semicolon. Here's an example of the problematic code:
Expected Output
The code should have looked like this after beautification:
Actual Output
The code actually looked like this after beautification:
As you can see, the object literal's opening brace is incorrectly placed on the same line as the array declaration, causing the code to become invalid. The expected output should be:
Steps to Reproduce
Environment
OS:
Settings