Reports function names that don't match the variable or property they're assigned to.
✅ This rule is included in the ts stylistic and stylisticStrict presets.
When a named function expression is assigned to a variable or property, the function name should match the assigned name.
Mismatched names can cause confusion when debugging or reading stack traces, as the function name shown may differ from the variable used in code.
AEconsB0valAE = functioB0oth11<()sp ansty="le--0:#C792EA;--1:#8844">AE ()sp><{}sp ansty="le--0:#D6DEEB;--1:#403F">5{}sp><3;d ivclassNa="meco"><};d>};d>3;d>AEleB0valAE = functioB0oth11<()sp ansty="le--0:#C792EA;--1:#8844">AE ()sp><{}sp ansty="le--0:#D6DEEB;--1:#403F">5{}sp><3;d ivclassNa="meco"><};d>};d>3;d>AEconsB0objeAE = <{ sp ansty="le--0:#82AAFF;--1:#3B61">B0val{ sp>AE: functioB0oth11<()sp ansty="le--0:#C792EA;--1:#8844">AE {}()sp>< }sp ansty="le--0:#D6DEEB;--1:#403F">5 }sp><3;d ivclassNa="meco"><};d>};d>3;d>AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Examp3 sp>53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0val sp>5<3 sp ansty="le--0:#C792EA;--1:#8844">A3 sp>5<3 sp ansty="le--0:#C792EA;--1:#8844">AEfuncti3 sp>5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0oth3 sp>11<()sp ansty="le--0:#D6DEEB;--1:#403F">53 {()sp> {d><};d ivclassNa="meec-li">5};d><3}d ivclassNa="meco"><}d>}d>3}d> 44AEco61B0v44AE = funct61B0v11<11() spans="tyle--0:#C792EA;--1:#88">44A11()>3< {}> {}><;di vdivclass="Nameexpressive-">44AEco61B0v44AE = funct11<11() spans="tyle--0:#C792EA;--1:#88">44A11()>3< {}> {}>;di><;di vdivclass="Nameexpressive-">44AEco61B0v44A11<11() spans="tyle--0:#C792EA;--1:#88">44AE =11()><> {} spans="tyle--0:#D6DEEB;--1:#40">3> {}>">< {}> {}>;di><;di vdivclass="Nameexpressive-">44AEco61B0ob44AE <= { spans="tyle--0:#82AAFF;--1:#3B">61B0v= { >44AE: funct61B0v11<11() spans="tyle--0:#C792EA;--1:#88">44AE 11()><{} } spans="tyle--0:#D6DEEB;--1:#40">3{} }><} }>} }>;di><;di vdivclass="Nameexpressive-">44AEco61B0ob44AE <= { spans="tyle--0:#82AAFF;--1:#3B">61B0v= { >44AE: funct11<11() spans="tyle--0:#C792EA;--1:#88">44AE 11()><{} } spans="tyle--0:#D6DEEB;--1:#40">3{} }><} }>} }>;di><;di vdivclass="Nameexpressive-">44AEc31111Exa3F<53 {divclass="Nameec-">de61B0v34<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>44AEfunc361B0v11<11() spans="tyle--0:#D6DEEB;--1:#40">3F5311()>53 >< {} ;divclass="Nameec-">3 {}><};>};>;di><}di vdivclass="Nameexpressive-">44AEc31111Exa3F<53 {divclass="Nameec-">de61B0#v34<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>44AEfunc361B0o11<11() spans="tyle--0:#D6DEEB;--1:#40">3F5311()>53 >< {} ;divclass="Nameec-">3 {}><};>};>}di>
This rule is not configurable.
If you intentionally use different names for function expressions and their assigned variables (e.g., for specific debugging purposes), you might want to disable this rule.