Reports top-level await expressions in files that export values.
✅ This rule is included in the ts logicalStrict presets.
Top-level await (“TLA”) allows using await at the module level.
While convenient for standalone files run like scripts, it can cause issues if those files are imported by other modules:
- Modules using top-level await block their dependents until the await resolves
- This can cause unexpected delays in application startup
- It makes module loading order slower and sometimes less predictable
AEconsB0confAE = awai72impo5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D./config.js1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><);d ivclassNa="meec-li">AEexport consB0apiUAE <= sp ansty="le--0:#D6DEEB;--1:#403F">53conf= sp>A72apiU5);d><3;d ivclassNa="meco">3;d>AEconsB0daAE = awaiB0fet5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D/api/da1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0th5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3rsp ansty="le--0:#D9F5DD;--1:#1111">13rsp><1)sp ansty="le--0:#C792EA;--1:#8844">AE =1)sp><> sp ansty="le--0:#D6DEEB;--1:#403F">5> sp><3rsp ansty="le--0:#C792EA;--1:#8844">A3rsp>B0js53()<);d ivclassNa="meec-li">AEexpo53 { data );d><};d ivclassNa="meco"> r.json());export { data "><};d>};d>};d> 44AE3F53co64<4AE spans="tyle--0:#FFCB8B;--1:#11">1111Co4AE >3c44AEex344AEa344AEfunc361B0getCo11<11() spans="tyle--0:#D6DEEB;--1:#40">3F11()><53 {divclass="Nameec-">de443F<53 ( spans="tyle--0:#C792EA;--1:#88">453 (><4AE! spans="tyle--0:#D6DEEB;--1:#40">3F53confi4AE!>53 >3F53< spans="tyle--0:#D6DEEB;--1:#40">3F53con >4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>44AEa36E72im31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D./config.111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53) ;divclass="Nameec-">3F<53 spans="tyle--0:#D6DEEB;--1:#40">353 >53)>de44AEre3F53 con3<}di vdivclass="Nameexpressive-">44AEex344AEa344AEfunc361B0fetch11<11() spans="tyle--0:#D6DEEB;--1:#40">3F11()><53 {divclass="Nameec-">de44AEre361B0f31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D/api/111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3111">4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B04AE.>31<111( spans="tyle--0:#D7DBE0;--1:#40">3111(>1<111) spans="tyle--0:#D6DEEB;--1:#40">3111)>44 spans="tyle--0:#D6DEEB;--1:#40">3F><53 r spans="tyle--0:#C792EA;--1:#88">453 r><4AE. spans="tyle--0:#82AAFF;--1:#3B">61B04AE.>3F5353 ><()) ;divclass="Nameec-">3())> r.json()"><);>);>}di>
This rule is not configurable.
If you’re intentionally using top-level await for module initialization and understand the implications for module loading, you may disable this rule.
You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.