Skip to content

Instantly share code, notes, and snippets.

@getify getify/1.js
Last active Mar 14, 2019

Embed
What would you like to do?
ESLint: test cases for determining if a function parameter is unused
// these `xx` parameters are all used, so no "unused parameter" errors should be reported
var f;
f = (xx) => xx;
f = (xx) => () => xx;
f = (xx) => { xx; };
f = (xx, yy = xx) => { yy; };
f = (xx, yy = xx) => { var xx; xx = yy; };
f = (xx, yy = xx) => { var xx = yy; };
f = (xx, yy = () => xx) => { yy; };
f = (xx, yy = () => { xx = 3; }) => { yy; };
f = (xx, yy = (zz = xx) => zz) => { yy; };
// the first parameter of each of these `f()` functions is unused:
// xx, yy, zz, ww, rr, kk, aa, ss, dd, gg
// so "unused parameter" errors should be reported for all of them
var f;
f = (xx) => 3;
f = (yy = 3) => { var yy; };
f = (zz = 3) => { var zz = 3; };
f = (ww = 3) => { var ww; ww = 3; };
f = (rr) => { var rr = 3; };
f = (kk, mm = (kk) => kk) => mm;
f = (aa, bb = (kk = 3) => { kk = 3; }) => bb;
f = (ss, tt = () => { var ss; }) => tt;
f = (dd, ee = () => { var dd = 3; }) => ee;
f = (gg, hh = () => { var gg; gg = 3; }) => hh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.