Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array destruction and unused vars marked by eslint

I have code like this in my code:

let [a, b, c, d, e] = await component.getState.call(game.gameId);

Variables b, c, e used below in code but not a and d. In the same time I have eslint check that marks unused variables.

Is there any way to write destruction more correct to resolve this issue? I know about esling-disable-line no-unused but prefer to avoid it.

like image 228
Alex G.P. Avatar asked Jun 29 '18 05:06

Alex G.P.


1 Answers

Replace it with empty placeholders:

let [, b, c, , e] = await component.getState.call(game.gameId);
like image 197
kiddorails Avatar answered Oct 19 '22 10:10

kiddorails