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

121
Views
Problema de pelusa XO al usar Promise.map unicorn/no-array-method-this-argument

Estoy usando XO para filtrar mi código, y no puedo entender por qué se informa este error de pelusa para el siguiente código...

 import Promise from 'bluebird'; const handler = items => { return Promise.map(items, item => { return Promise.resolve(item); }); }; export default handler;

Cuando guardo esto en lint-test.js, y luego ejecuto el siguiente comando...

 npx xo lint-test.js

me sale este 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

La referencia para esta regla está aquí... https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-method-this-argument.md

Debo estar perdiendo algo simple. Sé que este es un ejemplo demasiado simplificado, pero por supuesto, en mi código real, estoy haciendo algo más interesante con "elemento".

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

0

Está llamando a un método llamado .map y pasando más de un argumento: esto es todo lo que busca la regla. La regla ESlint no entiende que Promise es la biblioteca bluebird pero cree que es una matriz y que está llamando al método de map de matriz , donde el segundo parámetro es para this argumento (y que la advertencia dice que no debe usar ).

Es un falso positivo.

Elimine la regla de su configuración, ignórela para esa línea o haga un PR para agregar una excepción para Promise como receptor de la llamada al método.

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!