From 8e3d7985f596baa56144e998ecfb1e18c5c51182 Mon Sep 17 00:00:00 2001 From: Morgan Roderick Date: Mon, 8 Oct 2018 22:40:38 +0200 Subject: [PATCH] Fix lint violations for no-useless-call --- lib/sinon/create-sandbox.js | 2 +- lib/sinon/sandbox.js | 2 +- lib/sinon/spy.js | 2 +- test/sandbox-test.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/sinon/create-sandbox.js b/lib/sinon/create-sandbox.js index e636f057f..aa637f8df 100644 --- a/lib/sinon/create-sandbox.js +++ b/lib/sinon/create-sandbox.js @@ -19,7 +19,7 @@ function prepareSandboxFromConfig(config) { if (config.useFakeTimers) { if (typeof config.useFakeTimers === "object") { - sandbox.useFakeTimers.call(sandbox, config.useFakeTimers); + sandbox.useFakeTimers(config.useFakeTimers); } else { sandbox.useFakeTimers(); } diff --git a/lib/sinon/sandbox.js b/lib/sinon/sandbox.js index 416c7f75a..c4f03e2bd 100644 --- a/lib/sinon/sandbox.js +++ b/lib/sinon/sandbox.js @@ -55,7 +55,7 @@ function Sandbox() { if (typeof constructor !== "function") { throw new TypeError("The constructor should be a function."); } - return this.stub.call(this, Object.create(constructor.prototype)); + return this.stub(Object.create(constructor.prototype)); }; sandbox.inject = function inject(obj) { diff --git a/lib/sinon/spy.js b/lib/sinon/spy.js index 1d36815ce..207dd2af4 100644 --- a/lib/sinon/spy.js +++ b/lib/sinon/spy.js @@ -387,7 +387,7 @@ var spyApi = { formatter = spyApi.formatters[specifyer]; if (typeof formatter === "function") { - return String(formatter.call(null, spyInstance, args)); + return String(formatter(spyInstance, args)); } else if (!isNaN(parseInt(specifyer, 10))) { return sinonFormat(args[specifyer - 1]); } diff --git a/test/sandbox-test.js b/test/sandbox-test.js index 92a7d4d9f..982d533cc 100644 --- a/test/sandbox-test.js +++ b/test/sandbox-test.js @@ -1483,8 +1483,8 @@ describe("Sandbox", function () { var sandbox = createSandbox(); var fakes = sandbox.getFakes(); - fakes.push.call(fakes, {verify: sinonSpy()}); - fakes.push.call(fakes, {verify: sinonSpy()}); + fakes.push({verify: sinonSpy()}); + fakes.push({verify: sinonSpy()}); sandbox.verify();