繁体   English   中英

如何修复requireShorthandArrowFunctions

[英]How to fix requireShorthandArrowFunctions

如何解决这个requireShorthandArrowFunctions箭头函数,使其符合JSCS?

const doSomething = () => {
    return new Promise((resolve, reject) => {

        resolve('success');

    });
};

我知道这已经过时但我遇到了同样的问题。 我想出来是因为你的doSomething函数只做了一件事 - 它返回了一个promise。 所以,从技术上讲,你不应该使用return语句和花括号:

const doSomething = () => new Promise((resolve, reject) => {
    resolve("success");
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM