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

Add import comments to all samples #207

Merged
merged 3 commits into from
Jul 12, 2024
Merged

Add import comments to all samples #207

merged 3 commits into from
Jul 12, 2024

Conversation

hsubox76
Copy link
Collaborator

ESM requires import statements to only occur once, at the top of each file. Since we have multiple samples in each file, we use comments to indicate to users which imports are needed for each sample, and what the import statements should be.

I wrote a script (insert-import-comments.js) to parse each sample and identify which symbols it needs to import, and from which path, and add the comments, and ran the script.

I also abstracted the code that parses function info and shared it between the new script and the check-samples.js script.

@hsubox76 hsubox76 requested a review from dlarocque July 11, 2024 20:04
@hsubox76 hsubox76 marked this pull request as ready for review July 11, 2024 20:10
Copy link
Collaborator

@dlarocque dlarocque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool script

@hsubox76 hsubox76 merged commit 803071b into main Jul 12, 2024
8 checks passed
@hsubox76 hsubox76 deleted the ch-insert-imports-2 branch July 12, 2024 18:50
hsubox76 added a commit that referenced this pull request Jul 12, 2024
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.

2 participants