Chai: 'should' is assigned a value but never used no-unused-vars

Created on 4 Aug 2018  路  1Comment  路  Source: chaijs/chai

I have googled forever, please how do I let eslint know should is being used.

let should = require("chai").should();

 it.("xxxx", function () {
        xxx.should.have.ownProperty("Comments");
 });

Eslint says: 'should' is assigned a value but never used no-unused-vars

Most helpful comment

Hey @jomadoye thanks for the issue.

eslint is behaving correctly here: you don't need the let should = part! The reason is that chai.should() adds itself to the object prototype, so xxx.should is a property on xxx, _not_ a variable. You'll only need let should = ... if you're going to use the should.exist() assertion.

I'm going to close this issue - because its not a bug within our code. However if you do run into any more issues that you feel could be bugs, please don't hesitate to open a new issue. I wish you the best of luck with your work :smile:.

>All comments

Hey @jomadoye thanks for the issue.

eslint is behaving correctly here: you don't need the let should = part! The reason is that chai.should() adds itself to the object prototype, so xxx.should is a property on xxx, _not_ a variable. You'll only need let should = ... if you're going to use the should.exist() assertion.

I'm going to close this issue - because its not a bug within our code. However if you do run into any more issues that you feel could be bugs, please don't hesitate to open a new issue. I wish you the best of luck with your work :smile:.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

basherr picture basherr  路  4Comments

leifhanack picture leifhanack  路  4Comments

zzzgit picture zzzgit  路  3Comments

meeber picture meeber  路  4Comments

JuHwon picture JuHwon  路  5Comments