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.

no-empty-function false positive

See original GitHub issue

Tell 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Feb 11, 2020

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!

1reaction
mdjermanoviccommented, Jan 11, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

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