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 indentation of functions in array #246

Closed
badsyntax opened this issue Apr 24, 2013 · 2 comments
Closed

Incorrect indentation of functions in array #246

badsyntax opened this issue Apr 24, 2013 · 2 comments

Comments

@badsyntax
Copy link

I'm beautifying the following javascript:

var arr = [
function () {}, 
function () {}
];

Which results in:

var arr = [function () {}, function () {}];

I expect the indentation to be:

var arr = [
    function () {}, 
    function () {}
];

If I beautify the following:

var arr = [
'a',
'b'
];

It indents correctly:

var arr = [
        'a',
        'b'
];

I don't think functions in an array should be indented differently to other types.

Thanks!

@bitwiseman
Copy link
Member

Agreed, this is a bug.
Right about at https://github.com/einars/js-beautify/blob/master/js/lib/beautify.js#L1128 .
Need to exempt array literals and add tests.

@badsyntax
Copy link
Author

Thank you! This works great.

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

No branches or pull requests

2 participants