diff --git a/src/transforms/v2-to-v3/modules/getImportSpecifier.ts b/src/transforms/v2-to-v3/modules/getImportSpecifier.ts deleted file mode 100644 index 22e2a524a..000000000 --- a/src/transforms/v2-to-v3/modules/getImportSpecifier.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { JSCodeshift } from "jscodeshift"; - -import { ImportSpecifierPattern } from "./types"; - -export const getImportSpecifier = ( - j: JSCodeshift, - { importedName, localName }: ImportSpecifierPattern -) => - localName - ? j.importSpecifier(j.identifier(importedName), j.identifier(localName)) - : j.importSpecifier(j.identifier(importedName)); diff --git a/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts b/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts index 7d021bea5..1d5079e94 100644 --- a/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts +++ b/src/transforms/v2-to-v3/modules/importModule/addNamedModule.ts @@ -8,7 +8,6 @@ import { } from "jscodeshift"; import { OBJECT_PROPERTY_TYPE_LIST, PACKAGE_NAME } from "../../config"; -import { getImportSpecifier } from "../getImportSpecifier"; import { getImportSpecifiers } from "../getImportSpecifiers"; import { getRequireProperty } from "../getRequireProperty"; import { importSpecifierCompareFn } from "../importSpecifierCompareFn"; @@ -101,7 +100,9 @@ export const addNamedModule = ( // Add named import to the first import declaration. const firstImportDeclSpecifiers = importDeclarations.nodes()[0].specifiers; if (firstImportDeclSpecifiers) { - firstImportDeclSpecifiers.push(getImportSpecifier(j, { importedName, localName })); + firstImportDeclSpecifiers.push( + j.importSpecifier(j.identifier(importedName), j.identifier(localName)) + ); firstImportDeclSpecifiers.sort(importSpecifierCompareFn); return; } @@ -109,7 +110,7 @@ export const addNamedModule = ( // Build a new import declaration. const v3ImportDeclaration = j.importDeclaration( - [getImportSpecifier(j, { importedName, localName })], + [j.importSpecifier(j.identifier(importedName), j.identifier(localName))], j.stringLiteral(packageName) );