dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Sort JSX `classNames` Order

Open harrysolovay opened this issue 2 years ago • 0 comments

I came across this video regarding a Prettier plugin for sorting TailwindCSS class names. Thought I might share it, incase it's a desirable feature for Dprint as well.

- <div classNames="c b a">
+ <div classNames="a b c">
    <span>Hello Dprint issues!</span>
  </div>

The one concern I'd have about this feature: it's domain-specific. This doesn't seem very applicable to JS/TS at large. But for front-end web developers, this would be quite valuable! Perhaps a config flag such as the following:

...
"typscript": {
  "jsxStringPropReorder": {
    "classNames": "alphabetical"
  }
}
...

Curious to hear anyone's thoughts.

harrysolovay avatar Feb 22 '22 17:02 harrysolovay