Require that function overload signatures be consecutive.
✅ This rule is included in the ts stylistic and stylisticStrict presets.
Function overload signatures represent multiple ways a function can be called with different parameter types or return types.
When overload signatures are separated by other code, it becomes harder to see the full API of a function at a glance.
Grouping all overload signatures for a function together makes code easier to read and understand.
This rule reports when a function’s overload signatures are not adjacent to each other.
AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B3 sp><0fsp ansty="le--0:#D9F5DD;--1:#1111">10fsp><1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#7FDBCA;--1:#096E">73xsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp>1<1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>5<3;d ivclassNa="meec-li">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0oth3 sp>11<()sp ansty="le--0:#7FDBCA;--1:#096E">7()sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>53 3;d><{}d ivclassNa="meec-li">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B3 sp><0fsp ansty="le--0:#D9F5DD;--1:#1111">10fsp><1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#7FDBCA;--1:#096E">73xsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>1<1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>5{}d><3;d ivclassNa="meec-li">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B3 sp><0fsp ansty="le--0:#D9F5DD;--1:#1111">10fsp><1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#7FDBCA;--1:#096E">73xsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp>5<3 sp ansty="le--0:#7FDBCA;--1:#096E">73 sp><2|sp ansty="le--0:#D6DEEB;--1:#403F">52|sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>1<1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>53 3;d><{}d ivclassNa="meco"><{}d>{}d>{}d>AEinterfa53 I< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0meth sp>1<1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#7FDBCA;--1:#096E">73xsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp>1<1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>5 {d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0oth sp>11<()sp ansty="le--0:#7FDBCA;--1:#096E">7()sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>53;d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0meth sp>1<1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#7FDBCA;--1:#096E">73xsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>1<1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>53;d><3;d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0meth sp>1<1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#7FDBCA;--1:#096E">73xsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp>5<3 sp ansty="le--0:#7FDBCA;--1:#096E">73 sp><2|sp ansty="le--0:#D6DEEB;--1:#403F">52|sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0stri3 sp>1<1)sp ansty="le--0:#7FDBCA;--1:#096E">71)sp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0vo3 sp>53;d><3;d ivclassNa="meec-li">53;d><3}d ivclassNa="meco"><}d>}d>3}d> 44AEfunc36<1B0f spans="tyle--0:#D9F5DD;--1:#11">11B0f><111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0nu1<111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B0344AEfunc36<1B0f spans="tyle--0:#D9F5DD;--1:#11">11B0f><111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B0344AEfunc36<1B0f spans="tyle--0:#D9F5DD;--1:#11">11B0f><111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0nu36361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B03F5<3 { }divclass="Name">3 {><}di vdivclass="Nameexpressive-">44AEinter3F53< I {divclass="Nameec-">de61B0me1<111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0nu1<111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B03 I >de61B0me1<111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B03de61B0me1<111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0nu36361B0st1<111) spans="tyle--0:#7FDBCA;--1:#09">6111)>361B033}di>
This rule is not configurable.
It can sometimes be useful to place overload signatures alongside other meaningful parts of a type.
For example, if each overload corresponds to a different property, you might wish to place each overload next to its property.
You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.