max-mapper / standard-format

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

generator-star-spacing doesnt space itself in some instances #114

Closed 2c2c closed 7 years ago

2c2c commented 9 years ago
function* spiderLinks (currentUrl, body, nesting) {
  if (nesting === 0) {
    return yield nextTick()
  }
  var links = utilities.getPageLinks(currentUrl, body)
  for (var i = 0; i < links.length; i++) {
    yield spider(links[i], nesting - 1)
  }
}

co(function* () {
  try {
    yield spider(process.argv[2], 1)
    console.log('Download complete')
  } catch(err) {
    console.log(err)
  }
})()

standard-formatter will only correct the generator inside the co() call

sidenote: no space > space in terms of appearance :-1:

itsnotvalid commented 8 years ago

Is this bug taken cared of yet?

For the case above, after adding the space manually after function ( function* -> function * ), it happens that standard-format would revert it back to the wrong form triggering generator-star-spacing error.

Thanks.

feross commented 8 years ago

This is a probably still an issue (I haven't confirmed). If someone would like to work on it, you'll need to see if esformatter has a rule for this and change the config.

Folks who send good PRs get added as collaborators to the repo :)

wires commented 8 years ago

I can confirm that in blocks like below, catch doesn't get an extra space between ch and (

try {
  // bla bla
} catch(err) {
  // foo faa
}

(ps. great tool! thanks!)

feross commented 7 years ago

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