Skip to content
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

Helper documentation/restructure POC #811

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thatblindgeye
Copy link
Collaborator

@thatblindgeye thatblindgeye commented Jan 10, 2025

Towards #722 and #725.

For the documentation, we can build upon jsdocs basically. The main thing is the description of the helper function: it should include where it is typically called (inline, at the top of a specific block, as a reference to the create method, etc), and the typical use case ("paired with other logic to conditionally do X or Y").

For the restructuring, I went with the intent of separating things out into their own files as much as possible, then from there creating directories for things that belong together. In this draft for example, the testHelpers file is split into 3 separate files with each housed in a testHelpers directory (the JSXAttributes file would be split out similarly, I only added some documentation there for now). The getImportPath helper, though, may not really fit in with any other helpers and would remain in the main helpers directory.

One question could be what we want to do with things that may not be used elsewhere, e.g. the checkMatchingImportDeclaration helper has a checkSpecifierExists function that's only used for that helper. We could just move those things to their own file as well -- worse case it's an extra file, best case maybe that file itself can be used elsewhere as well. I don't have a strong opinion either way.

This PR also includes some tweaks I had made when I was originally working on a new modal codemod - namely the new getCodeModDataComment helper and some tweaks to the checkMatchingImportDeclaration helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant