Skip to content

Commit

Permalink
fix: do not reuse type export declerations
Browse files Browse the repository at this point in the history
  • Loading branch information
nrgnrg committed Feb 10, 2022
1 parent 7d16cc0 commit 99cb224
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rules/prefer-export-from.js
Expand Up @@ -110,6 +110,7 @@ function getFixFunction({
const sourceValue = sourceNode.value;
const exportDeclaration = exportDeclarations.find(({source}) => source.value === sourceValue);
const isTypeExport = exported.node.parent.exportKind === "type"
const isTypeExportDeclaration = exportDeclaration.exportKind === "type"

/** @param {import('eslint').Rule.RuleFixer} fixer */
return function * (fixer) {
Expand All @@ -125,7 +126,7 @@ function getFixFunction({

const specifierWithKind = isTypeExport ? `type ${specifier}` : specifier

if (exportDeclaration) {
if (exportDeclaration && !isTypeExportDeclaration) {
const lastSpecifier = exportDeclaration.specifiers[exportDeclaration.specifiers.length - 1];

// `export {} from 'foo';`
Expand Down

0 comments on commit 99cb224

Please sign in to comment.