Unexpected block statement surrounding arrow body arrow-body-style
See original GitHub issueWhat version of ESLint are you using? 2.3.0
What configuration and parser (Espree, Babel-ESLint, etc.) are you using? Babel-Eslint version babel/babel-eslint#d2f90c7239e152b8994f250c69c83604cde93292 (from 07 march 2016, need this commit for fix ‘estraverse-fb’)
What did you do? Please include the actual source code causing the issue.
this.post('/post', () => {
return {
post: {
foo: 1,
bar: 2,
},
};
});
Error:
1:28 error Unexpected block statement surrounding arrow body arrow-body-style
I cant remove the { } after removing the ‘return’ because I want to response a object: { }
What did you expect to happen?
No error message with the default setting ‘as-needed’
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:27 (10 by maintainers)
Top Results From Across the Web
Unexpected block statement surrounding arrow body
This said, if arrow-body-style option is set to true, OP is correct. An other example would be something like this : return this.state.greetings.map( ......
Read more >arrow-body-style - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Unexpected block statement surrounding arrow body [Solved ...
Hi,. I have a question around good syntax. I am picking up React and functional programming in general, and am pretty new to...
Read more >React App Unexpected block statement surrounding arrow body
Coding example for the question React App Unexpected block statement surrounding arrow body; move the returned value immediately after the `=>`.
Read more >eslint/eslint - Gitter
Hey everyone, the following mocha test snippet is failing on arrow-body-style ("Unexpected block statement surrounding arrow body.") it('should do a thing', ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you wrap the object in parentheses, it will parse correctly and the rule won’t error: