Skip to content
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

False positive of isInsideCallback for functions with first arg named err/error #445

Open
zharinov opened this issue Jul 22, 2023 · 0 comments

Comments

@zharinov
Copy link

Description

I'm using no-promise-in-callback rule and defining top-level function with err (or error) parameter.

Once I use Promise.resolve outside of return context, it reports an error.

Steps to Reproduce

Enable no-promise-in-callback and check this code:

function fn(err) {
  return { promise: Promise.resolve(err) };
}

Expected behavior: no warning inside functions top-level functions, methods or static methods.

Actual behavior: warnings that are confusing at first. Check out my actual code example:

static err<E>(err: NonNullable<E>): AsyncResult<never, E> {
  return new AsyncResult(Promise.resolve(Result.err(err)));
}

Versions

[Please fill this in if you are submitting a bug report]

  • Node version: 18
  • ESLint version: 8.45.0
  • eslint-plugin-promise version: 6.1.1

Additional Information

Probably, this line is the root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant