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 no-callback-in-promise in 7.2.0 #572

Closed
zloirock opened this issue Nov 25, 2024 · 3 comments · Fixed by #574
Closed

False positive of no-callback-in-promise in 7.2.0 #572

zloirock opened this issue Nov 25, 2024 · 3 comments · Fixed by #574

Comments

@zloirock
Copy link
Contributor

In many different cases. Example:

'use strict';
var call = require('../internals/function-call');

module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
  var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
  var next = record.next;
  var step, result;
  while (!(step = call(next, iterator)).done) { // 8:24  error  Avoid calling back inside of a promise  promise/no-callback-in-promise
    result = fn(step.value);
    if (result !== undefined) return result;
  }
};
@hsarokina-ita
Copy link

Looks like I'm experiencing the same issue. I noticed that many parts of my code fail linting when they include arguments named next, even though they're unrelated to promise usage.

@kevinoid
Copy link

A reproduction is any CallExpression where the callee is not named like a callback and an argument is named like a callback. A minimal repro:

function hasCallbackArg(callback) {
  console.log(callback);
}

This was regressed by 907753f

It appears that without the call to hasPromiseCallback, there is nothing to constrain the rule to code inside a promise.

CC: @brettz9

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.

4 participants