arrow-body-style
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"arrow-body-style": "error",
},
},
];const foo = () => 0;const foo = () => {
return 0;
};
const bar = () => {
return {
bar: {
foo: 1,
bar: 2,
}
};
};const foo = () => ({});
const bar = () => ({ bar: 0 });const foo = () => {
return 0;
};
const bar = (retv, name) => {
retv[name] = true;
return retv;
};const foo1 = () => 0;
const foo2 = (retv, name) => {
retv[name] = true;
return retv;
};
const foo3 = () => ({
bar: {
foo: 1,
bar: 2,
}
});
const foo4 = () => { bar(); };
const foo5 = () => {};
const foo6 = () => { /* do nothing */ };
const foo7 = () => {
// do nothing.
};
const foo8 = () => ({ bar: 0 });const foo = () => {};
const bar = () => { return { bar: 0 }; };Examples from the ESLint documentation.
arrow-body-style
eslint
export default [
{
rules: {
"arrow-body-style": "error",
},
},
];arrow-body-style
eslint plugin · style
{
"rules": {
"arrow-body-style": "error"
}
}style/useConsistentArrowReturn
style · since 2.2.3
{
"linter": {
"rules": {
"style": {
"useConsistentArrowReturn": "error"
}
}
}
}Disallow returning values from Promise executor functions
Disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead
Disallow if statements as the only statement in else blocks
Require grouped accessor pairs in object literals and classes
Disallow use of chained assignment expressions