[英]How should I handle prefer arrow callback and unnamed function code issues
I am new to ES6 and been trying to figure out how to rewrite this. 我是ES6的新手,一直在尝试弄清楚如何重写它。
I am receiving the ff: in my eslint 我在收到ff:在我的陪同下
server.listen(config.site.port, config.site.host, function (err) { if (err) { throw err; } });
I tried reading the specs and try it out but can't seem to figure out what to do if it has if
condition. 我尝试阅读规格并尝试使用它,但似乎无法弄清楚if
有条件的话该怎么办。 https://eslint.org/docs/rules/prefer-arrow-callback https://eslint.org/docs/rules/prefer-arrow-callback
Thanks a lot. 非常感谢。
The prefer-arrow-callback should be fixed by: 首选箭头回调应通过以下方式解决:
server.listen(config.site.port, config.site.host, (err) => {
if (err) {
throw err;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.