max-mapper / standard-format

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

Are ES6 Classes supported? #111

Closed zeke closed 7 years ago

zeke commented 9 years ago

standard doesn't complain about my code, but standard-format seems to mangle it.

Original code:

$ cat reminder.js
'use strict'

module.exports = class Reminder {

constructor (task, time) {
  this.task = task
  this.time = time
  this.notified_at = null
}

get timeFromNow () {
  return `You know, ${this.notified_at} or whatever`
}

markAsNotified () {
  this.notified_at = new Date()
}

}

$ standard reminder.js 

$ standard --format reminder.js
standard: Use JavaScript Standard Style (https://github.com/feross/standard) 
  /Users/z/personal/remind-me/lib/reminder.js:5:12: Missing space before function parentheses.
  /Users/z/personal/remind-me/lib/reminder.js:5:12: There should be no spaces inside this paren.
  /Users/z/personal/remind-me/lib/reminder.js:11:16: Missing space before function parentheses.
  /Users/z/personal/remind-me/lib/reminder.js:15:15: Missing space before function parentheses.

$ standard reminder.js         
standard: Use JavaScript Standard Style (https://github.com/feross/standard) 
  /Users/z/personal/remind-me/lib/reminder.js:5:12: Missing space before function parentheses.
  /Users/z/personal/remind-me/lib/reminder.js:5:12: There should be no spaces inside this paren.
  /Users/z/personal/remind-me/lib/reminder.js:11:16: Missing space before function parentheses.
  /Users/z/personal/remind-me/lib/reminder.js:15:15: Missing space before function parentheses.

$ standard --version
5.2.1
bcomnes commented 9 years ago

Yes, I was running into this yesterday.

ES6 support is pretty poor at the moment for this reason. We should prioritize fixing this above the JSX stuff.

Flet commented 9 years ago

This is related too: https://github.com/maxogden/standard-format/issues/75

Some notes in there from me tinkering on this last week.

feross commented 7 years ago

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