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

issue prettifying (function(){code();{code}})() #1852

Closed
divinity76 opened this issue Oct 25, 2020 · 0 comments · Fixed by #2117
Closed

issue prettifying (function(){code();{code}})() #1852

divinity76 opened this issue Oct 25, 2020 · 0 comments · Fixed by #2117

Comments

@divinity76
Copy link

Description

the code does not look pretty after "prettifying"

Input

The code looked like this before beautification:

(function() {
  	some_code_here();
    {
        /* IE11 let bug bypass */
        let index;
        for (index in a) {
            a[index];
        }
    }
})();

Current Output

The code actually looked like this after beautification:

(function() {
    some_code_here(); {
        /* IE11 let bug bypass */
        let index;
        for (index in a) {
            a[index];
        }
    }
})();

Expected Output

The code should have looked something like this after beautification:

(function() {
    some_code_here();
    {
        /* IE11 let bug bypass */
        let index;
        for (index in a) {
            a[index];
        }
    }
})();

Environment

Browser User Agent:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36

Language Selected:
Beautify JavaScript

Settings

(just the default)

{
  "indent_size": "4",
  "indent_char": " ",
  "max_preserve_newlines": "5",
  "preserve_newlines": true,
  "keep_array_indentation": false,
  "break_chained_methods": false,
  "indent_scripts": "normal",
  "brace_style": "collapse",
  "space_before_conditional": true,
  "unescape_strings": false,
  "jslint_happy": false,
  "end_with_newline": false,
  "wrap_line_length": "0",
  "indent_inner_html": false,
  "comma_first": false,
  "e4x": false,
  "indent_empty_lines": false
}
@bitwiseman bitwiseman added this to the 1.13.x milestone Nov 12, 2020
@bitwiseman bitwiseman modified the milestones: v1.13.1, v1.13.x Jan 8, 2021
@bitwiseman bitwiseman modified the milestones: v1.13.6, v1.13.x Jan 26, 2021
@bitwiseman bitwiseman modified the milestones: v1.13.7, v1.13.x Apr 13, 2021
@bitwiseman bitwiseman modified the milestones: v1.14.1, v1.14.x, v1.15.x Mar 28, 2022
@bitwiseman bitwiseman modified the milestones: v1.14.3, 1.14.x Apr 9, 2022
mhnaeem added a commit to mhnaeem/js-beautify that referenced this issue Nov 17, 2022
This change makes sure that a new line is added everytime a semicolon is followed by a block statement

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

Successfully merging a pull request may close this issue.

2 participants