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

ES6 concise method not propely indented #647

Closed
fabien-h opened this issue Mar 12, 2015 · 8 comments
Closed

ES6 concise method not propely indented #647

fabien-h opened this issue Mar 12, 2015 · 8 comments

Comments

@fabien-h
Copy link

In an object literal, classic methods are correctly indented :

let o2 = {
    a: function () {
        return 1;
    },
    b: function () {
        return 2;
    },
    c: function () {
        return 3;
    }
};

Concise methods does not work that well :

let o = {
    a() {
            return 1;
        },
        b() {
            return 2;
        },
        c() {
            return 3;
        }
};

After the first method, there's one additional indent. Not a major issue, but it makes objects look weird.

@bitwiseman
Copy link
Member

ES6 is only partially supported and lower priority. PRs welcome.

@pgilad
Copy link

pgilad commented Apr 29, 2015

👍

@bitwiseman
Copy link
Member

Implementation notes: we currently recognize ObjectLiterals based on {, name, then :. If we modify that for locations where we expect to find a value (assignment). This will be more imprecise than usual, but would still address this.

http://es6-features.org/#MethodProperties

@mike-post
Copy link

This is actually a big bug for ember developers, not an enhancement. In ember, all code is defined as a module therefore all code is defined as an object literal. I just ran into this an it's making me look around for a beautifier that supports ES6 due to the pain. :/

@bitwiseman
Copy link
Member

@mike-post,
Yeah, it's really unfortunate, but it also non-trivial.
PRs welcome and appreciated.

@Kilowhisky
Copy link

+1 for ember issues.

Never looked at this project before but maybe i'll take a swing at it.

@bitwiseman bitwiseman added this to the v1.6.0 milestone Jan 29, 2016
@bitwiseman
Copy link
Member

Looks like this might be fixed already in the upcoming release. Try out your code on jsbeautifier.org.

@bitwiseman
Copy link
Member

Yup, this is covered by the fix for #602

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

5 participants