-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat(import-assertions-to-attributes
): introduce
#89
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good start! And nice test fixtures :)
I think import-assertions-to-attributes
would be a better name.
bf3be6a
to
7e1fc0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request introduces a codemod to update import assertions by replacing the legacy "assert" attribute with the new "with" syntax, while also adding tests and updating project configuration files.
- Implements transformation logic for both static and dynamic imports in src/workflow.ts
- Adds tests and snapshots in various formats (mjs, js, cjs, and edge cases) to verify the codemod’s changes
- Updates configuration files (tsconfig.json, package.json, .codemodrc.json, biome.jsonc) to support the new codemod
Reviewed Changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
recipes/import-assertions-to-attributes/tsconfig.json | Adds configuration for TypeScript compilation |
recipes/import-assertions-to-attributes/tests/workflow.test.ts | Introduces tests to run the codemod functionality |
recipes/import-assertions-to-attributes/tests/workflow.test.snap.cjs | Provides snapshot tests for expected codemod outcomes |
recipes/import-assertions-to-attributes/tests/fixtures/* | Contains sample files using both old and new import syntaxes |
recipes/import-assertions-to-attributes/tests/expected/* | Provides expected file outputs after codemod transformation |
recipes/import-assertions-to-attributes/src/workflow.ts | Implements the codemod logic to replace "assert" with "with" |
recipes/import-assertions-to-attributes/package.json | Defines package metadata and scripts for testing and running the codemod |
recipes/import-assertions-to-attributes/.codemodrc.json | Configures codemod runtime settings |
biome.jsonc | Updates ignore settings to exclude test fixtures and expected files |
import-attributes
): introduce import-attributes
): introduce
cc @alexbit-codemod What I have produced is still different from what CodeMod studio offers. Could you give me some feedback on the best approach? |
ff1f364
to
90c99de
Compare
import-attributes
): introduce import-assertions-to-attributes
): introduce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W00t! 🙌
importNode.children().map(child => { | ||
if (child.kind() === 'assert' && child.text() === 'assert') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I expected this can be handled above in the ast grep, but it may well be a case of "6 of one, ½ a dozen of the other".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for strange reason if you use kind: 'assert'
in query it's throw an error
3c29f7c
to
9c685b1
Compare
540dc7f
to
d3b3fc3
Compare
c6d01a0
to
eb51daf
Compare
description