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

293
Vistas
How to fix warning "eslint-disable-next-line no-unused-expressions"?

I'm using Chai to write some unit tests. I'm doing two assertions on an array of strings. I'm asserting the array is an actual array & it contains only strings. Both assertions are passing & working properly. However, in the second assertion, I'm getting this warning: eslint-disable-next-line no-unused-expressions. I'm unsure of how to fix this warning before ignoring it. How can I accomplish this?

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;
  });
});

I was able to fix it by storing the results in a variable & print it, but I don't want to add an unnecessary console.log() & I traded a warning for another.

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

I also try this:

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

However, the warning is still there.

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