[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 }
Originally, it was written as follows. When only one returns, eslint stipulates that it should be written as follows:
1 res => (new Promise().resolve(null));
If there are multiple returns, for example:
res => {
if (abc === true) {
return 0;
}
return 1;
}
This error will not be reported.
Similar Posts:
- [Solved] Vue3.X version error: Parsing error: Parsing error: Unexpected token
- [Solved] ESLint Error: Failed to load config “standard” to extend from
- Uncaught SyntaxError: Unexpected token o
- Vue Request Error: Uncaught (in promise) [How to Solve]
- No undef check error in eslint
- [Solved] Mybatis error: attempted to return null from a method with a primitive return type (int)
- The execution order of return statement in try except else finally in Python
- [Solved] Vue3+ts+eslint Error: warning Unexpected any. Specify a different type, warning Delete `·` , Missing return type on function, Require statement not part of import statement
- Server returned HTTP response code: 500 for URL xxxxxxxxxxxxx
- The use of Hibernate / JPA getsingleresult reports an exception noresult xception:No entity found for query