const supertest = require('supertest-as-promised');
const expect = require('chai').expect;
const request = supertest(process.env.BASE_URI);`我得到了这个ESLint错误:
“‘expect”被赋予一个值,但从未使用过。
对于expect语句。我可以做哪些更改来消除我所有.js文件中的这些错误?
发布于 2017-02-28 15:54:41
您正遇到来自no-unused-vars的ESLint规则。你可以从他们的文档上读到更多关于这一点的信息。
ESLint向您发出警告的原因是您已经声明了expect并为其分配了一个值。
const expect = require('chai').expect; ,但是您在任何地方都没有使用它。
为了消除错误,您需要在某个地方使用expect。
describe('A test', () => {
it('should do something', () => {
expect(something).to.be.true;
});
});发布于 2017-02-28 16:07:41
可以在.eslint文件中使用
{
"rules": {
"no-unused-vars": ["error", { "vars": "local", "args": "after-used", "ignoreRestSiblings": true }]
}
}有关更多信息,请查看此链接http://eslint.org/docs/rules/no-unused-vars
https://stackoverflow.com/questions/42512948
复制相似问题