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

Replacements and scopes #80

Open
LarsDenBakker opened this issue Aug 2, 2024 · 1 comment
Open

Replacements and scopes #80

LarsDenBakker opened this issue Aug 2, 2024 · 1 comment

Comments

@LarsDenBakker
Copy link
Contributor

LarsDenBakker commented Aug 2, 2024

I notice some of the codemods are naive in their replacements when it comes to scopes / variable shadowing.

For example let's say the module foo could be replaced with SomeStandard.foo(), we may end up doing:

From:

import foo from 'foo';

foo();

class x {
  someMethod(foo) {
    return foo();
  }
}

To:

SomeStandard.foo(); // that's correct

class x {
  someMethod(foo) {
    return SomeStandard.foo(); // that's not correct
  }
}

Do we think this is a problem, or for the few cases when this can occur we can leave it up to the developer to correct this?

@thepassle
Copy link
Collaborator

A lot of the codemods we have currently have pretty straightforward usage (mostly based on looking for usage of that package on github); import the thing, call the imported thing as a function, so as a start I think it's ok. But if we can improve on it, we can/should :)

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

No branches or pull requests

2 participants