Enforce default parameters to be last.
✅ This rule is included in the ts javascript presets.
Putting default parameters last allows function calls to omit optional tail arguments.
When default parameters appear before required ones, callers must explicitly pass undefined to skip them.
This rule reports parameters with default values or optional markers (?) that appear before required parameters.
AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0gre3 sp>1<1(sp ansty="le--1:#403F"><53sp ansty="le--0:#D7DB">E0na53sp>E1(sp>A5<3 sp ansty="le--0:#D9F5DD;--1:#1111">13 sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4DWor1"sp>1<1"sp ansty="le--1:#403F"><53sp ansty="le--0:#D6DE">EB53sp><, sp ansty="le--0:#D7DB">E0greeti, sp>1"sp>7<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:#D6DEEB;--1:#403F">531)sp>< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53conso sp>AB0l5<3(sp ansty="le--0:#D6DEEB;--1:#403F">53(sp><3`sp ansty="le--0:#E2817F;--1:#B238">343`sp><${sp ansty="le--0:#D6DEEB;--1:#403F">53greeti${sp>3<4}sp ansty="le--0:#ECC48D;--1:#3B61">B04}sp><, sp ansty="le--0:#E2817F;--1:#B238">34, sp><${sp ansty="le--0:#D6DEEB;--1:#403F">53na${sp>3<4}sp ansty="le--0:#ECC48D;--1:#3B61">B4}sp><0!sp ansty="le--0:#D6DEEB;--1:#403F">50!sp><3`sp ansty="le--0:#D6DEEB;--1:#403F">533`sp> {d><);d ivclassNa="meec-li">5);d><3}d ivclassNa="meco"><}d>}d>3}d>AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0calcula3 sp>1<1(sp ansty="le--1:#403F"><53sp ansty="le--0:#D7DB">E53sp><0asp ansty="le--0:#D6DE">E0asp>1(sp>A5<3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><21sp ansty="le--1:#403F"><53sp ansty="le--0:#D6DE">EB53sp><, sp ansty="le--0:#D7DB">E, sp>21sp><0bsp ansty="le--0:#7FDBCA;--1:#096E">70bsp><2:sp ansty="le--0:#D6DEEB;--1:#403F">52:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp><53sp ansty="le--0:#D6DE">EB53sp><, sp ansty="le--0:#D7DB">E, sp><0csp ansty="le--0:#D6DE">E0csp>A5<3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><22sp ansty="le--0:#D9F5DD;--1:#1111">122sp><1)sp ansty="le--0:#D6DEEB;--1:#403F">531)sp>< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEretu sp>53 A53 A53 {d>5<3}d ivclassNa="meco"><}d>}d>3}d>AEconsB0AE <= sp ansty="le--0:#D9F5DD;--1:#1111">1= sp><1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3xsp ansty="le--0:#C792EA;--1:#8844">AE 3xsp><= sp ansty="le--0:#F78C6C;--1:#AA09">8= sp><20sp ansty="le--0:#C792EA;--1:#8844">AE20sp><, sp ansty="le--0:#D7DBE0;--1:#403F">5, sp><3ysp ansty="le--0:#7FDBCA;--1:#096E">73ysp><2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0numb1<1)sp ansty="le--0:#C792EA;--1:#8844">AE =1)sp><> sp ansty="le--0:#D6DEEB;--1:#403F">5> sp><3xsp ansty="le--0:#C792EA;--1:#8844">AE 3xsp><+ sp ansty="le--0:#D6DEEB;--1:#403F">53+ sp> x + ">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0examp3 sp>1<1(sp ansty="le--0:#D7DBE0;--1:#403F">51(sp><3asp ansty="le--0:#7FDBCA;--1:#096E">723asp>5?:sp><3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb3 sp><53sp ansty="le--0:#D6DE">EB53sp><, sp ansty="le--0:#D7DB">E, sp><0bsp ansty="le--0:#7FDBCA;--1:#096E">70bsp><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:#D6DEEB;--1:#403F">531)sp>< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEretu sp>53 (AE?sp ansty="le--0:#D6DEEB;--1:#403F">5??sp><3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><20sp ansty="le--0:#D6DEEB;--1:#403F">5320sp><) sp ansty="le--0:#C792EA;--1:#8844">A) sp>53 {d>5<3}d ivclassNa="meco"><}d>}d>3}d> 44AEfunc361B0g1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53gree111(>6361B0st<3F53 spans="tyle--0:#D6">DE3F53>DBE0D4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>1<111" spans="tyle--0:#ECC48D;--1:#98">4E4DW111">1<111" spans="tyle--0:#D9F5DD;--1:#11">1111"><111) spans="tyle--0:#D6DEEB;--1:#40">3F111)><53 {divclass="Nameec-">3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53con53 >4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B4AE.><0log spans="tyle--0:#D6DEEB;--1:#40">30log>338<34${ spans="tyle--0:#D6DEEB;--1:#40">3F53gree34${>3<834} spans="tyle--0:#ECC48D;--1:#3B">61834}>38<34${ spans="tyle--0:#D6DEEB;--1:#40">3F5334${>3<834} spans="tyle--0:#ECC48D;--1:#3B">6834}><1B0! spans="tyle--0:#D6DEEB;--1:#40">31B0!>3F53 ><53) ;divclass="Nameec-">353)><);>);><}di vdivclass="Nameexpressive-">44AEfunc361B0calcu1<111( spans="tyle--0:#D7DBE0;--1:#40">3111(>6361B0nu<3F53 spans="tyle--0:#D6">DE3F53>DD4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>0<9821 spans="tyle--1:#40"><3F53 spans="tyle--0:#D6">DE3F53>DD9821>4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>0<9822 spans="tyle--0:#D9F5DD;--1:#11">19822><111) spans="tyle--0:#D6DEEB;--1:#40">3F111)><53 {divclass="Nameec-">de44AEre3F5<3 a spans="tyle--0:#C792EA;--1:#88">43 a ><4AE+ spans="tyle--0:#D6DEEB;--1:#40">3F54AE+><3 b spans="tyle--0:#C792EA;--1:#88">43 b ><4AE+ spans="tyle--0:#D6DEEB;--1:#40">3F54AE+>53 ><3 c ;divclass="Nameec-">33 c>}di><}di vdivclass="Nameexpressive-">44AEco6144A1<111( spans="tyle--0:#D7DBE0;--1:#40">3111(>64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0nu4AE >44344A0<9820 spans="tyle--0:#D9F5DD;--1:#11">19820><111) spans="tyle--0:#C792EA;--1:#88">44AE111)>< => spans="tyle--0:#D6DEEB;--1:#40">3 => >44A3F<53y ;divclass="Name"> x "><+ y>+ y>53y>}di><;di vdivclass="Nameexpressive-">44AEfunc361B0exa1<111( spans="tyle--1:#40"><3F53 spans="tyle--0:#D7">D3F53>D111(>4<4AE= spans="tyle--0:#D6DEEB;--1:#40">34AE=>0<9821 spans="tyle--0:#D6DEEB;--1:#40">3F9821><53, spans="tyle--0:#7FDBCA;--1:#09">6E753, ><2... spans="tyle--0:#D7DBE0;--1:#40">3F532...>6361B0nu3F<53[] spans="tyle--0:#D9F5DD;--1:#11">153[]><111) spans="tyle--0:#D6DEEB;--1:#40">3F111)><53 {divclass="Nameec-">de44AEre3F53 4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0re4AE.>31<111( spans="tyle--1:#40"><3F53 spans="tyle--0:#D7">DBE3F53><0sum spans="tyle--0:#D6">DE0sum>DBE0v111(>1<111) spans="tyle--0:#D6DEEB;--1:#40">3111)>44 spans="tyle--0:#D6DEEB;--1:#40">3F53 >4<4AE+ spans="tyle--0:#D6DEEB;--1:#40">3F53 v4AE+>6<67B, spans="tyle--0:#D6DEEB;--1:#40">3F5367B,>53 >< a) ;divclass="Nameec-">3 a)> sum + value, a"><);>);>;di>
This rule is not configurable.
If your API design intentionally places default parameters before required ones for readability or documentation purposes, you may disable this rule.
Some legacy APIs may also have established parameter orderings that cannot be changed without breaking changes.