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

297
Views
¿Cómo corregir la advertencia "eslint-disable-next-line no-unused-expressions"?

Estoy usando Chai para escribir algunas pruebas unitarias. Estoy haciendo dos afirmaciones en una array de strings . Estoy afirmando que la array es una array real y contiene solo strings . Ambas afirmaciones están pasando y funcionan correctamente. Sin embargo, en la segunda afirmación, recibo esta advertencia : eslint-disable-next-line no-unused-expressions . No estoy seguro de cómo corregir esta advertencia antes de ignorarla. ¿Cómo puedo lograr esto?

 import { assert, expect } from 'chai'; import { prContributors } from './pr-contributors.js'; describe('Pull Request Contributor List array', () => { it('should be an array', () => { assert.isArray(prContributors, 'prContributors is an array'); }); it('should contain only strings', () => { // eslint-disable-next-line no-unused-expressions expect(prContributors.every((contributor) => typeof contributor === 'string')).to.be.true; }); });

Pude arreglarlo almacenando los results en una variable e imprimiéndolos, pero no quiero agregar un console.log() innecesario y cambié una advertencia por otra.

 it('should contain only strings', () => { const result = prContributors.every((contributor) => typeof contributor === 'string'); console.log(result); // now I traded the warning :( });

También intento esto:

 it('should contain only strings', () => { const result = prContributors.every((contributor) => typeof contributor === 'string'); expect(result).to.be.true; // still got the warning });

Sin embargo, la advertencia sigue ahí.

about 4 years ago · Juan Pablo Isaza
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!