Skip to content

Commit a73b3da

Browse files
committed
Use a dot-file to configure clang-format
1 parent 00e23aa commit a73b3da

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.clang-format

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Language: JavaScript
2+
BasedOnStyle: Google
3+
ColumnLimit: 100

gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var tsProject = ts.createProject(TSC_OPTIONS);
2424

2525
gulp.task('check-format', function() {
2626
return gulp.src('*.ts')
27-
.pipe(formatter.checkFormat());
27+
.pipe(formatter.checkFormat('file'));
2828
});
2929

3030
gulp.task('compile', function() {

main.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import ts = require("typescript");
77
export function translateProgram(program: ts.Program): string {
88
var result: string = "";
99
program.getSourceFiles()
10-
.filter((sourceFile: ts.SourceFile) =>
11-
sourceFile.fileName.indexOf(".d.ts") < 0)
10+
.filter((sourceFile: ts.SourceFile) => sourceFile.fileName.indexOf(".d.ts") < 0)
1211
.forEach(emitDart);
1312
return result;
1413

@@ -55,8 +54,7 @@ export function translateProgram(program: ts.Program): string {
5554

5655
function visit(node: ts.Node) {
5756
// console.log(`Node kind: ${node.kind} ${node.getText()}`);
58-
var comments = ts.getLeadingCommentRanges(node.getSourceFile().text,
59-
node.getFullStart());
57+
var comments = ts.getLeadingCommentRanges(node.getSourceFile().text, node.getFullStart());
6058
if (comments) {
6159
comments.forEach((c) => {
6260
if (c.pos <= lastCommentIdx) return;
@@ -354,8 +352,7 @@ export function translateProgram(program: ts.Program): string {
354352

355353
case ts.SyntaxKind.Parameter:
356354
var paramDecl = <ts.ParameterDeclaration> node;
357-
if (paramDecl.dotDotDotToken)
358-
reportError(node, 'rest parameters are unsupported');
355+
if (paramDecl.dotDotDotToken) reportError(node, 'rest parameters are unsupported');
359356
if (paramDecl.initializer) emit('[');
360357
if (paramDecl.type) visit(paramDecl.type);
361358
visit(paramDecl.name);
@@ -379,8 +376,7 @@ export function translateProgram(program: ts.Program): string {
379376
break;
380377

381378
default:
382-
reportError(
383-
node, "Unsupported node type " + (<any> ts).SyntaxKind[node.kind]);
379+
reportError(node, "Unsupported node type " + (<any> ts).SyntaxKind[node.kind]);
384380
break;
385381
}
386382
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"devDependencies": {
1414
"chai": "^2.1.1",
1515
"gulp": "^3.8.11",
16+
"gulp-clang-format": "^1.0.0",
1617
"gulp-mocha": "^2.0.0",
1718
"gulp-sourcemaps": "^1.5.0",
1819
"gulp-typescript": "ivogabe/gulp-typescript",

0 commit comments

Comments
 (0)