Skip to content

Commit bea1bcb

Browse files
committed
brace-style
1 parent 550a99e commit bea1bcb

6 files changed

Lines changed: 27 additions & 20 deletions

File tree

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
"arrow-body-style": "off",
6464
"arrow-parens": "off",
65-
"brace-style": "off",
65+
"brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
6666
"comma-dangle": "off",
6767
"complexity": "off",
6868
"constructor-super": "error",

scripts/authors.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,13 @@ if (args.length < 1) {
170170
console.log('Usage: node authors.js [command]');
171171
console.log('List of commands: ');
172172
Object.keys(Commands).forEach(k => console.log(` ${k}: ${(Commands as any)[k].description}`));
173-
} else {
173+
}
174+
else {
174175
var cmd: Function = (Commands as any)[args[0]];
175176
if (cmd === undefined) {
176177
console.log('Unknown command ' + args[1]);
177-
} else {
178+
}
179+
else {
178180
cmd.apply(undefined, args.slice(1));
179181
}
180182
}

scripts/bisect-test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,39 @@ jake.on('close', jakeExitCode => {
2525
if ((tscExitCode === 0) === (args[1] === 'compiles')) {
2626
console.log('Good');
2727
process.exit(0); // Good
28-
} else {
28+
}
29+
else {
2930
console.log('Bad');
3031
process.exit(1); // Bad
3132
}
3233
});
33-
} else if (args[1] === 'emits' || args[1] === '!emits') {
34+
}
35+
else if (args[1] === 'emits' || args[1] === '!emits') {
3436
tsc(args[0], tscExitCode => {
3537
fs.readFile(args[2], 'utf-8', (err, data) => {
3638
var doesContains = data.indexOf(args[3]) >= 0;
3739
if (doesContains === (args[1] === 'emits')) {
3840
console.log('Good');
3941
process.exit(0); // Good
40-
} else {
42+
}
43+
else {
4144
console.log('Bad');
4245
process.exit(1); // Bad
4346
}
4447
});
4548
});
46-
} else {
49+
}
50+
else {
4751
console.log('Unknown command line arguments.');
4852
console.log('Usage (compile errors): git bisect run ts-node scripts\bisect-test.ts "../failure.ts --module amd" !compiles');
4953
console.log('Usage (emit check): git bisect run ts-node scripts\bisect-test.ts bar.ts emits bar.js "_this = this"');
5054
// Aborts the 'git bisect run' process
5155
process.exit(-1);
5256
}
53-
} else {
57+
}
58+
else {
5459
// Compiler build failed; skip this commit
5560
console.log('Skip');
5661
process.exit(125); // bisect skip
5762
}
5863
});
59-

src/testRunner/rwcRunner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ namespace RWC {
1111

1212
try {
1313
fn(oldIO);
14-
} finally {
14+
}
15+
finally {
1516
wrappedIO.endReplay();
1617
Harness.IO = oldIO;
1718
}

src/testRunner/unittests/tsserver/projects.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ namespace ts.projectSystem {
366366
const proj = projectService.externalProjects[0];
367367
assert.deepEqual(proj.getFileNames(/*excludeFilesFromExternalLibraries*/ true), [file1.path]);
368368
assert.deepEqual(proj.getTypeAcquisition().include, ["duck-types"]);
369-
} finally {
369+
}
370+
finally {
370371
projectService.resetSafeList();
371372
}
372373
});
@@ -464,7 +465,8 @@ namespace ts.projectSystem {
464465
const proj = projectService.externalProjects[0];
465466
assert.deepEqual(proj.getFileNames(/*excludeFilesFromExternalLibraries*/ true), [file1.path]);
466467
assert.deepEqual(proj.getTypeAcquisition().include, ["kendo-ui", "office"]);
467-
} finally {
468+
}
469+
finally {
468470
projectService.resetSafeList();
469471
}
470472
});
@@ -504,7 +506,8 @@ namespace ts.projectSystem {
504506
projectService.openExternalProject({ projectFileName: "project", options: {}, rootFiles: toExternalFiles([file1.path, file2.path]), typeAcquisition: { enable: true } });
505507
const proj = projectService.externalProjects[0];
506508
assert.deepEqual(proj.getFileNames(), [file2.path]);
507-
} finally {
509+
}
510+
finally {
508511
projectService.resetSafeList();
509512
}
510513
});

src/tsserver/server.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -911,14 +911,11 @@ namespace ts.server {
911911
cancellationToken = nullCancellationToken;
912912
}
913913

914-
let eventPort: number | undefined;
915-
{
916-
const str = findArgument("--eventPort");
917-
const v = str === undefined ? undefined : parseInt(str);
918-
if (v !== undefined && !isNaN(v)) {
919-
eventPort = v;
920-
}
914+
function parseEventPort(eventPortStr: string | undefined) {
915+
const eventPort = eventPortStr === undefined ? undefined : parseInt(eventPortStr);
916+
return eventPort !== undefined && !isNaN(eventPort) ? eventPort : undefined;
921917
}
918+
const eventPort: number | undefined = parseEventPort(findArgument("--eventPort"));
922919

923920
const localeStr = findArgument("--locale");
924921
if (localeStr) {

0 commit comments

Comments
 (0)