no-empty-function false positive
See original GitHub issueTell us about your environment
- ESLint Version: 6.8.0
- Node Version: 12.14.1
- npm Version: 6.13.4
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
Configuration
{
"no-empty-function": ["error", { "allow": ["methods"] }]
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
const object = {
async method() {}
};
eslint .
What did you expect to happen?
No no-empty-function
warnings.
What actually happened? Please include the actual, raw output from ESLint.
Unexpected empty async method ‘method’. (no-empty-function)
Are you willing to submit a pull request to fix this bug?
Yes
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Using empty functions as default parameters should not be ...
I think using empty functions as default parameters is a special case for this rule and should not raise a critical issue. I...
Read more >no-empty-function - ESLint - Pluggable JavaScript Linter
Rule Details. This rule is aimed at eliminating empty functions. A function will not be considered a problem if it contains a comment....
Read more >Eslint bug when declaring variables into constructor TS
I think eslint doesn't understand the declaration inside the constructor parentheses but I'm not sure. I use this method of declaration very ...
Read more >The solution for False Positive of java try-catch - Google Groups
Empty catch block \ / \ / function exit... So, it is not so hard to understand the False Positive now. How to...
Read more >Changelog | Stylelint
Fixed: block-no-empty false positives for reportNeedlessDisables (#6381) ... Fixed: function-calc-no-unspaced-operator false positives and memory leak ...
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 FreeTop 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
Top GitHub Comments
On thinking about this more, this seems like a clear case of an unintentionally missing feature (it was probably implemented before async functions were added to the language). The rule definitely doesn’t feel complete without it, so I’m marking as accepted. If anyone from the team disagrees, please let me know!
I also think this should be fixed in some way. There are also async arrow functions.
By the current implementation, it seems that async generator functions and async generator methods would be treated as just generator functions/generator methods? Looks like there could be an exponential growth of options if something new appears.