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 codemod to replace object-keys #5

Merged
merged 3 commits into from
Jul 18, 2024

Conversation

camchenry
Copy link
Contributor

This adds a codemod replacement for the object-keys module. This is my first time writing a codemod, so let me know if there's anything I can do to improve this code.

I've also added some improvements to the codebase that I think will be generally useful:

  • Returned the identifier name from removeImport so that it will work even if the import is renamed to something than what is conventional
  • Added some types to removeImport

@@ -1,5 +1,6 @@
import jscodeshift from "jscodeshift";
import { removeImport } from "../shared.js";
import { log } from "console";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was this intentional? 🤔 I don't see it used anywhere, shall we remove it? 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just went ahead and removed it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh it definitely was not, thanks 😅


// Return the identifier name, e.g. 'fn' in `import { fn } from 'is-boolean-object'`
// or `var fn = require('is-boolean-object')`
const identifier =
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice 👍

@thepassle
Copy link
Collaborator

LGTM! Thanks for the PR! One small comment, I think an accidental import made its way into the code. If we remove that, this is good to merge :) Nice work!

@thepassle thepassle merged commit 7e70c25 into es-tooling:main Jul 18, 2024
2 checks passed
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