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.

Update: Add never option to arrow-body-style

See original GitHub issue

Version: 2.10.0

Arrow functions that return object literals can look very similar to arrow functions with brace bodies. Some syntactic ambiguity can be avoided by disallowing block-style arrow functions in favour of ES5 function expressions.

Outcome

The following patterns are considered problems:

/*eslint arrow-body-style: ["error", "never"]*/
/*eslint-env es6*/

let foo = () => {
    return 0;
};

let foo = (retv, name) => {
    retv[name] = true;
    return retv;
};

The following patterns are not considered problems:

/*eslint arrow-body-style: ["error", "never"]*/
/*eslint-env es6*/

let foo = () => 0;

let foo = () => ({ key: 0 });

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
nzakascommented, Jun 3, 2016

I think we can support “never” along with #5936. I’ll champion this.

0reactions
btmillscommented, Jun 5, 2016

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

arrow-body-style - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Rule Change: add maxLines option to arrow-body-style · Issue ...
I am open to taking a swing at a PR for this. In my naive review, this seems pretty straightforward to enforce? The...
Read more >
Unexpected block statement surrounding arrow body; move ...
I am getting the error Failed to Compile Unexpected block statement surrounding arrow body; move the returned value immediately after the =>.
Read more >
Arrow function expressions - JavaScript - MDN Web Docs
An arrow function expression is a compact alternative to a traditional function expression, with some semantic differences and deliberate ...
Read more >
Tooltips - Bootstrap
Documentation and examples for adding custom Bootstrap tooltips with CSS and ... Specify container: 'body' to avoid rendering problems in more complex ...
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