Skip to content

Convert the "Taxonomy" app to 100% TypeScript #2025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented May 22, 2025

Description

This is a PR generated 95% by Claude Code to convert the taxonomy app in frontend-app-authoring to TypeScript.

Supporting information

Prompts:

Go through the files in src/taxonomy/ and convert each .jsx file to a .tsx file. Convert propTypes to TypeScript types, and replace defaultProps with ES6 default parameters.

(It created new .tsx files, but didn't delete the old .jsx)

I see the new converted .tsx files, but the .jsx files are also still there.

Great! Please check the result with 'npm run types'

commit the changes, using a conventional commits message like "refactor: convert taxonomy app to TypeScript"

(Then I noticed it hadn't converted some .js files)

Please run: find src/taxonomy -name '*.js'

(this made the AI realize it had missed a few files, and it then converted them and committed changes all on its own. In retrospect, I did say to only convert '.jsx' not '.js and .jsx' so that was an incomplete instruction.)

Please lint the code with npm run lint, and fix the errors

( I pushed, and GitHub CI showed a test failure)

Please run 'npm test -- --coverage=no --bail src/taxonomy/manage-orgs/ManageOrgsModal.test.tsx' and fix the test error it gives.

(It made a fix that I didn't like)

Let's revise that last fix to ManageOrgsModal.test.tsx. I'd like you to solve it differently. The 'orgs' value was defined fine, and I prefer that we use it instead of repeating the definition. The problem is this, from the Jest docs: 'A limitation with the factory parameter is that, since calls to jest.mock() are hoisted to the top of the file, it's not possible to first define a variable and then use it in the factory. An exception is made for variables that start with the word 'mock'.' So we need to instead rename the 'orgs' variable to 'mockOrgs' and same for the 'taxonomy' variable.

OK, please run the linter and make sure it's passing, then amend the previous commit with those changes.

Testing instructions

Manually verify the taxonomy UI is functional and unchanged.

Other information

Inspired by @regisb - https://discuss.openedx.org/t/i-just-spent-13-5-for-type-annotations-on-2-8k-lines-of-code-and-i-think-you-should-too/15977

bradenmacdonald and others added 3 commits May 22, 2025 10:51
Convert all JSX files in the taxonomy module to TypeScript:
- Replace PropTypes with TypeScript interfaces
- Replace defaultProps with ES6 default parameters
- Add proper type annotations for variables, parameters, and return values

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Convert mock files in __mocks__ directory to TypeScript
- Convert api.js in manage-orgs/data directory to TypeScript
- Fix type issues to pass TypeScript type checking

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald!

This repository is currently maintained by @bradenmacdonald.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels May 22, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions May 22, 2025
- Remove unused imports
- Fix line length issues
- Add missing newlines at end of files
- Fix other linting issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions May 22, 2025
- Use inline values in mock implementations instead of referencing variables
- Fixes "Cannot access variable before initialization" error

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

codecov bot commented May 22, 2025

Codecov Report

Attention: Patch coverage is 98.46154% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.97%. Comparing base (9e97805) to head (af0a18e).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/taxonomy/import-tags/ImportTagsWizard.tsx 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2025      +/-   ##
==========================================
+ Coverage   93.95%   93.97%   +0.01%     
==========================================
  Files        1154     1155       +1     
  Lines       24116    24204      +88     
  Branches     5219     5232      +13     
==========================================
+ Hits        22659    22746      +87     
+ Misses       1389     1381       -8     
- Partials       68       77       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bmtcril
Copy link

bmtcril commented May 27, 2025

Hi @bradenmacdonald I just wanted to make sure that you get a chance to review the brand new policy on AI code as you move forward with this: https://openedx.atlassian.net/wiki/spaces/COMM/pages/5022416899/Open+edX+Policy+for+Generative+AI+Tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U
Projects
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

3 participants