Skip to content

Commit

Permalink
[no-duplicates] Prefer combined type and regular imports when using p…
Browse files Browse the repository at this point in the history
…refer-inline
  • Loading branch information
benkrejci committed Jul 19, 2023
1 parent 3a5ad34 commit 91c935a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rules/no-duplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,11 @@ module.exports = {
});
}
const map = moduleMaps.get(n.parent);
if (n.importKind === 'type') {
const preferInline = context.options[0] && context.options[0]['prefer-inline'];
if (!preferInline && n.importKind === 'type') {
return n.specifiers.length > 0 && n.specifiers[0].type === 'ImportDefaultSpecifier' ? map.defaultTypesImported : map.namedTypesImported;
}
if (n.specifiers.some((spec) => spec.importKind === 'type')) {
if (!preferInline && n.specifiers.some((spec) => spec.importKind === 'type')) {
return map.namedTypesImported;
}

Expand Down

0 comments on commit 91c935a

Please sign in to comment.