简体   繁体   中英

Eslint : no-unused-vars

I am new in using Eslint to fixing the bugs and I have got the following error.

error 'query' is assigned a value but never used no-unused-vars

My code is

  const query = Samples.find().where('patientId', patientId).exec((err, docs) => {
    if (err) res.send(err);
    // If no errors, send them back to the client
    res.json({ items: docs });
});

Any help is highly appreciated.

Just remove the const query part. Unless they're more code you're not sharing (which you should in order to create a reproducible example), it appears you don't actually need it:

Samples.find().where('patientId', patientId).exec((err, docs) => {
    if (err) res.send(err);
    // If no errors, send them back to the client
    res.json({ items: docs });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM