pbomb / flow-immutable-models

Generates model classes from Flow types using Immutable.js
42 stars 8 forks source link

Option to separate model from generated file #21

Closed peggyrayzis closed 7 years ago

peggyrayzis commented 7 years ago

Hi! Really great work on this codemod, @rgbkrk and I have had fun experimenting with it!

One thing we're worried about is the discoverability of our code after generating the model file. We see typing as a way to provide documentation for newcomers joining the project, but the current output after running the codemod feels a bit intimidating.

Would it be possible to decouple the models from the generated classes, maybe by moving them into their own file?

pbomb commented 7 years ago

This tool is based on jscodeshift and I didn't see a trivial way to generate the class in a different file. However, I've grown to like the current approach. Is there anything else that can be done to make the current approach feel less intimidating? Can you tell me why you think it is intimidating?

rgbkrk commented 7 years ago

Ah, didn't realize that was a jscodeshift thing. I'm used to Go where generated code ends up in a separate file and one file lists the instructions for generating it.

I'm guessing we can make it less intimidating with introductory comments (on our part) for the ModelType declarations. So long as people are using an IDE that supports flow well, they'll gain the benefits of it without having to even see these classes.

peggyrayzis commented 7 years ago

Since it's not an easy fix and we don't need it that bad, I'm going to close this issue.