我正在使用 jslint 来验证我的代码。
我的所有页面上都有“严格使用”。
如何禁用消息“使用'use strict'的函数形式”但保留“缺少'use strict'语句”警告,这样我就不会忘记将它放在新文件上?
谢谢
最佳答案
根据 Crockford's post ,您需要将所有内容包装在一个函数中...
(function () {
"use strict";
// the rest of your file goes here...
}());
你也可以使用 jshint相反,它有一个“globalstrict”选项,可以完全按照您的要求进行操作,而无需将所有内容都包装在一个函数中
关于javascript - 禁用 "use the function form of use strict"但保留 "Missing ' 使用严格声明“警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8953654/