Repository navigation
Description
Co-ordination
As discussed in the last contributors meeting we're looking to migrate our client to TypeScript.
No files will be assigned
PRs will be prioritised by quality, then by date opened
Guidelines
Take a look at the Codebase Best Practices - kebab-case file names
Small is beautiful
If a file can be migrated on its own, that's perfect. That makes the PR incredibly easy to review and minimises the chance we break anything.
PropTypes can go
None of the components in the client directories are intended to be consumed by JavaScript components - eventually everything will be tsx. With that in mind static type checking should be enough.
React Guidelines
So, we're all on the same page: https://github.com/typescript-cheatsheets/react#readme has some useful advice. Mostly the linters will warn us, but this is definitely worth a look.
un-typed packages
If the package does not come with types attached, then please npm i the definitions (if they exist) from DefinitelyTyped. Usually they're just published as @types/name-of-package.
Do Not Ignore Linting, Unless Absolutely Necessary
We hope to leverage the type-safety that comes with TypeScript. So, do not ignore the compiler's warnings/errors. If you are stuck, feel free to reach out for help.
Keeping Git History
Sometimes changing the file from <filename>.js -> <filename>.tsx? causes the original file to be deleted, and a new one created, and other times the filename just changes - in terms of Git. Ideally, we want the file history to be preserved.
The best bet at achieving this is to:
- Rename the file
- Commit with the flag
--no-verifyto prevent husky from complaining about the errors - Refactor to TS for migration, in a separate commit.
Note: Editors like VSCode are still likely to show you the file has been deleted and a new one created. If you use the CLI to git add ., then VSCode will show the file as renamed in stage
Tests are running
We will not be merging any PRs with failing tests.
Files that should not be migrated (yet)
gatsby-node.jsgatsby-config.jsand relatedredux/*
To finish migrating the client, we would need additional tooling to handle gatsby-config, gatsby-node and files they import. This could either be an extra tsc compilation step or potentially via ts-node. However, I'm not sure if ts-node would integrate nicely with gatsby develop or gatsby build, so the compilation approach is probably easier.
Before going ahead with this, we should profile gatsby develop and gatsby build to make sure that the time to develop and build the site do not increase too much.
More guidelines may get added
As we do this, chances are we'll revise the approach. Any thoughts/comments/critiques are welcome, but I wanted to keep this straightforward for now.
List of Files To Migrate
- /client/src/templates/Challenges/utils/worker-executor.js
- /client/src/templates/Challenges/utils/worker-executor.test.js
- /client/src/templates/Challenges/rechallenge/transformers.js
- /client/src/__mocks__/react-i18next.js
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
RobertoMSousa commentedon Oct 8, 2021
@ShaunSHamilton I can help. If there's anything available 😉
majestic-owl448 commentedon Oct 8, 2021
@RobertoMSousa now it's back to usual, without assignments, as it says in the first post. PRs will be prioritized by quality and date opened.
In short, go for it with what you feel like with the non assigned files
RobertoMSousa commentedon Oct 8, 2021
Should we keep the migration by component or can we merge them on a single PR?
It's a little spam create 2 PR with so little changes 😅
#43783
#43784
But on the other hand, it's easier to review and keep track of possible bugs.
ojeytonwilliams commentedon Oct 8, 2021
@RobertoMSousa Don't worry, it's not spam. Small PRs, like the ones you've submitted, are great.
sitek94 commentedon Oct 8, 2021
Hello 👋
I've just opened a small PR with migration of remaining parts of the Landing component.
If I find some more time over the weekend, and there will still be something to do, I'll try to help :)
Pranav2612000 commentedon Oct 10, 2021
I'll also like to help with this. I can see a couple of PRs already. How do I know which unassigned files are still pending?
Nirajn2311 commentedon Oct 10, 2021
@Pranav2612000 You can use this site(https://tools.freecodecamp.org) to check if an unassigned file has an open PR or not.
Ethan-Edmond commentedon Oct 12, 2021
Hey, I just tried working on throwers.js and I noticed that it's not being imported anywhere. Are there plans for this file, or should it be deleted?
AbdelilahRami commentedon Oct 13, 2021
I will work on : /client/src/components/layouts/Default.js
ojeytonwilliams commentedon Oct 13, 2021
Hi @Ethan-Edmond. Yep, that looks to be obsolete code that can be deleted.
aprilsourz commentedon Oct 13, 2021
Hi! I'll work on these files
mendaomn commentedon Oct 14, 2021
Hey, would love to take on
/client/src/templates/Challenges/components/Test-Suite.js43 remaining items
a2937 commentedon Aug 16, 2022
Thank you very much. I didn't have prior experience using Web Workers before in JavaScript. Also now I have another slight hiccup. What exactly is eventify? I believe it's some sort of EventListener/Dispatcher but don't know the exact class name at the minute. And secondly I assume the done method right here
freeCodeCamp/client/src/templates/Challenges/utils/worker-executor.js
Lines 51 to 58 in 4e5eb18
refers to the promise method defined here.
freeCodeCamp/client/src/templates/Challenges/utils/worker-executor.js
Line 96 in 4e5eb18
Edit: I am also of the assumption now Tasks are from the same codebase as Web Workers but can't find any exact matches so far.
Karorule commentedon Sep 13, 2022
Karorule commentedon Sep 13, 2022
ShaunSHamilton commentedon Sep 24, 2022
@wojtekxtx Fun fact: If you read through, this was started on the 26th of May 2021.
We welcome contribution from yourself. Also I would be interested in seeing an example of these tools.
bradtaniguchi commentedon Sep 25, 2022
???
Then why comment on this issue?🤔
bradtaniguchi commentedon Sep 25, 2022
Do you have any examples of where freeCodeCamp is a "wannabe serious" project in regards to the current TypeScript migration?
I think having some clear code examples and advice on how to improve the TS migration wouldn't be too difficult for a pro such as yourself :)
bradtaniguchi commentedon Sep 25, 2022
I believe all tasks have been accomplished by unpaid volunteers that devote their time and expertise. The fact it's getting done at all is really awesome IMO. It's not exactly easy to migrate over to a large and expansive codebase such as freeCodeCamp to TS, when there's "multiple hands in the pot" all at once. Getting it done in any form or fashion will be a big win.
I thought it was just code contributions you don't have time/effort for? Any feedback or "code reviews" would be appreciated. Even a basic code critique would be useful, especially if the product is of such "low quality". Such efforts shouldn't take any more time it takes than to respond, however such a response would positively help the platform moving forward.
Otherwise anyone can see the date this issue has been created, but very few actually contribute to the platform.
Sboonny commentedon Nov 17, 2022
While talking to Oliver about
nav-link.tsxtheme and how theconnectfunction in it expectAction<any>result.Here is a picture for clearance.
So I am wondering if it's okay to add
action.jsto the list of migration and for me to add generic types to it, or is there a reason for it to not be in the list currently?Edit: nvm, I have misread part of the section
redux/*files aren't to be migrated yetSembauke commentedon Jan 10, 2024
I am going ahead and close this as completed. These workers and transformers are not worth migrated due to the TypeScript gymnastics.