禁用“使用严格使用的功能形式”但请保持“Missing”使用严格的'声明'警告 [英] Disable "use the function form of use strict" but keep the "Missing 'use strict' statement" warning

查看:143
本文介绍了禁用“使用严格使用的功能形式”但请保持“Missing”使用严格的'声明'警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jslint验证我的代码。

我的所有页面都有use strict。

如何禁用使用函数形式的消息使用strict'但保留Missing使用严格'声明'警告,所以我不会忘记把它放在新文件上?

I am using jslint to validate my code.
I have "use strict" on all my pages.
How can I disable the message "use the function form of 'use strict'" but keep the "Missing 'use strict' statement" warning, so I won't forget to put it on new files?

谢谢

推荐答案

根据 Crockford的帖子,你想要把所有东西都包在一个功能中......

According to Crockford's post, you'll want to wrap everything in a function...

(function () {
    "use strict";
    // the rest of your file goes here...
}());

您还可以使用 jshint 相反,它有一个 globalstrict 选项,可以完全满足您的要求而无需将所有内容包装在函数中

You could also use jshint instead, which has a "globalstrict" option that can do exactly what you're asking for without having to wrap everything in a function

这篇关于禁用“使用严格使用的功能形式”但请保持“Missing”使用严格的'声明'警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆