Disable the arrow-body-style
rule
#217
Replies: 4 comments 2 replies
-
We should not disable the Incorrect codelet foo = () => {
return 0;
};
let bar = () => {
return {
bar: {
foo: 1,
bar: 2,
}
};
}; Correct codelet foo1 = () => 0;
let foo2 = () => ({
bar: {
foo: 1,
bar: 2,
}
});
let foo3 = (retv, name) => {
retv[name] = true;
return retv;
};
let foo4 = () => { bar(); };
let foo5 = () => {}; |
Beta Was this translation helpful? Give feedback.
-
Those are the prefect candidates to have fixed by prettier, or eslint if prettier doesn't do it (yet).
If you and someone else prefer different things, then the codebase can become inconsistent. Additionally, most editors (VSCode and Webstorm at least) have a quick fix that can wrap or unwrap the braces/return statement in case you quickly need to add a console log or something. |
Beta Was this translation helpful? Give feedback.
-
Sometimes, you end up with harder-to-read code because of this rule.
Again, I like the rule, just don't think it should be enforced. |
Beta Was this translation helpful? Give feedback.
-
Another example I came up while writing on other thread: This is considered wrong:
becomes this after formatting to comply to the rule:
|
Beta Was this translation helpful? Give feedback.
-
There is a proposal to disable the
arrow-body-style
rule.Please see the documentation
Beta Was this translation helpful? Give feedback.
All reactions