Eslint参考手册
规则 | Rules
no-extra-strict
这条规则在 ESLint v1.0 中被删除,并被严格的规则取代。新规则中的"global"
或"function"
选项与删除的规则类似。
该"use strict";
指令适用于其出现的范围以及该范围内包含的所有内部范围。因此,"use strict";
在这些内部作用域之一中使用该指令是不必要的。
"use strict";
(function () {
"use strict";
var foo = true;
}());
规则细节
这条规则旨在防止不必要的"use strict";
指示。因此,它会"use strict";
在严格模式下遇到指令时发出警告。
此规则的错误代码示例:
"use strict";
(function () {
"use strict";
var foo = true;
}());
此规则的正确代码示例:
"use strict";
(function () {
var foo = true;
}());
(function () {
"use strict";
var foo = true;
}());
进一步阅读
- ECMAScript 5 注释规范 - 严格模式版本此规则在 ESLint 0.3.0 中引入,并在 1.0.0-rc-1.Resources 中删除
- Documentation source
规则 | Rules相关

ESLint 是一个代码规范和错误检查工具,有以下几个特性。所有东西都是可以插拔的。你可以调用任意的 rule api 或者 formatter api 去打包或者定义 rule or formatter。任意的 rule 都是独立的。没有特定的 coding style,你可以自己配置。
主页 | https://eslint.org/ |
源码 | https://github.com/eslint/eslint |
发布版本 | 4.12.0 |