imnapo / react-native-cn-richtext-editor

Richtext editor for react native
MIT License
218 stars 114 forks source link

Typescript migration ? #31

Open jsamr opened 5 years ago

jsamr commented 5 years ago

First of all ; thanks so much for this amazing work!

If you're interested in migrating this repo to Typescript, I would be glad to participate. I was also thinking about using a linter, as the source code is sometimes missing style consistency and a bit difficult to read.

ohpax commented 5 years ago

To be honest we doubt about moving to Typescript at this point and we should think and talk about that a little bit more. But, I agree that Linter will benefit us a lot. I would say go ahead and make pr for that. I am happy that you are also excited as much as we are and you like to contribute to this project.

jsamr commented 5 years ago

@ohpax In my experience, typescript projects are much easier to maintain in the middle-long run. The "cost" is working on types which has it's own learning curve. I've been using Typescript in my projects for 3 years now, and I'm really glad I did.

Anyway, that's of course up to you! On the linter side, do you have presets / preferences ? I'm usually using airbnb javascript guide.

ohpax commented 5 years ago

For the Linter I also like the airbnb one, let's go with that. I don't think we will have any issue with using types because our first language is C# but our main issue is the most react libraries and examples are on plain Javascript and there might be more people who are interested to contribute if its plain JS. I have used some Typescript before and I like it. What do you think @imnapo ?

jsamr commented 5 years ago

I can tell you a vast majority of RN libraries offer typings ; and some of them are written / migrating to typescript (example hereand here). Typescript is supported by React Native (you can use the --template=typescript flag with react-native init). However, your concern about contributions is legitimate, even though TS is relatively easy to learn.

We could also offer flow types with tools such as flowgen.

EDIT Some stuff I really like about TS (which should be true about flow too):

imnapo commented 5 years ago

There is no doubt about advantages of using TypeScript but I'm agree with @ohpax about keep this package in javascript, at least for a while until we have more contributors. but we can support typing like other packages written with JavaScript having type definitions. (like react-native-elements) For the Linter side I also like the airbnb, so we can go with it.

And also thank you very much for your active participation and contribution.

jsamr commented 5 years ago

@imnapo OK ; I'll work on eslint integration :slightly_smiling_face: I already wrote typings for this package ; I'll wait to test those a bit more before offering a PR.

jsamr commented 5 years ago

@imnapo I've started working on eslint ; it seems like there are both yarn and package-lock ; this is probably unwanted ; which package manager would you pick ?

imnapo commented 5 years ago

I would personally prefer yarn.