[英]How to fix requireShorthandArrowFunctions
How to fix this requireShorthandArrowFunctions arrow function so that it is compliant with JSCS? 如何解决这个requireShorthandArrowFunctions箭头函数,使其符合JSCS?
const doSomething = () => {
return new Promise((resolve, reject) => {
resolve('success');
});
};
I know this is old but I just had the same issue. 我知道这已经过时但我遇到了同样的问题。 I figured out it's because your
doSomething
function does only one thing - it returns a promise. 我想出来是因为你的
doSomething
函数只做了一件事 - 它返回了一个promise。 So, technically you shouldn't use a return
statement and curly braces: 所以,从技术上讲,你不应该使用
return
语句和花括号:
const doSomething = () => new Promise((resolve, reject) => {
resolve("success");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.