-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally warn about anonymous functions #1081
Comments
+1 I'd like to see this added as well, naming helps with everything from debugging stack traces, to reports on cyclomatic complexity. Lots of benefits with no cost, since any good minifier/compiler is smart enough to remove the name.
Gets minified to:
|
Sounds like a good thing. |
Although, SpiderMonkey is now capable of figuring out the name of anonymous functions in some cases. |
+1 here too. |
I really would like to see this as well. |
👍 indeed, for stack traces (with TraceKit). |
+1 |
2 similar comments
+1 |
+1 |
This option adds the requirement that all function be named. Anonymous functions will raise a warning (W126).
This option adds the requirement that all function be named. Anonymous functions will raise a warning (W126).
This option adds the requirement that all function be named. Anonymous functions will raise a warning (W126).
This option adds the requirement that all function be named. Anonymous functions will raise a warning (W126).
This option adds the requirement that all function be named. Anonymous functions will raise a warning (W126).
This option allows anonymous (unnamed) functions. If false, anonymous functions will raise a warning (W126).
This option allows anonymous (unnamed) functions. If false, anonymous functions will raise a warning (W126).
+1 |
+1 |
This issue was closed on June 10, and v2.5.2 released on July 5, but I can't seem to use this option. Was it included in the release? It does not seem like the pull request has been merged (yet). |
Also having the same issue as @parautenbach |
+1 would love to use this |
+1 I was just wondering the same thing. I would to have this directly in to JSHint instead of having to rely on other tools. |
This sounds more like a code style feature, making it out-of-scope for JSHint. I might be wrong since @rwaldron recently tagged it as a proposal for JSHint 3. If it is out of scope, then I'd direct commenters to the JSCS project for its But before you go abolishing anonymous functions from your code for debugging purposes, I recommend you look into the function name inference behavior of ES6. In compliant environments, even function expressions will be assigned a useful |
So are we getting the anonymous function check or not? I feel named functions add clarity to code, therefore is not just code style. Much like |
@beautifulcoder the rule exists in eslint, so it might be worth transitioning your project to use that. |
When using anonymous functions instead of named function expressions or function declarations it will make stacktraces and code less readable
It would be nice if jshint could warn about them.
The text was updated successfully, but these errors were encountered: