Strip Flow's new shorthand import-type specifiers

This commit is contained in:
Jeff Morrison
2016-12-24 17:30:13 -06:00
parent d2113d4881
commit b820d8ebc9
4 changed files with 13 additions and 2 deletions

View File

@@ -12,7 +12,7 @@
"babel-messages": "^6.8.0",
"babel-runtime": "^6.20.0",
"babel-types": "^6.21.0",
"babylon": "^6.11.0",
"babylon": "^6.15.0",
"debug": "^2.2.0",
"globals": "^9.0.0",
"invariant": "^2.2.0",

View File

@@ -105,7 +105,7 @@ export let Pure = {
};
export let Flow = {
types: ["Flow", "ImportDeclaration", "ExportDeclaration"],
types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"],
checkPath({ node }: NodePath): boolean {
if (t.isFlow(node)) {
return true;
@@ -113,6 +113,8 @@ export let Flow = {
return node.importKind === "type" || node.importKind === "typeof";
} else if (t.isExportDeclaration(node)) {
return node.exportKind === "type";
} else if (t.isImportSpecifier(node)) {
return node.importKind === "type" || node.importKind === "typeof";
} else {
return false;
}