millermedeiros / esformatter

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

Make `standard` preset #429

Open trajano opened 8 years ago

trajano commented 8 years ago

Can we have a preset that would satisfy standard? I got a few though I am still missing one.

whiteSpace: {
  after: {
    FunctionName: 1,
    FunctionReservedWord: 1,
    MethodDefinitionName: 1
  }
}

The one that is missing would be these (from Meteor created app)

Template.hello.helpers({
  counter() {
    return Template.instance().counter.get()
  }
})

Template.hello.events({
  'click button'(event, instance) {
    // increment the counter when button is clicked
    instance.counter.set(instance.counter.get() + 1)
  }
})

The standard expects it to be

Template.hello.helpers({
  counter () {
    return Template.instance().counter.get()
  }
})

Template.hello.events({
  'click button' (event, instance) {
    // increment the counter when button is clicked
    instance.counter.set(instance.counter.get() + 1)
  }
})
millermedeiros commented 8 years ago

standard-format is built on top of esformatter, maybe that's what you're looking for?

PS: in the ideal world, standard-format would be just a esformatter preset - I'm going to improve out plugin/preset structure to make it easier to share configs between teams/projects.

trajano commented 8 years ago

I think I had trouble using https://github.com/maxogden/standard-format/ with gulp which is why I opted for your project. Especially since your project seems to handle ES6 quite nicely.