millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

Incorrectly format on a switch case #456

Closed felixhao28 closed 8 years ago

felixhao28 commented 8 years ago

Esformatter formats this (expected)

const a = {
  g() {
    switch (x) {
      case 1:
        ret = 0;
        break;
    }
  },

  f() {}
};

into this:

const a = {
  g() {
    switch (x) {
      case 1: ret = 0;
        break;
    }
  },

  f() {}
};

I think it is a bug because if f() {} is removed then it works as expected.

millermedeiros commented 8 years ago

thanks for reporting the bug! we did not have any special code to handle the method syntax!