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

Incorrect formating with semicolon-less code #75

Closed
derekchiang opened this issue Jul 19, 2013 · 4 comments · Fixed by #109
Closed

Incorrect formating with semicolon-less code #75

derekchiang opened this issue Jul 19, 2013 · 4 comments · Fixed by #109

Comments

@derekchiang
Copy link

Consider this piece of code:

var whatever = require('whatever')
function() {...}

Using JsFormat, this code will be formatted to:

var whatever = require('whatever')
    function() {...}  // indentation at the beginning of the line

Specifically, it seems like whenever there is a bracket following by a function, JsFormat would indent the function definition (incorrectly).

@jdavisclark
Copy link
Owner

This should definitely be handled better. I will open a bug upstream with jsbeautifier.

Not to start a semicolon vs no semicolon debate, but it does behave as expected if the require statement is terminated with a semicolon.

@jdavisclark
Copy link
Owner

After having a look through the einars/js-beautify issue tracker, it looks like this is part of a larger issue. Based on a cursory glance, I do not see this being fixed any time soon. So, I hate to tell you to use semicolons, as it's perfectly valid as is, but thats the workaround for the time being.

Relevant Issues: beautifier/js-beautify#56 , beautifier/js-beautify#200

@bitwiseman
Copy link
Collaborator

You should still file an issue. We'll evaluate and fix issues on a point-wise basis.

@bitwiseman
Copy link
Collaborator

This is fixed now. 😄

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.

3 participants