Skip to content

emptyExports

Reports empty export statements that don't make a file a module.

✅ This rule is included in the ts logical and logicalStrict presets.

An empty export {} statement is sometimes useful in TypeScript code to turn a file that would otherwise be a script into a module. Per the TypeScript Handbook Modules page:

In TypeScript, just as in ECMAScript 2015, any file containing a top-level import or export is considered a module. Conversely, a file without any top-level import or export declarations is treated as a script whose contents are available in the global scope.

However, an export {} statement does nothing if there are any other top-level import or export statements in a file. This rule reports an export {} that doesn’t do anything in a file already using ES modules.

AEexport consB0valAE = <{}sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">AEexpo53 {<};d ivclassNa="meco"><};d>AEexpo5<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">AEfr5<3 sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dmodu1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">AEexpo53 {<};d ivclassNa="meco"><};d>AEimpo53 { something <} 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">4Dmodu1<1"sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">dAEexpo53 {<};d ivclassNa="meco"><};d>
44AEexport co61B0v44AE <= {} spans="tyle--0:#D6DEEB;--1:#40">3< {}><;di vdivclass="Nameexpressive-">44AEex36<1B0* spans="tyle--0:#D6DEEB;--1:#40">344AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dmo1<111" spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">44AEex3F53< {} ;divclass="Name">< {}><;di vdivclass="Nameexpressive-">44AEim3F53 { somethin44AE31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dmo1<111" spans="tyle--0:#D6DEEB;--1:#40">3c3F53con4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B<0log spans="tyle--0:#D6DEEB;--1:#40">3F53(somethi

This rule is not configurable.

If you don’t mind an empty export {} at the bottom of files, you likely don’t need this rule. Some codebases prefer explicit module markers for consistency.