From bea1bcb466a840f34aae3917e0b7e7d24cf605c9 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Fri, 14 Jun 2019 10:51:09 +0300 Subject: [PATCH] brace-style --- .eslintrc | 2 +- scripts/authors.ts | 6 ++++-- scripts/bisect-test.ts | 16 ++++++++++------ src/testRunner/rwcRunner.ts | 3 ++- src/testRunner/unittests/tsserver/projects.ts | 9 ++++++--- src/tsserver/server.ts | 11 ++++------- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.eslintrc b/.eslintrc index feb8cd9754a..04d9c7ce38d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -62,7 +62,7 @@ "arrow-body-style": "off", "arrow-parens": "off", - "brace-style": "off", + "brace-style": ["error", "stroustrup", { "allowSingleLine": true }], "comma-dangle": "off", "complexity": "off", "constructor-super": "error", diff --git a/scripts/authors.ts b/scripts/authors.ts index 34b7ab766b5..0c88d1f4345 100644 --- a/scripts/authors.ts +++ b/scripts/authors.ts @@ -170,11 +170,13 @@ if (args.length < 1) { console.log('Usage: node authors.js [command]'); console.log('List of commands: '); Object.keys(Commands).forEach(k => console.log(` ${k}: ${(Commands as any)[k].description}`)); -} else { +} +else { var cmd: Function = (Commands as any)[args[0]]; if (cmd === undefined) { console.log('Unknown command ' + args[1]); - } else { + } + else { cmd.apply(undefined, args.slice(1)); } } diff --git a/scripts/bisect-test.ts b/scripts/bisect-test.ts index d66e0b71061..fb56dad9b85 100644 --- a/scripts/bisect-test.ts +++ b/scripts/bisect-test.ts @@ -25,35 +25,39 @@ jake.on('close', jakeExitCode => { if ((tscExitCode === 0) === (args[1] === 'compiles')) { console.log('Good'); process.exit(0); // Good - } else { + } + else { console.log('Bad'); process.exit(1); // Bad } }); - } else if (args[1] === 'emits' || args[1] === '!emits') { + } + else if (args[1] === 'emits' || args[1] === '!emits') { tsc(args[0], tscExitCode => { fs.readFile(args[2], 'utf-8', (err, data) => { var doesContains = data.indexOf(args[3]) >= 0; if (doesContains === (args[1] === 'emits')) { console.log('Good'); process.exit(0); // Good - } else { + } + else { console.log('Bad'); process.exit(1); // Bad } }); }); - } else { + } + else { console.log('Unknown command line arguments.'); console.log('Usage (compile errors): git bisect run ts-node scripts\bisect-test.ts "../failure.ts --module amd" !compiles'); console.log('Usage (emit check): git bisect run ts-node scripts\bisect-test.ts bar.ts emits bar.js "_this = this"'); // Aborts the 'git bisect run' process process.exit(-1); } - } else { + } + else { // Compiler build failed; skip this commit console.log('Skip'); process.exit(125); // bisect skip } }); - \ No newline at end of file diff --git a/src/testRunner/rwcRunner.ts b/src/testRunner/rwcRunner.ts index 729ed167fff..081c11cd0b9 100644 --- a/src/testRunner/rwcRunner.ts +++ b/src/testRunner/rwcRunner.ts @@ -11,7 +11,8 @@ namespace RWC { try { fn(oldIO); - } finally { + } + finally { wrappedIO.endReplay(); Harness.IO = oldIO; } diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 409ce5c525f..0e349bd1cdb 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -366,7 +366,8 @@ namespace ts.projectSystem { const proj = projectService.externalProjects[0]; assert.deepEqual(proj.getFileNames(/*excludeFilesFromExternalLibraries*/ true), [file1.path]); assert.deepEqual(proj.getTypeAcquisition().include, ["duck-types"]); - } finally { + } + finally { projectService.resetSafeList(); } }); @@ -464,7 +465,8 @@ namespace ts.projectSystem { const proj = projectService.externalProjects[0]; assert.deepEqual(proj.getFileNames(/*excludeFilesFromExternalLibraries*/ true), [file1.path]); assert.deepEqual(proj.getTypeAcquisition().include, ["kendo-ui", "office"]); - } finally { + } + finally { projectService.resetSafeList(); } }); @@ -504,7 +506,8 @@ namespace ts.projectSystem { projectService.openExternalProject({ projectFileName: "project", options: {}, rootFiles: toExternalFiles([file1.path, file2.path]), typeAcquisition: { enable: true } }); const proj = projectService.externalProjects[0]; assert.deepEqual(proj.getFileNames(), [file2.path]); - } finally { + } + finally { projectService.resetSafeList(); } }); diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index ad999091919..ad4d30a203a 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -911,14 +911,11 @@ namespace ts.server { cancellationToken = nullCancellationToken; } - let eventPort: number | undefined; - { - const str = findArgument("--eventPort"); - const v = str === undefined ? undefined : parseInt(str); - if (v !== undefined && !isNaN(v)) { - eventPort = v; - } + function parseEventPort(eventPortStr: string | undefined) { + const eventPort = eventPortStr === undefined ? undefined : parseInt(eventPortStr); + return eventPort !== undefined && !isNaN(eventPort) ? eventPort : undefined; } + const eventPort: number | undefined = parseEventPort(findArgument("--eventPort")); const localeStr = findArgument("--locale"); if (localeStr) {