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

Code cleanup: type-taking helpers #68

Open
domenic opened this issue Sep 4, 2019 · 0 comments
Open

Code cleanup: type-taking helpers #68

domenic opened this issue Sep 4, 2019 · 0 comments
Milestone

Comments

@domenic
Copy link
Collaborator

domenic commented Sep 4, 2019

Currently we have a couple helpers which change their behavior depending on the type of construct:

  • replaceNodeAndUpdateImports
  • generateImportText
  • updateImports
  • getOriginal
  • formatReplacement

These are generally inconsistent in what parameters they take, and in what order. Furthermore, in some cases some of the parameters are unused, e.g. the 'constructor' type requires much less information than others.

We should change all of these (or at least most?) to have a signature like (type, ... any other information that doesn't depend on type ..., options), where options contains the relevant type-specific information. For example, getOriginal(type, { name, module }) is nice, because for type = 'constructor', you don't need module. (This might also be an opportunity to improve the naming of the arguments... e.g. name of what?)

@domenic domenic added this to the Polish milestone Sep 4, 2019
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

1 participant