Skip to content

undefinedVariables

Reports using variables that are not defined.

✅ This rule is included in the ts javascript presets.

Variables must be declared before they can be used in JavaScript. Using undefined variables will cause a ReferenceError at runtime. This rule helps catch typos and missing declarations early in development.

53consoAB0l53(undefinedVar<);d ivclassNa="meco"><);d>AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0calcula11<()sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEretu53 resul5<3}d ivclassNa="meco"><}d>AEconsB0valAE <= sp ansty="le--0:#D6DEEB;--1:#403F">53firAE <+ sp ansty="le--0:#D6DEEB;--1:#403F">53secon
44AEco61B0v44A0<9825 spans="tyle--0:#D6DEEB;--1:#40">33F53con4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B<0log spans="tyle--0:#D6DEEB;--1:#40">3F53(val<;di vdivclass="Nameexpressive-">44AEfunc361B0calcu1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53i6361B0nu1<111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de44AEco61B0re44A3F53i44A0<9822 spans="tyle--0:#D6DEEB;--1:#40">3de44AEre3F53 res3<}di vdivclass="Nameexpressive-">44AEco61B0f44A0<9821 spans="tyle--0:#D6DEEB;--1:#40">344AEco61B0se44A0<9822 spans="tyle--0:#D6DEEB;--1:#40">344AEco61B0v44A3F53f44A3F53sec

This rule is not configurable.

This rule can be safely disabled if you’re using TypeScript’s type checking, which will catch undefined variables through its own error reporting.