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

273
Views
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
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!