提示:在继续阅读之前,请注意此文章最后更新于 1960 天前,其中的部分内容可能已经无效或过时。

Disallow specific global variables (no-restricted-globals) 禁止特殊的全局变量

碰到isNaN报错,查了eslint没有看懂,百度出了结果:一个会做Number类型转换,如果能转换成数字,就不是NaN,就会返回false。如果不能转换,就是NaN就返回true。 即:isNaN(x)等同于Number.isNaN(Number(x))
因此,官方是希望让你能够更加明确这一行为,使用后者,而非让系统替你做Number转换。 参考:https://eslint.org/docs/rules/no-restricted-globals
https://www.javaear.com/question/46677774.html
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/isNaN
https://www.cnblogs.com/Mrrabbit/p/10990218.html

Disallow Functions in Loops (no-loop-func) 禁止循环中的函数

改动过多,处于安全考虑,直接禁掉
参考:https://eslint.org/docs/rules/no-loop-func

Disallow use of Object.prototypes builtins directly (no-prototype-builtins) 禁止直接使用Object.prototypes内置函数

官方文档不建议直接调用对象的原型属性,而是用诸如Object.prototype.hasOwnProperty.call(foo, "bar")的形式代替。
因为对象可能会复写对象的原型属性,从而导致一些问题。目前觉得麻烦,禁掉。 参考:https://eslint.org/docs/rules/no-prototype-builtins

import/no-named-default 禁止重命名default

如果export default xxx,那么xxx是无效的,本质上是输出了一个default的变量或方法,且系统允许你为它任意取名字。且import {default as xxx} from 'xxx'等同于import xxx from 'xxx'
参考:https://github.com/benmosher/eslint-plugin-import/blob/v2.19.1/docs/rules/no-named-default.md

Disallow Unused Expressions (no-unused-expressions) 无未使用表达式

等待补充 参考:https://eslint.org/docs/rules/no-unused-expressions