5

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.

Alex G.P.
  • 8,092
  • 5
  • 37
  • 75
  • 6
    You can just omit non-used variables, `let [, b, c, , e] = ` – ASDFGerte Jun 29 '18 at 06:05
  • @ASDFGerte just noted that you already commented much before, please add this as answer :) – kiddorails Jun 29 '18 at 06:30
  • @ASDFGerte you are fantastic! – Alex G.P. Jun 29 '18 at 06:49
  • @kiddorails Should a question's answer boil down to a very short fact, a comment may come close to it already. I rarely post answers these days, unless the situation explicitly demands it. This is because answers imply completeness, require longer flavor-text, and potential follow-ups. Also rep doesn't concern me much. I potentially may not have time or motivation for follow-ups, and could not answer details about ESlint, as I have very little experience with it (likely less than OP - here, a javascript syntax detail just happened to be relevant). That you post it as answer is completely fine. – ASDFGerte Jun 29 '18 at 07:03

1 Answers1

13

Replace it with empty placeholders:

let [, b, c, , e] = await component.getState.call(game.gameId);
kiddorails
  • 12,474
  • 2
  • 29
  • 39