c2c_ui icon indicating copy to clipboard operation
c2c_ui copied to clipboard

Typescript

Open cbeauchesne opened this issue 7 years ago • 14 comments

Migrate all scripts from javascript to typescript.

For a pure stats purpose :

  • 94 js files for 4700 codes lines
  • 197 vue files, for 12,800 code lines (but probably only a third of js)

cbeauchesne avatar Jan 06 '19 18:01 cbeauchesne

I've assigned it to myself, as I will try to migrate step by step. But everyone's help is appreciated :)

Chose a file, translate it to ts, do all necessary checks, and PR!

cbeauchesne avatar Jan 06 '19 18:01 cbeauchesne

How to know which files you may be working on?

brunobesson avatar Jan 06 '19 18:01 brunobesson

Mmmmh, good question :)

Opening an issue for each file would be an overkill I think. What about a message on this thread before starting a file (.js or .vue) /folder ?

cbeauchesne avatar Jan 06 '19 18:01 cbeauchesne

Could another approch be possible? What about working in a branch, in which everyone can commit (maybe using PRs) until we reach a stisfactory status? I am proposing this because I have had som problem to make linting coexist for both js and ts (and thus eslint and tslint). If I add a tslint config file, it is ignore by npm run lint but used by npm run build. I assume having both eslint and typescript plugins are causing some inconsistencies... So maye we could migrate code to typescript in a branch, disabling eslint and using only typescript plugin? tslint config would require some coniguration anyway.

What do you think?

brunobesson avatar Jan 06 '19 20:01 brunobesson

The issue I would see is if we have to do some modification on a scripts still migrated to typescript during the next weeks : we will have a lot of demands from users in the next week for the "ergonomic phase". We can't keep this two branchs on a different functionnal and ergonomic state during the project.

I never do this task (js -> ts). We have around 10,000 code lines. In your opinion, how long (gross) it will take to migrate everything ?

cbeauchesne avatar Jan 06 '19 22:01 cbeauchesne

I have no fucking idea :) Then, we could work with a tslint file that we do not commit?

brunobesson avatar Jan 07 '19 11:01 brunobesson

Or... we stick to eslint for now and will switch to typescript when code is more stable.

brunobesson avatar Jan 07 '19 12:01 brunobesson

Or... we stick to eslint for now and will switch to typescript when code is more stable.

Well, after more thought, it may be the best solution :

  • most of function are ready, at the end of the project, we won't have no more 120% code lines than now.
  • but still a big bunch of lines may change for next weeks. Trying to reach the two goals (deliver the project + migrate it to ts) is probably the best solution to miss the two targets...

If you're okay with that, let's postpone this point for the first "code freeze".

cbeauchesne avatar Jan 07 '19 19:01 cbeauchesne

OK

brunobesson avatar Jan 07 '19 21:01 brunobesson

Are you still willing to migrate everything to ts?

lbesson avatar Apr 20 '20 14:04 lbesson

Mmmmh, project is postponed. I have some concern on it :

Pro

  • definitly a better language that this old'n ugly JS

Con

  • pretty big project, way out of our possibilities as now
  • ok, JS is ugly. But at least, a lot of people know it. Will the balance of benevolant dev be positive with this move ? (open question)

ping @brunobesson , @momomaniac, @asaunier ?

cbeauchesne avatar Apr 20 '20 17:04 cbeauchesne

Typescript is not a better language than javascript, just a superset. It has its pros and cons. But on the contrary to what your are saying, I do think that using typescript is easier for someone which is not fluent with JS. Adding typing is a huge help to those people. Off course, advanced features and avoiding horrible things such has any is another level, but people getting into the project will have less difficulties IMHO.

As for when to switch to typescript, I do think we should doing this when updating vuejs to version 3.

brunobesson avatar Apr 20 '20 19:04 brunobesson

are there any tools for migrating JS -> TS ? Since the codebase is quite big, this would give a good headstart for having less manual work. On the other hand, I see no hurry to so the transition. I think it's not the JS syntax which is hard to get into, but the project as a whole. JS code is quite stable and obsolescence is not foreseeable. No priority IMHO.

On Mon, Apr 20, 2020 at 9:12 PM Bruno Besson [email protected] wrote:

Typescript is not a better language than javascript, just a superset. It has its pros and cons. But on the contrary to what your are saying, I do think that using typescript is easier for someone which is not fluent with JS. Adding typing is a huge help to those people. Off course, advanced features and avoiding horrible things such has any is another level, but people getting into the project will have less difficulties IMHO.

As for when to switch to typescript, I do think we should doing this when updating vuejs to version 3.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/c2corg/c2c_ui/issues/45#issuecomment-616753177, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANY5RCTYCZA7U3H7XFREPZTRNSNBHANCNFSM4GOKEXVA .

momomaniac avatar Apr 20 '20 19:04 momomaniac

If you don't enforce some checks, js is valid ts

lbesson avatar Apr 20 '20 21:04 lbesson