dprint-plugin-typescript
dprint-plugin-typescript copied to clipboard
feat: make class prop decorators inline
Changes this:
@$.element()
class Foo extends HTMLElement {
@$.attr()
color = 'blue'
@$.attr()
another = 123
@$.attr()
withCapital = true
button?: HTMLButtonElement
result?: number = 123
to this:
@$.element()
class Foo extends HTMLElement {
@$.attr() color = 'blue'
@$.attr() another = 123
@$.attr() withCapital = true
button?: HTMLButtonElement
result?: number = 123
The tests pass however I'm not 100% confident that it won't produce invalid code in some combination of modifiers or other occassions. We need probably more tests? Should I try and add them?
Thanks, but I don't think we should do this since prettier doesn't do it. Instead I think we should copy prettier's behaviour and leave decorators on the same line that they appeared or revert back to the previous line if the property is long: https://prettier.io/playground/#N4Igxg9gdgLgprEAuEABAJAOjgGzgWwRgAoBKAHSjBwEMBnOgAgDEIJG4APeKAEyYASAFQCyAGQCieQrEbBKjRhkw0YMAE5kFjSDgjrGAXkYByAEY4ArnBPblqjWUY0oEGAAs46oXF9--AYFBwSHBdDBGjACMAEwAzHZYDpqkzq4eXpGxCVCK9mop2gDuAJYeAMI0AA5lNDiRGtaU2maWatAA-EiMwuIAQm0w0FIERNrqcHSWODBdjFCW+GaZxtmUAL4gADQgEFUwJdB0yKA06uoQRQAKZwjHKHVFNACexztm6jRgANZwMADKNEIYhKUDgyAAZnU6HB3p8fn9-lUvqCAObIRqwkAEZa8XhwXhiFyoyw0VFwVjqfAONHIEA0NoQbYgdwwfA4ADq7jKk2RYDg-zuZRKADcys86WAGMzQTD1DArp9UdTIdCsQArOicf5ovAARUsbnBSChOBhO2R6jldJgzyqkzA6hK+2ZVSdsA5JV4HmQAA4AAwWi4wjmfKp0t2TLwi8E7ACOhvgir293pdAAtGCCQTmRMEyUJoqySqTWqdjD8CUMeprOXdXADUbVWasTAaGZPd73MgYjsNDQSjg0eUIPgS9i6ABWZmWGFCdv3U3mkAi6wAST4RH+judMAAgnx-ra8M2Yet1kA
Yes that would be ideal. Any ideas how to go about it?
Can this be enabled optionally via config in the meantime? This feature is essential for following Angular style guidelines