diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index f5ab77db..2fcb1c9e 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1102,8 +1102,6 @@ getJasmineRequireObj().Spec = function(j$) { return Spec; }; -/*jshint bitwise: false*/ - getJasmineRequireObj().Order = function() { function Order(options) { this.random = 'random' in options ? options.random : true; @@ -2709,12 +2707,9 @@ getJasmineRequireObj().Any = function(j$) { return typeof other == 'boolean'; } - /* jshint -W122 */ - /* global Symbol */ if (typeof Symbol != 'undefined' && this.expectedObject == Symbol) { return typeof other == 'symbol'; } - /* jshint +W122 */ return other instanceof this.expectedObject; }; @@ -3717,11 +3712,10 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) { ) { var f; if (typeof funcToCall === 'string') { - /* jshint evil: true */ f = function() { + // eslint-disable-next-line no-eval return eval(funcToCall); }; - /* jshint evil: false */ } else { f = funcToCall; } diff --git a/package.json b/package.json index c41f688e..a6910d65 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,8 @@ "error", "always" ], - "space-before-blocks": "error" + "space-before-blocks": "error", + "no-eval": "error" } }, "browserslist": [ diff --git a/spec/core/QueueRunnerSpec.js b/spec/core/QueueRunnerSpec.js index 67a82902..bf00c12b 100644 --- a/spec/core/QueueRunnerSpec.js +++ b/spec/core/QueueRunnerSpec.js @@ -632,7 +632,8 @@ describe('QueueRunner', function() { }); it('issues a more specific error if the function is `async`', function() { - eval('var fn = async function(done){};'); + // eslint-disable-next-line no-unused-vars + async function fn(done) {} const onException = jasmine.createSpy('onException'), queueRunner = new jasmineUnderTest.QueueRunner({ queueableFns: [{ fn: fn }], diff --git a/spec/core/SpyStrategySpec.js b/spec/core/SpyStrategySpec.js index b0681311..a6492018 100644 --- a/spec/core/SpyStrategySpec.js +++ b/spec/core/SpyStrategySpec.js @@ -106,9 +106,9 @@ describe('SpyStrategy', function() { it('allows a fake async function to be called instead', function(done) { const originalFn = jasmine.createSpy('original'), - fakeFn = jasmine - .createSpy('fake') - .and.callFake(eval('async () => { return 67; }')), + fakeFn = jasmine.createSpy('fake').and.callFake(async () => { + return 67; + }), spyStrategy = new jasmineUnderTest.SpyStrategy({ fn: originalFn }); spyStrategy.callFake(fakeFn); diff --git a/spec/core/matchers/toBeInstanceOfSpec.js b/spec/core/matchers/toBeInstanceOfSpec.js index cb6ea070..13ba614a 100644 --- a/spec/core/matchers/toBeInstanceOfSpec.js +++ b/spec/core/matchers/toBeInstanceOfSpec.js @@ -104,7 +104,9 @@ describe('toBeInstanceOf', function() { }); it('passes for an async function', function() { - const fn = eval("(async function fn() { return 'foo'; })"); + async function fn() { + return 'foo'; + } const matcher = jasmineUnderTest.matchers.toBeInstanceOf(); const result = matcher.compare(fn, Function); diff --git a/src/core/DelayedFunctionScheduler.js b/src/core/DelayedFunctionScheduler.js index aabdd911..68bddc78 100644 --- a/src/core/DelayedFunctionScheduler.js +++ b/src/core/DelayedFunctionScheduler.js @@ -24,11 +24,10 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) { ) { var f; if (typeof funcToCall === 'string') { - /* jshint evil: true */ f = function() { + // eslint-disable-next-line no-eval return eval(funcToCall); }; - /* jshint evil: false */ } else { f = funcToCall; } diff --git a/src/core/Order.js b/src/core/Order.js index 050e1001..9839da2a 100644 --- a/src/core/Order.js +++ b/src/core/Order.js @@ -1,5 +1,3 @@ -/*jshint bitwise: false*/ - getJasmineRequireObj().Order = function() { function Order(options) { this.random = 'random' in options ? options.random : true; diff --git a/src/core/asymmetric_equality/Any.js b/src/core/asymmetric_equality/Any.js index bbee1bdc..abc3207c 100644 --- a/src/core/asymmetric_equality/Any.js +++ b/src/core/asymmetric_equality/Any.js @@ -30,12 +30,9 @@ getJasmineRequireObj().Any = function(j$) { return typeof other == 'boolean'; } - /* jshint -W122 */ - /* global Symbol */ if (typeof Symbol != 'undefined' && this.expectedObject == Symbol) { return typeof other == 'symbol'; } - /* jshint +W122 */ return other instanceof this.expectedObject; };