Skip to content

Commit f6e2d0d

Browse files
committed
[New] add support for named aliases
1 parent 615b88a commit f6e2d0d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/rules/order.js

+10
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ module.exports = {
827827
displayName: namedImport.value,
828828
rank: rank === -1 ? named.groups.length : rank,
829829
...namedImport,
830+
value: `${namedImport.value}:${namedImport.alias || ''}`,
830831
};
831832
});
832833

@@ -866,6 +867,9 @@ module.exports = {
866867
value: specifier.imported.name,
867868
type: 'import',
868869
kind: specifier.importKind,
870+
...specifier.local.range[0] !== specifier.imported.range[0] ? {
871+
alias: specifier.local.name,
872+
} : {},
869873
})));
870874
}
871875
}
@@ -932,6 +936,9 @@ module.exports = {
932936
node: prop,
933937
value: prop.key.name,
934938
type: 'require',
939+
...prop.key.range[0] !== prop.value.range[0] ? {
940+
alias: prop.value.name,
941+
} : {},
935942
})),
936943
);
937944
}
@@ -947,6 +954,9 @@ module.exports = {
947954
value: specifier.local.name,
948955
type: 'export',
949956
kind: specifier.exportKind,
957+
...specifier.local.range[0] !== specifier.exported.range[0] ? {
958+
alias: specifier.exported.name,
959+
} : {},
950960
})));
951961
},
952962
} : {},

0 commit comments

Comments
 (0)