jorgebucaran / classcat

Build a class attribute string quickly
MIT License
906 stars 22 forks source link

codemod? #7

Open VinSpee opened 6 years ago

VinSpee commented 6 years ago

I started tinkering with a codemod to replace JedWatson/classNames with classwrap re: this comment.

JSCodeShift hurts my head.

progress so far: http://astexplorer.net/#/gist/0373f05229963c3e336b5eec91818479/3718f610fc2e9982a934da242a35104be0947312

may there be weeping and gnashing of teeth.

jorgebucaran commented 6 years ago

@VinSpee That would be awesome to have, we could put it on the README to instruct users how to migrate from classNames to classwrap.

jorgebucaran commented 6 years ago

BTW I edited your post to clarify it. Make sure that's what you meant though. It took me more than a moment to understand what you were after. 👋😄

zachariahtimothy commented 6 years ago

Just wanted to pop in and say THANK YOU for creating this library @jorgebucaran . I spent far too many hours trying to get classnames play nicely with TS and TS-Jest. I replaced classnames with this library and 15 minutes later I am up and running. Thanks again!

zachariahtimothy commented 6 years ago

I did look for the "buy me a beer" button on the home page :)

jorgebucaran commented 6 years ago

@zachariahtimothy There isn't one, but you can ⭐️ the repo to show your appreciation! 😉🍻

silouanwright commented 4 years ago

I've been using this library for quite sometime, and I've always wanted to learn codeshift and make this happen:

https://gist.github.com/reywright/e17ada1c068c972d410774b957ada75c https://astexplorer.net/#/gist/101109ef50bd59758e55975fb9aa31b6/769082c5c84f50844c7b0bf85a3a6e9f3692ed83

This is a very naive conversion that assumes you don't need recursive flattening, and that you're only using a single object for conditionals. Just started learning codeshift but let me know what you think, and happy to try to make modifications to this. If one of the maintainers gives me some help and guidelines, it would be sweet to become a contributor on this and close this last issue.

cc @jorgebucaran

jorgebucaran commented 4 years ago

@reywright Looks very promising Rey! Nice work.