[eslint] Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`. [arrow-body-style]
[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; // 第二个返回 }
则不会报这个错,具体可以参照官方说明:
以雷霆击碎黑暗