簡體   English   中英

Eslint:未使用的變量

[英]Eslint : no-unused-vars

我是使用Eslint修復錯誤的新手,但遇到以下錯誤。

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

我的代碼是

  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 });
});

非常感謝您的幫助。

只需刪除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 });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM