diff --git a/.eslintrc b/.eslintrc index bca4afea..a07ef6fa 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,7 @@ "ecmaVersion": 2018 }, "rules": { + "curly": "error", "quotes": [ "error", "single", diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 6aaf5989..8e30c4b6 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -2430,7 +2430,9 @@ getJasmineRequireObj().MapContaining = function(j$) { } MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isMap(other)) return false; + if (!j$.isMap(other)) { + return false; + } for (const [key, value] of this.sample) { // for each key/value pair in `sample` @@ -2569,7 +2571,9 @@ getJasmineRequireObj().SetContaining = function(j$) { } SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isSet(other)) return false; + if (!j$.isSet(other)) { + return false; + } for (const item of this.sample) { // for each item in `sample` there should be at least one matching item in `other` @@ -2918,7 +2922,9 @@ getJasmineRequireObj().clearStack = function(j$) { function getUnclampedSetTimeout(global) { const { setTimeout } = global; - if (j$.util.isUndefined(global.MessageChannel)) return setTimeout; + if (j$.util.isUndefined(global.MessageChannel)) { + return setTimeout; + } const postMessage = getPostMessage(global); return function unclampedSetTimeout(fn) { @@ -6677,7 +6683,10 @@ getJasmineRequireObj().toHaveSpyInteractions = function(j$) { let hasSpy = false; const calledSpies = []; for (const spy of Object.values(actual)) { - if (!j$.isSpy(spy)) continue; + if (!j$.isSpy(spy)) { + continue; + } + hasSpy = true; if (spy.calls.any()) { diff --git a/spec/core/ClearStackSpec.js b/spec/core/ClearStackSpec.js index 2e846ffc..1fa06c73 100644 --- a/spec/core/ClearStackSpec.js +++ b/spec/core/ClearStackSpec.js @@ -38,7 +38,9 @@ describe('ClearStack', function() { const clearStack = jasmineUnderTest.getClearStack(global); - for (let i = 0; i < 9; i++) clearStack(function() {}); + for (let i = 0; i < 9; i++) { + clearStack(function() {}); + } expect(fakeChannel.port2.postMessage).not.toHaveBeenCalled(); diff --git a/spec/core/integration/EnvSpec.js b/spec/core/integration/EnvSpec.js index 8162472f..c380f93d 100644 --- a/spec/core/integration/EnvSpec.js +++ b/spec/core/integration/EnvSpec.js @@ -1315,8 +1315,9 @@ describe('Env integration', function() { 'works with constructors when using callThrough spy strategy', function() { function MyClass(foo) { - if (!(this instanceof MyClass)) + if (!(this instanceof MyClass)) { throw new Error('You must use the new keyword.'); + } this.foo = foo; } const subject = { MyClass: MyClass }; diff --git a/src/core/ClearStack.js b/src/core/ClearStack.js index 3ae237f0..5b239f0e 100644 --- a/src/core/ClearStack.js +++ b/src/core/ClearStack.js @@ -44,7 +44,9 @@ getJasmineRequireObj().clearStack = function(j$) { function getUnclampedSetTimeout(global) { const { setTimeout } = global; - if (j$.util.isUndefined(global.MessageChannel)) return setTimeout; + if (j$.util.isUndefined(global.MessageChannel)) { + return setTimeout; + } const postMessage = getPostMessage(global); return function unclampedSetTimeout(fn) { diff --git a/src/core/asymmetric_equality/MapContaining.js b/src/core/asymmetric_equality/MapContaining.js index ef65dbe8..6e7bf8d2 100644 --- a/src/core/asymmetric_equality/MapContaining.js +++ b/src/core/asymmetric_equality/MapContaining.js @@ -11,7 +11,9 @@ getJasmineRequireObj().MapContaining = function(j$) { } MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isMap(other)) return false; + if (!j$.isMap(other)) { + return false; + } for (const [key, value] of this.sample) { // for each key/value pair in `sample` diff --git a/src/core/asymmetric_equality/SetContaining.js b/src/core/asymmetric_equality/SetContaining.js index 483c9477..490af878 100644 --- a/src/core/asymmetric_equality/SetContaining.js +++ b/src/core/asymmetric_equality/SetContaining.js @@ -11,7 +11,9 @@ getJasmineRequireObj().SetContaining = function(j$) { } SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isSet(other)) return false; + if (!j$.isSet(other)) { + return false; + } for (const item of this.sample) { // for each item in `sample` there should be at least one matching item in `other` diff --git a/src/core/matchers/toHaveSpyInteractions.js b/src/core/matchers/toHaveSpyInteractions.js index 0436a098..139d24e1 100755 --- a/src/core/matchers/toHaveSpyInteractions.js +++ b/src/core/matchers/toHaveSpyInteractions.js @@ -32,7 +32,10 @@ getJasmineRequireObj().toHaveSpyInteractions = function(j$) { let hasSpy = false; const calledSpies = []; for (const spy of Object.values(actual)) { - if (!j$.isSpy(spy)) continue; + if (!j$.isSpy(spy)) { + continue; + } + hasSpy = true; if (spy.calls.any()) {