Skip to content

functionCurryingRedundancy

Reports using .apply() or .call() or when the context (this value) provides no benefit.

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

Using .apply() .call() or with null or undefined as the context (first argument) provides no benefit over calling the function directly. Doing so adds unnecessary complexity and reduces code readability.

AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0a1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3asp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb<53sp ansty="le--0:#D6DE">EB<, sp ansty="le--0:#D7DB">E<0bsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb1<1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEretu53 A53 5<3}d ivclassNa="meec-li">AEconsB0resuAE <= sp ansty="le--0:#D6DEEB;--1:#403F">53aAB0ca5<3(sp ansty="le--0:#82AAFF;--1:#3B61">B0undefinAE<, sp ansty="le--0:#F78C6C;--1:#AA09">8<21sp ansty="le--0:#C792EA;--1:#8844">AE<, sp ansty="le--0:#F78C6C;--1:#AA09">8<22sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meco"><);d>AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0multip1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3xsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb<53sp ansty="le--0:#D6DE">EB<, sp ansty="le--0:#D7DB">E<0ysp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb1<1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEretu53 A53 5<3}d ivclassNa="meec-li">AEconsB0valAE <= sp ansty="le--0:#D6DEEB;--1:#403F">53multipAB0ca5<3(sp ansty="le--0:#FF6A83;--1:#A248">48nuAE<, sp ansty="le--0:#F78C6C;--1:#AA09">8<25sp ansty="le--0:#C792EA;--1:#8844">AE<, sp ansty="le--0:#F78C6C;--1:#AA09">8<23sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meco"><);d>AEconsB0callbaAE <= sp ansty="le--0:#D9F5DD;--1:#1111">1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53messa7<2:sp ansty="le--0:#C792EA;--1:#8844">AB0stri1<1)sp ansty="le--0:#C792EA;--1:#8844">AE =<> sp ansty="le--0:#D6DEEB;--1:#403F">53messa sp>AB0toUpperCa53(<);d ivclassNa="meec-li">53callbaAB0app5<3(sp ansty="le--0:#82AAFF;--1:#3B61">B0undefin53,< [sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dhel1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53]<);d ivclassNa="meco"><);d>AEconsB0compuAE <= sp ansty="le--0:#D9F5DD;--1:#1111">1<1(sp ansty="le--0:#D7DBE0;--1:#403F">5<3asp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#C792EA;--1:#8844">AB0numbAE<, sp ansty="le--0:#D7DBE0;--1:#403F">5<3bsp ansty="le--0:#7FDBCA;--1:#096E">7<2:sp ansty="le--0:#C792EA;--1:#8844">AB0numb1<1)sp ansty="le--0:#C792EA;--1:#8844">AE =<> sp ansty="le--0:#D6DEEB;--1:#403F">5 sp><3asp ansty="le--0:#C792EA;--1:#8844">AE <+ sp ansty="le--0:#D6DEEB;--1:#403F">5353compuAB0app5<3(sp ansty="le--0:#FF6A83;--1:#A248">48nu53,< [sp ansty="le--0:#F78C6C;--1:#AA09">82<10sp ansty="le--0:#D6DEEB;--1:#403F">53<, sp ansty="le--0:#F78C6C;--1:#AA09">82<20sp ansty="le--0:#D6DEEB;--1:#403F">53]<);d ivclassNa="meco"><);d>
44AEfunc361B<0add spans="tyle--0:#D9F5DD;--1:#11">1<111( spans="tyle--0:#D7DBE0;--1:#40">36361B0nu<3F53 spans="tyle--0:#D6">DED6361B0nu1<111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de44AEre3F5<3 a spans="tyle--0:#C792EA;--1:#88">4<4AE+ spans="tyle--0:#D6DEEB;--1:#40">3F5<3 b ;divclass="Nameec-">344AEco61B0re44A61B<0add spans="tyle--0:#D6DEEB;--1:#40">30<9821 spans="tyle--0:#C792EA;--1:#88">440<9822 spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Name">< 2)><;di vdivclass="Nameexpressive-">44AEco61B0call44A1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53mes64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0st1<111) spans="tyle--0:#C792EA;--1:#88">44AE< => spans="tyle--0:#D6DEEB;--1:#40">3F53mes >4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toUpper3F5<3() ;divclass="Nameec-">61B0call31<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dh1<111" spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Name"><;di vdivclass="Nameexpressive-">6376// Using .call() with a meaningful con44AEco61B<0obj spans="tyle--0:#C792EA;--1:#88">44AE = { val09<8210 spans="tyle--0:#C792EA;--1:#88">44344AEfunc361B0getV11<11() spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de44AEre36E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72v3344AEco61B0contextRe44A3F53getV4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B03F53(o<;di vdivclass="Nameexpressive-">6376// Using .apply() to pass an array of arguments with con44AEfunc361B0g1<111( spans="tyle--0:#7FDBCA;--1:#09">6E72t3F53 { 6361B0st<3F53 spans="tyle--0:#D6">DEEB< }, spans="tyle--0:#D7">DBE0gree6361B0st1<111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de44AEre3338<34${ spans="tyle--0:#D6DEEB;--1:#40">3F53gree3<834} spans="tyle--0:#ECC48D;--1:#3B">6138<34${ spans="tyle--0:#7FDBCA;--1:#09">6E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E723<834} spans="tyle--0:#ECC48D;--1:#3B">6<1B0! spans="tyle--0:#D6DEEB;--1:#40">33344AEco61B0pe44AE = { na1<111" spans="tyle--0:#ECC48D;--1:#98">4E4DA1<111" spans="tyle--0:#C792EA;--1:#88">4433F53g4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0a3F53(perso1<111" spans="tyle--0:#ECC48D;--1:#98">4E4DH1<111" spans="tyle--0:#D6DEEB;--1:#40">3F5<3]) ;divclass="Name"><"])>

This rule is not configurable.

If you have a specific coding pattern that requires explicit use of .apply() .call() or for consistency across a large codebase, even when the context is null or undefined, you might choose to disable this rule. However, in most cases, direct function calls improve code clarity and maintainability.