1.0.2 • Published 8 years ago

gulp-tsfmt v1.0.2

Weekly downloads
121
License
MIT
Repository
github
Last release
8 years ago

gulp-tsfmt

Dependency status devDependency Status Build Status

A gulp plugin for formatting TypeScript files.

Installation

npm install gulp-tsfmt

TypeScript Version

gulp-tsfmt doesn't have own depency on TypeScript. You are expected to npm install typescript your own version. It's currently testes with version 1.7.5.

Usage

The snippet below formats and replaces in place each TypeScript file.

import tsfmt from 'gulp-tsfmt';

gulp.task('format', () => {
  gulp.src('**/*.ts')
    .pipe(tsfmt({ options: { ... }))
    .pipe(gulp.dest(file => path.dirname(file.path)));
});

You can also use gulp-changed-in-place plugin to prevent reformatting all files when only once changes.

import tsfmt from 'gulp-changed-in-place';
import tsfmt from 'gulp-tsfmt';

gulp.task('format', () => {
  gulp.src('**/*.ts')
    .pipe(changedInPlace())
    .pipe(tsfmt({ options: { ... }))
    .pipe(gulp.dest(file => path.dirname(file.path)));
});

Options

Here are the default values and available configuration options:

IndentSize: 2
TabSize: 2
NewLineCharacter: "\n"
ConvertTabsToSpaces: true
InsertSpaceAfterCommaDelimiter: true
InsertSpaceAfterSemicolonInForStatements: true
InsertSpaceBeforeAndAfterBinaryOperators: true
InsertSpaceAfterKeywordsInControlFlowStatements: true
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false
PlaceOpenBraceOnNewLineForFunctions: false
PlaceOpenBraceOnNewLineForControlBlocks: false

License

MIT

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago