jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.96k stars 513 forks source link

Should have exception for disallowSpacesInFunction for anonymous generators #2272

Closed jdforsythe closed 8 years ago

jdforsythe commented 8 years ago

I want to enforce no spaces after function or the name of the function.

function() {}
function a() {}

I want to enforce spaces before and after the star for generators.

function * () {}
function * a() {}

I have the rules:

{
  "disallowSpacesInFunction": {
    "beforeOpeningRoundBrace": true
  },
  "requireSpacesInGenerator": {
    "beforeStar": true,
    "afterStar": true
  }
}

Everything works as expected except the anonymous generator function * () {} which errors on the disallowSpacesInFunction. I think I need something like:

{
  "disallowSpacesInFunction": {
    "beforeOpeningRoundBrace": {
      "allExcept": [ "anonymousGenerators" ]
    }
  }
}

Is there a workaround for this? Or some rule I'm missing to make this work?

markelog commented 8 years ago

Not 100% on this, but i don't think there is such workaround and at this point, we are not committed to adding new features, sorry