eslint/no-undefined 限制
功能
禁止将 undefined
用作标识符
为什么不这样做?
不良代码示例
javascript
var foo = undefined;
var undefined = "foo";
if (foo === undefined) {
// ...
}
function baz(undefined) {
// ...
}
bar(undefined, "lorem");
好代码示例
javascript
var foo = void 0;
var Undefined = "foo";
if (typeof foo === "undefined") {
// ...
}
global.undefined = "foo";
bar(void 0, "lorem");