Prettier: Decorators inlined with function declaration, really?

Created on 3 Jun 2017  Â·  3Comments  Â·  Source: prettier/prettier

It may be desired style here, but I'm having a hard time finding inlining decorators, as introduced in 1.4, a really good idea:

Source:

class Yo {
  @foo("hello")
  async plop() {}

  @anotherDecoratorWithALongName("and a very long string as a first argument")
  async plip() {}
}

Using latest 1.4.1:

class Yo {
  @foo("hello") async plop() {}

  @anotherDecoratorWithALongName(
    "and a very long string as a first argument"
  ) async plip() {}
}

https://prettier.github.io/prettier/#%7B%22content%22%3A%22class%20Yo%20%7B%5Cn%20%20%40foo(%5C%22hello%5C%22)%5Cn%20%20async%20plop()%20%7B%7D%5Cn%20%20%5Cn%20%20%40anotherDecoratorWithALongName(%5C%22and%20a%20very%20long%20string%20as%20a%20first%20argument%5C%22)%5Cn%20%20async%20plip()%20%7B%7D%5Cn%7D%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Afalse%2C%22trailingComma%22%3A%22none%22%2C%22bracketSpacing%22%3Atrue%2C%22jsxBracketSameLine%22%3Afalse%2C%22parser%22%3A%22babylon%22%2C%22semi%22%3Atrue%2C%22useTabs%22%3Afalse%2C%22doc%22%3Afalse%7D%7D

locked-due-to-inactivity has pr bug

All 3 comments

That's not at all intentional. We should fix this. We intentionally inline them for properties.

I just published 1.4.2 with this fix.

Thanks, that was fast, you folks rock!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SimenB picture SimenB  Â·  3Comments

poteto picture poteto  Â·  3Comments

brigand picture brigand  Â·  3Comments

grgur picture grgur  Â·  3Comments

jasonkuhrt picture jasonkuhrt  Â·  3Comments