Skip to content

exportFromImports

Reports imports that are re-exported and could use export...from syntax instead.

✅ This rule is included in the ts stylistic and stylisticStrict presets.

When re-exporting from a module without otherwise using the imported value, it’s unnecessary to import and then export. It can be done in a single export...from declaration, which is more concise and makes the re-export intent clearer.

AEimpo53 defaultExporAEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4D./foo.1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">dAEexpo5<3 sp ansty="le--0:#C792EA;--1:#8844">AEdefau53 defaultExpor
44AEex3F5<3 { spans="tyle--0:#C792EA;--1:#88">44AEdef3F5<3 } spans="tyle--0:#C792EA;--1:#88">44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D./fo1<111" spans="tyle--0:#D6DEEB;--1:#40">3
AEimpo53 { named <} sp ansty="le--0:#C792EA;--1:#8844">AEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4D./foo.1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">dAEexpo53 { named <};d ivclassNa="meco"><};d>
44AEex3F53 { name44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D./fo1<111" spans="tyle--0:#D6DEEB;--1:#40">3
AEimpo5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B<0*sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C792EA;--1:#8844">AE53 namespacAEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4D./foo.1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">dAEexpo53 { namespace <};d ivclassNa="meco"><};d>
44AEex36<1B0* spans="tyle--0:#D6DEEB;--1:#40">3443F53 namesp44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D./fo1<111" spans="tyle--0:#D6DEEB;--1:#40">3
AEimpo53 defaultExport, { named <} sp ansty="le--0:#C792EA;--1:#8844">AEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4D./foo.1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">dAEexpo5<3 sp ansty="le--0:#C792EA;--1:#8844">AEdefau53 defaultExporAEexpo53 { defaultExporAE53 renamedDefault, named, nameAE53 renamedNamed <};d ivclassNa="meco"><};d>
44AEex3F<53 {divclass="Nameec-">de44AEdef3de44AEdef3443F53 renamedDefa3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53na3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53na443F53 renamedNa3F<53} spans="tyle--0:#C792EA;--1:#88">44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D./fo1<111" spans="tyle--0:#D6DEEB;--1:#40">3

This rule is not configurable.

If you prefer the explicit import/export pattern for clarity in your codebase, this rule may not be for you.