max-mapper / standard-format

converts your code into Standard JavaScript Format
264 stars 59 forks source link

not supports ES2015 Class #126

Closed leecade closed 8 years ago

leecade commented 8 years ago
export class com extends Component {
  render () {}
}

got

export class com extends Component {
  render() {}
}

not match standard's rule

bcomnes commented 8 years ago

I think this is a duplicate of https://github.com/maxogden/standard-format/issues/111 I added some new rules in https://github.com/maxogden/standard-format/pull/125 last night that I hope will help bring better ES6 support to standard-format, but I added them in as a noop and have not had a chance to fiddle with them yet. It takes some trial and error tog get it right, but the process can potentially be pretty straight forward with these new settings.

zeke commented 8 years ago

Thanks @bcomnes. Would be awesome to see this fixed.

0x80 commented 8 years ago

It's related to esformatter as mentioned in #75. Currenly I work around it by using eslint directly with the standard rules and disabling that specific one.

{
  "parser": "babel-eslint",
  "extends": ["standard", "standard-react"],
  "rules" : {
    "space-before-function-paren": 0
  }
}
bcomnes commented 8 years ago

Hints like this are awesome, I'll try to integrate this this and whatever else i can figure out this weekend.

bcomnes commented 8 years ago

I couldn't find rule that changes this. Tracking upstream: https://github.com/millermedeiros/esformatter/issues/384

bcomnes commented 8 years ago

Another example: https://github.com/feross/standard/issues/337

const ServerBase = require('./server-base')

class ExternalServer extends ServerBase {

  getServerConfig() { return this.config.server.external }

  initRoutes() { require('./routes/external')(this.app) }

  getServerType() { return 'external' }
}

module.exports = ExternalServer