I'm using ESLint on all my files, including the test files, with a no-unused-var: true
rule. I'm using Should.js in my Mocha tests, and in one of the files, I'm getting an error on the should
variable. A quick comparison to the other tests shows, that in other files I have at least one line that starts with should
(i.e. should.not.exist(err);
), whereas in this particular file, I only use it in property form (i.e. a.should.equal(b)
).
Short of turning the rule off for the entire file, or coercing perfectly readable tests into the variable use of should
, is there any way around this? Can I turn off the rule just for the should
variable? Perhaps add an exception for it? Or (hopefully) a more elegant solution?
In this particular file you can just require instead of declaring.
var should = require('should');
instead do
require('should');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With