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.

missing function expression name : naming / semantics

See original GitHub issue

Assuming a function expression that toggles the visibility of <tr>s depending on some criteria,

const filterRows = function () {
...
}

39:23 warning Missing function expression name func-names

I’m running into difficulty finding a name for that function expression as the rule suggests. More often it would be pure duplication of the variable in which the function is saved.

Any ideas on how to properly redact a meaningful name that isn’t a duplicate of the variable name?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ljharbcommented, Feb 24, 2017

The value I see is that in stack traces, you’ll see a very specific function name, which you can grep for across your whole codebase and find in only one location, whereas the generic name might appear in a handful of files.

0reactions
gkatsanoscommented, Feb 24, 2017

@ljharb semantically that doesn’t add any value though right? you could very well use a specific and verbose var name…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function expression - JavaScript - MDN Web Docs
The name doesn't change if it's assigned to a different variable. If function name is omitted, it will be the variable name (implicit...
Read more >
Coding like Shakespeare: Practical Function Naming ...
6. Avoid the same concept covered by many names · Verify the application for functions with the same behavior. Use the matched function...
Read more >
The names of functions in ES6 - 2ality
Function declarations and function expression are function definitions. This scenario has been supported for a long time: a function definition ...
Read more >
Why use named function expressions? - Stack Overflow
Naming functions is useful if they need to reference themselves (e.g. for recursive calls). Indeed, if you are ...
Read more >
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: "generators": "always" |...
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