Search code examples
javascriptecmascript-6requireeslint

How to ignore one of multiple return values from require in JavaScript?


I have a require statement like this

const {_Api, JsonRpc, _RpcError} = require('eosjs');

I am not using the underscored variables. But I am getting no-unused-vars warning for them. How can I ignore the values. I cannot replace simply leave them out because it requires a string literal before the comma unlike in a list. Thanks.


Solution

  • IIRC you don't need the unwanted items at all - since objects are used with keys (property names), you can only get the ones you want:

    const { JsonRpc } = require('eosjs');