diff --git a/src/harness/evaluator.ts b/src/harness/evaluator.ts index 168fda1d7670e..a22bdb958bc5f 100644 --- a/src/harness/evaluator.ts +++ b/src/harness/evaluator.ts @@ -56,6 +56,7 @@ namespace evaluator { } const evaluateText = `(function (module, exports, require, __dirname, __filename, ${globalNames.join(", ")}) { ${output.text} })`; + // tslint:disable-next-line:no-eval const evaluateThunk = eval(evaluateText) as (module: any, exports: any, require: (id: string) => any, dirname: string, filename: string, ...globalArgs: any[]) => void; const module: { exports: any; } = { exports: {} }; evaluateThunk.call(globals, module, module.exports, noRequire, vpath.dirname(output.file), output.file, FakeSymbol, ...globalArgs); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index b0bb35d5db3bc..f3a7197e7772c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -3159,6 +3159,7 @@ ${code} const debug = new FourSlashInterface.Debug(state); const format = new FourSlashInterface.Format(state); const cancellation = new FourSlashInterface.Cancellation(state); + // tslint:disable-next-line:no-eval const f = eval(wrappedCode); f(test, goTo, plugins, verify, edit, debug, format, cancellation, FourSlashInterface.Classification, FourSlashInterface.Completion, verifyOperationIsCancelled); } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 13ef2adbf90be..a78a04c3ecbe3 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -77,6 +77,7 @@ namespace Utils { const environment = getExecutionEnvironment(); switch (environment) { case ExecutionEnvironment.Browser: + // tslint:disable-next-line:no-eval eval(fileContents); break; case ExecutionEnvironment.Node: diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index a78ef88e5b74b..b70afecb7916d 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -766,6 +766,7 @@ namespace Harness.LanguageService { } setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any { + // tslint:disable-next-line:ban return setTimeout(callback, ms, args); } diff --git a/src/testRunner/parallel/host.ts b/src/testRunner/parallel/host.ts index 376896a469777..9adf9e7e850df 100644 --- a/src/testRunner/parallel/host.ts +++ b/src/testRunner/parallel/host.ts @@ -302,6 +302,7 @@ namespace Harness.Parallel.Host { worker.timer = undefined; } else { + // tslint:disable-next-line:ban worker.timer = setTimeout(killChild, data.payload.duration, data.payload); } break; @@ -623,6 +624,7 @@ namespace Harness.Parallel.Host { shimNoopTestInterface(global); } + // tslint:disable-next-line:ban setTimeout(() => startDelayed(perfData, totalCost), 0); // Do real startup on next tick, so all unit tests have been collected } } diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index 21146958748a8..0dc57ca520ad5 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -705,6 +705,7 @@ namespace ts.server { // stat due to inconsistencies of fs.watch // and efficiency of stat on modern filesystems function startWatchTimer() { + // tslint:disable-next-line:ban setInterval(() => { let count = 0; let nextToCheck = nextFileToCheck; diff --git a/tslint.json b/tslint.json index a3ca10e75edbc..5952c770c5e7e 100644 --- a/tslint.json +++ b/tslint.json @@ -5,6 +5,11 @@ "no-unnecessary-type-assertion": true, "array-type": [true, "array"], + "ban": [ + true, + "setInterval", + "setTimeout" + ], "ban-types": { "options": [ ["Object", "Avoid using the `Object` type. Did you mean `object`?"], @@ -34,6 +39,7 @@ ], "no-bom": true, "no-double-space": true, + "no-eval": true, "no-in-operator": true, "no-increment-decrement": true, "no-inferrable-types": true, @@ -100,7 +106,6 @@ "no-console": false, "no-debugger": false, "no-empty-interface": false, - "no-eval": false, "no-object-literal-type-assertion": false, "no-shadowed-variable": false, "no-submodule-imports": false,