jsformat-atom icon indicating copy to clipboard operation
jsformat-atom copied to clipboard

Object 'shorthand' incorrectly applying space

Open stweedie opened this issue 8 years ago • 1 comments

Formatting files that use object 'shorthand' notation will result in weird object spacing.

For instance,

var foo = 0;
var object = {
  foo,

  bar: 1,
  baz: 2
};

will format to

var foo = 0;
var object = {
  foo,

  bar: 1,
    baz: 2
};

where the 'baz' property (and all further properties) will have one additional level of indent. Commenting out the 'foo' property or not using shorthand will produce expected results, so

var foo = 0;
var object = {
  foo: foo,

  bar: 1,
  baz: 2
};

Airbnb's style guide for more information

stweedie avatar Mar 17 '16 16:03 stweedie

If this is ES6, I'm not sure if it's supported. JS-Beautify is our formatting engine, so it needs to be supported by that for it to work.

ilanbiala avatar Mar 17 '16 18:03 ilanbiala