Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

123
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda