Closed rtsao closed 1 year ago
Thanks for PR!
Can you add test for preserving comments?
Probably, you can put some test cases into https://github.com/azu/commonjs-to-es-module-codemod/tree/master/transforms/__testfixtures__ and https://github.com/azu/commonjs-to-es-module-codemod/tree/master/transforms/__tests__
Sorry, #13 cause conflict. But makes it easier to add test cases.
Preserve comments in https://github.com/azu/commonjs-to-es-module-codemod/releases/tag/v0.5.7 This PR is closed as it is simpler to re-submit the PR.
This PR ensures this codemod preserves leading comments (see https://github.com/facebook/jscodeshift/blob/main/recipes/retain-first-comment.md)
Additionally, a workaround is added for a crash resulting from a bug in
ast-types
(see https://github.com/benjamn/ast-types/issues/425#issuecomment-1007846129)