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.

Change allowArrowFunctions in func-style to string option

See original GitHub issue

Hi everyone! Thanks for eslint, it is awesome 😃

I would like to allow arrow functions without bodies, like:

// Good
const bla = () => true;
// Good
const bla = () => ({
    prop: true
});
// Bad
const bla = () => {
    return true;
};
// Bad
const bla = () => {
    const blub = true;
    return  blub;
};

You’d configure it like this:

/*eslint func-style: ["error", "declaration", { "allowArrowFunctions": "expression-body" }]*/
/*eslint func-style: ["error", "declaration", { "allowArrowFunctions": "all" }]*/

What you be open for that change or do you see any problems?

@flootr would be interested in doing a PR 😃

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:6
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Apr 22, 2017

@eslint/eslint-team This proposal has a lot of votes. Is anyone willing to champion it?

0reactions
not-an-aardvarkcommented, Jul 11, 2017

Closing this issue because no one on the team was willing to champion it. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach consensus after a long time tend to never do it, and as such, we close those issues. This doesn’t mean the idea isn’t interesting, just that it’s not something the team can commit to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

func-style - Pluggable JavaScript Linter - ESLint
This option applies only when the string option is set to "declaration" (arrow functions are always allowed when the string option is set...
Read more >
Arrow function expressions - JavaScript - MDN Web Docs
Let's decompose a traditional anonymous function down to the simplest arrow function step-by-step. Each step along the way is a valid arrow ...
Read more >
Arrow functions, the basics - The Modern JavaScript Tutorial
It's called “arrow functions”, because it looks like this: let func = (arg1, arg2, ..., argN) => expression; This creates a function func...
Read more >
How To Use Javascript Arrow Functions & This Keyword
This guide will discuss how to use the arrow function to write your JavaScript functions. Focusing on converting regular functions to arrow ...
Read more >
TypeScript Arrow Functions - TutorialsTeacher
Using fat arrow => , we dropped the need to use the function keyword. Parameters are passed in the parenthesis () , and...
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