Closed IanVS closed 1 year ago
@andidev, if you'd like to test this out in your project, you can find this package in your node_modules and update convertImportSpecifierToType
in lib/src/utils/merge-nodes-with-matching-flavors.js
to:
function convertImportSpecifierToType(node) {
(0, assert_1.default)(node.importKind === 'value' ||
node.importKind === 'type' ||
// importKind can be null when using Flow
node.importKind === null);
node.importKind = 'type';
}
Thanks @fbartho. I'll give @andidev, a bit longer to hopefully test this out, because I have a feeling there could be other issues with Flow, and it would be good to confirm whether that's the case or not.
We have a large code base and it seems to work well except this setting. But maybe there is more specific cases related to this setting. But to be honest ai don't think so.
Fixes https://github.com/IanVS/prettier-plugin-sort-imports/issues/56
I needed to loosen the assertion a bit, because Flow's AST does not apparently use an
importKind
of"value"
for specifiers, instead it isnull
.I also added an e2e test here, for both Flow and TypeScript.