[eslint] Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`. [arrow-body-style]
1 res => { 2 3 return new Promise().resolve(null); 4 5 }
本來是上面這樣寫,當只有一個返回的時候,eslint規定要寫成:
1 res => (new Promise().resolve(null));
如果有多個返回,比如:
res => { if (abc === true) { return 0; // 第一個返回 } return 1; // 第二個返回 }
則不會報這個錯,具體可以參照官方說明: