如何偏好 shorthand 对象 return
How to prefer shorthand object return
我如何告诉 ESLint,当一个函数刚返回一个对象时,它应该使用 shorthand?例如:
const someMethod = c => {
return { c }
};
应该是:
const someMethod = c => ({ c });
感谢安迪,我找到了正确的配置:
"arrow-body-style": ["error", "as-needed"]
我如何告诉 ESLint,当一个函数刚返回一个对象时,它应该使用 shorthand?例如:
const someMethod = c => {
return { c }
};
应该是:
const someMethod = c => ({ c });
感谢安迪,我找到了正确的配置:
"arrow-body-style": ["error", "as-needed"]