When using func-names = never, allow names for recursive use
See original GitHub issueWhat 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:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.I’m working on this.