question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conflicting rules 'no-confusing-arrow' and 'arrow-body-style'

See original GitHub issue

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",

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:13
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

27reactions
lencionicommented, Feb 22, 2016

Does it work if you use parentheses?

export const conflict = (a) => (a > 1 ? 'yes' : 'no');
9reactions
tbcommented, Dec 13, 2017
    export const conflict = a => (a > 1 ? 'yes' : 'no')

worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-config-prettier/README.md - UNPKG
Turns off all rules that are unnecessary or might conflict with [Prettier]. 4. 5, This lets you use you favorite shareable config without...
Read more >
arrow-body-style - ESLint - Pluggable JavaScript Linter
This rule can enforce or disallow the use of braces around arrow function body. Options. The rule takes one or two options. The...
Read more >
ESLint `no-confusing-arrow` "--fix" formatting conflict on save ...
I have "auto format" on save enabled in VSCode. For example this has an ESLint error of no-confusing-arrow : getOptionSelected={option => typeof ...
Read more >
eslint-config-prettier | Yarn - Package Manager
Turns off all rules that are unnecessary or might conflict with [Prettier]. This lets you use your favorite shareable config without letting its...
Read more >
eslint-config-prettier - Awesome JS
Turns off all rules that are unnecessary or might conflict with Prettier. ... See the arrow-body-style and prefer-arrow-callback issue for details.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found