Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何解决此 requireShorthandArrowFunctions 箭头函数以使其符合 JSCS?
const doSomething = () => { return new Promise((resolve, reject) => { resolve('success'); }); };
我知道这很旧,但我也遇到了同样的问题。我发现这是因为你的doSomething函数只做一件事——它返回一个承诺。因此,从技术上讲,您不应该使用return语句和花括号:
doSomething
return
const doSomething = () => new Promise((resolve, reject) => { resolve("success"); });