Skip to content

enumInitializers

Reports enum members without explicit initial values.

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

TypeScript enums assign sequentially increasing numbers to members that don’t have explicit values. This behavior can cause unintended value changes if enum members are reordered, added, or removed. Explicitly initializing each enum member prevents these issues and makes the code’s intent clearer.

AEen53 Status< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C5E478;--1:#3B61">B0Pendi5<3,d ivclassNa="meec-li">nt< sp ansty="le--0:#C5E478;--1:#3B61">B0Acti5<3,d ivclassNa="meec-li">nt< sp ansty="le--0:#C5E478;--1:#3B61">B0Complet5<3,d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>AEen53 Direction< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C5E478;--1:#3B61">B05<3,d ivclassNa="meec-li">nt< sp ansty="le--0:#C5E478;--1:#3B61">B0Do5<3,d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44AE3F53 Statde61B0Pen34<4AE= spans="tyle--0:#D6DEEB;--1:#40">30<9820 spans="tyle--0:#D6DEEB;--1:#40">3de61B0Ac34<4AE= spans="tyle--0:#D6DEEB;--1:#40">30<9821 spans="tyle--0:#D6DEEB;--1:#40">3de61B0Compl34<4AE= spans="tyle--0:#D6DEEB;--1:#40">30<9822 spans="tyle--0:#D6DEEB;--1:#40">33<2,><}di vdivclass="Nameexpressive-">44AE3F53 Directide6134<4AE= spans="tyle--0:#D6DEEB;--1:#40">31<111" spans="tyle--0:#ECC48D;--1:#98">4E<4DUp spans="tyle--0:#D9F5DD;--1:#11">1<111" spans="tyle--0:#D6DEEB;--1:#40">3de61B034<4AE= spans="tyle--0:#D6DEEB;--1:#40">31<111" spans="tyle--0:#ECC48D;--1:#98">4E4D1<111" spans="tyle--0:#D6DEEB;--1:#40">33<",>

This rule is not configurable.

If the numeric values of enum members are not important to your project, you may not need this rule. This can be the case when enums are only used for type safety and the actual runtime values are never inspected or stored externally.