解决Duplicate function implementation
原因是两个文件的函数都出在全局范围内。在开头加export {}
,或者导出这个函数解决
参考:Duplicate function implementation
原因是两个文件的函数都出在全局范围内。在开头加export {}
,或者导出这个函数解决
参考:Duplicate function implementation
碰到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
改动过多,处于安全考虑,直接禁掉
参考:https://eslint.org/docs/rules/no-loop-func
官方文档不建议直接调用对象的原型属性,而是用诸如Object.prototype.hasOwnProperty.call(foo, "bar")
的形式代替。
因为对象可能会复写对象的原型属性,从而导致一些问题。目前觉得麻烦,禁掉。
参考:https://eslint.org/docs/rules/no-prototype-builtins
如果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
等待补充 参考:https://eslint.org/docs/rules/no-unused-expressions