Currently I'm using eslint with the airbnb config to lint my project. However since the last update (6.0.1) i've found somewhat conflicting rules, the 'no-confusing-arrow' rule and the 'arrow-body-style' rule.
Take this piece of code:
export const conflict = (a) => a > 1 ? 'yes' : 'no';
This triggers the no-confusing-arrow rule.
According to the rule it should be written as following:
export const conflict = (a) => {
return a > 1 ? 'yes' : 'no';
};
However this triggers the arrow-body-style rule.
Any idea how to solve this while keeping the shorthand if?
Versions used:
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.1",
Does it work if you use parentheses?
export const conflict = (a) => (a > 1 ? 'yes' : 'no');
Adding parentheses still triggers no-confusing-arrow for me.
Looks like this is also an eslint bug.
I'll disable no-confusing-arrow until they've fixed it - will release a patch later today.
Published as v6.0.2
export const conflict = a => (a > 1 ? 'yes' : 'no')
worked for me
Most helpful comment
Does it work if you use parentheses?