简体   繁体   English

如何抑制 VSCode 中“使用严格”语句的 jshint W030 警告?

[英]How to suppress jshint W030 warning on "use strict" statement in VSCode?

I use jshint extension in VSCode.我在 VSCode 中使用 jshint 扩展。 Even for the simplest JS file like this即使对于像这样最简单的 JS 文件

{
    "use strict";

    let a = "Hello world!";
    console.log(a);
}

I get the warning:我收到警告:

Expected an assignment or function call and instead saw an expression. jshint(W030) [Ln 2, Col 5]

How to suppress this warning?如何抑制此警告?

you can try adding at the end of the line with that problem this comment //jshint ignore:line您可以尝试在该问题的行尾添加此注释 //jshint ignore:line

For instance:例如:

{   
"use strict"; //jshint ignore:line 
let a = "Hello world!";
console.log(a); 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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