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.

When using func-names = never, allow names for recursive use

See original GitHub issue

What version of ESLint are you using? 2.13.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration: "func-names": [2, "never"]

The problem you want to solve I would like to never use function names, because in Mozilla code the names in stacks are guessed pretty well nowadays. There are some cases where I still need them though, namely when referencing the function name within for a recursive call.

Example:

setTimeout(function postpone() {
    let thing = getThing();
    if (!thing) {
        setTimeout(postpone, 0);
    } else {
        complete();
    }
}, 0);

Your take on the correct solution to problem. I would suggest to add an keyword option recursive or similar, setting it to true would allow use of function names if referenced from within. The default should be true.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
btmillscommented, Jul 8, 2016

Right now func-names is either “always” or “never”. What about making it “always/recursive/never”? That would be a non-breaking enhancement and avoid a boolean object option.

1reaction
albertocommented, Jul 13, 2016

I’m working on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

func-names - ESLint - Pluggable JavaScript Linter
"never" disallows named function expressions, except in recursive functions, where a name is needed. This rule has an object option:.
Read more >
calling recursive function when passing a functon for higher ...
I want to recursively call higher order function. so I have a list and I'm passing this list to a function name funcName....
Read more >
How do compilers work in a language that doesn't allow ...
So what you have to do to support recursion is go through and make placeholders for all the function names first, then generate...
Read more >
9.2 Python Scopes and Name Spaces
The name space containing the built-in names is created when the Python interpreter starts up, and is never deleted. The global name space...
Read more >
9. Classes — Python 3.11.1 documentation
Creating a new class creates a new type of object, allowing new instances ... names is created when the Python interpreter starts up,...
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