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?)
Currently we have a couple helpers which change their behavior depending on the type of construct:
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)
, whereoptions
contains the relevant type-specific information. For example,getOriginal(type, { name, module })
is nice, because for type = 'constructor', you don't needmodule
. (This might also be an opportunity to improve the naming of the arguments... e.g. name of what?)