Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line output (pretty print) empty object declaration screws up formatting #239

Closed
drwestco opened this issue Mar 11, 2021 · 3 comments · Fixed by #240
Closed

Multi-line output (pretty print) empty object declaration screws up formatting #239

drwestco opened this issue Mar 11, 2021 · 3 comments · Fixed by #240
Assignees

Comments

@drwestco
Copy link

NUglifyApp, v1.13.6.

Input:

(function ()
{
    try
    {
        var a = {};
    }
    catch (ex)
    {
    }
})();

NUglifyApp -pretty:

(function()
{
    try
    {
        var a = {  }
}
catch(ex) {}
})()

Note two unnecessary spaces inside the object literal assignment.
Note indentation level lost after the object literal assignment.

@trullock trullock self-assigned this Mar 11, 2021
@trullock
Copy link
Owner

the object whitespace is probably a matter of taste, but the indentation is definitely a bug. Will investigate

@drwestco
Copy link
Author

Yeah, the object whitespace is understandable. It's an artifact of a single-line object declaration with space between braces and object properties. In the case of no properties, having two spaces inside is a little odd.

trullock added a commit that referenced this issue Mar 15, 2021
@trullock trullock mentioned this issue Mar 15, 2021
@trullock
Copy link
Owner

Fixed in 1.13.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants