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

Determine (un)supported ES6 features #175

Open
brettlangdon opened this issue Oct 27, 2015 · 5 comments
Open

Determine (un)supported ES6 features #175

brettlangdon opened this issue Oct 27, 2015 · 5 comments

Comments

@brettlangdon
Copy link
Contributor

To try and help determine if #122 can be closed or not. It would be nice to add examples of some major ES6 features into the examples directory to help ensure that jsfmt can handle everything just fine.

There is probably a better place to grab examples from, but I was just going to grab most of the examples from http://es6-features.org/ and toss them into examples/es6.

Open to thoughts/suggestions from those who are using ES6 much more than I am.

@brettlangdon
Copy link
Contributor Author

Seeing a few issues already for unsupported ES6 features:

  • Destructuring - Array Matching
  • let
    • Most of the examples from http://es6-features.org/ do not have semi-colons after let statements, jsfmt doesn't like that very much
  • For-of
    • http://es6-features.org/#IteratorForOfOperator
    • for (let n of fibonacci) {
    • jsfmt likes to move let down to the next line
    • jsfmt also likes to always put a newline before of, so the more times you run jsfmt the more newlines you will have

I'm sure I'll find more as I go along.

@brettlangdon brettlangdon changed the title Add ES6 examples Determine (un)supported ES6 features Nov 12, 2015
@christopherobin
Copy link

One I found this morning: assigning a class definition breaks the indentation.

Input:

exports.Test = class Test { foo() { console.log('bar'); } };

Expected Output:

exports.Test = class Test {
  foo() {
    console.log('bar');
  }
};

Current Output:

exports.Test = class Test {
foo() {
  console.log('bar');
}};

[email protected], [email protected]

@brettlangdon
Copy link
Contributor Author

Hey @christopherobin thank you for reporting this.

@sowdri
Copy link

sowdri commented Jan 22, 2016

var [ variable1, variable2, ..., variableN ] = array;
var [,,third] = ["foo", "bar", "baz"];

Formatting fails for any of the above lines as well.

@ariya
Copy link
Contributor

ariya commented Mar 3, 2016

@sowdri Your first example is a bit strange: what syntax feature would you expect to get there?

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

No branches or pull requests

4 participants