Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
XO Lint Issue Using Promise.map unicorn/no-array-method-this-argument

I am using XO for linting my code, and I cannot figure out why this lint error is being reported for the following code...

import Promise from 'bluebird';

const handler = items => {
  return Promise.map(items, item => {
    return Promise.resolve(item);
  });
};

export default handler;

When I save this to lint-test.js, and then run the following command...

npx xo lint-test.js

I get this error...

lint-test.js:4:29
  ✖  4:29  Do not use the this argument in Array#map().  unicorn/no-array-method-this-argument

  1 error

The reference for this rule is here... https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md

I must be missing something simple. I know this is an oversimplified example, but of course, in my real code, I am doing something more interesting with "item".

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You're calling a method named .map and passing more than one argument - this is all the rule is looking for. The ESlint rule doesn't understand that Promise is the bluebird library but thinks it's an array, and that you're calling the Array map method, where the second parameter is for the this argument (and which the warning says you shouldn't use).

It's a false positive.

Remove the rule from your settings, ignore it for that line, or make a PR to add an exception for Promise as the receiver of the method call.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!