Unexpected block statement surrounding arrow body
The block statement isn't needed for a single expression.
this.state.todos.filter(filterTodo => filterTodo !== todo);
To add on Kevin answer, the error is related to your eslint configuration. 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((name) => {
return <HelloWorld key={name} name={name} />;
});
Without arrow-body-style
option, block statement ( { return ...}
) is not needed as per Kevin answer.
This actually open a new question as to which style is more appropriate.
For further references : http://eslint.org/docs/rules/arrow-body-style
If you really don't want to wrap arrow function inside block statement then you can turn off.
module.exports = {
extends: "airbnb-base",
rules: {
"arrow-body-style": 0
},
"env": {
"jest": true
}
};