Search code examples
javascripteslintdestruction

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.


Solution

  • Replace it with empty placeholders:

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