max-mapper / standard-format

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

confused with es6 getter/setter #138

Closed feross closed 7 years ago

feross commented 8 years ago

Moved from @diasdavid's issue https://github.com/feross/standard/issues/316:

It seems that when standard --formatcatches a es6 getter/setter, it changes its format and than reports a codestyle error, see example below

var log = ['test']
var obj = {
  get latest () {
    if (log.length === 0) return undefined
    return log[log.length - 1]
  }
}
console.log(obj.latest)

The right space was there, but then

» standard --format troll.js
standard: Use JavaScript Standard Style (https://github.com/feross/standard)
  /Users/david/Documents/code/standard-troll/troll.js:3:13: Missing space before function parentheses.

Fixing the problem and running standard returns no errors, but then if standard --formatis executed, it will remove the space again and report an error

la-yumba commented 8 years ago

I still see this problem, why has it been closed?

feross commented 8 years ago

@la-yumba The issue is not closed. It was moved from the standard repo to this repo, which is standard-format.

feross commented 7 years ago

You should use standard --fix instead of this package. standard-format isn't being actively maintained anymore.