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 · May be fixed by #513
Open

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

zharinov opened this issue Jul 22, 2023 · 0 comments · May be fixed by #513

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.

brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Jul 25, 2024
@brettz9 brettz9 linked a pull request Jul 25, 2024 that will close this issue
1 task
brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Jul 25, 2024
brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Jul 29, 2024
brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Jul 30, 2024
brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Oct 16, 2024
brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Oct 16, 2024
brettz9 added a commit to brettz9/eslint-plugin-promise that referenced this issue Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants