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.

handle-callback-err shouldn't trigger when `arguments` is used

See original GitHub issue

What rule do you want to change? handle-callback-err

Does this change cause the rule to produce more or fewer warnings? Fewer.

How will the change be implemented? (New option, new default behavior, etc.)? IMO the default behavior should be changed, maybe an option could be added.

Please provide some example code that this change will affect:

Saw some code trigger this one time that looked something like this: (I can’t find the exact source now…)

something(function (err /* err is ... */) {
  this.emit('some-event', arguments)
})

Or at least, something like that.

What does the rule currently do for this code? It says err is not handled, but it actually is.

What will the rule do after it’s changed? See that arguments was used, and not fail the rule check.

I’d also like it to be able to check for arguments[0] specifically and not other indexes… if possible.

Are you willing to submit a pull request to implement this change? Yes, but I am fairly unfamiliar with eslint rule programming so I’m having a hard time figuring out how to do the arguments check.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
nzakascommented, Nov 1, 2018

I think creating your own version of the rule is probably your best bet. Take a look at eslint-rule-composer, which should make it easier to just eliminate the warnings you don’t want.

0reactions
eslint-deprecated[bot]commented, Dec 11, 2018

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

handle-callback-err - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
I don't quite understand the callback function with a parameter ...
I was trying to ask that if some functions aren't predefined as keypress or insertMany, would it work if I pass err, or...
Read more >
eslint-plugin-n/handle-callback-err.md at master - GitHub
This pattern expects an Error object or null as the first argument of the callback. Forgetting to handle these errors can lead to...
Read more >
Error handling with promises - The Modern JavaScript Tutorial
Promise chains are great at error handling. When a promise rejects, the control jumps to the closest rejection handler.
Read more >
A Comprehensive Guide To Error Handling In Node.js
You can deal with bad parameters by defining their behavior either by throwing an error or returning a special value, such as null...
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