1.15.1 • Published 1 year ago

pretty-typescript v1.15.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

✨pretty-typescript✨

Build Status npm version dependency status dev dependency status

A quite delectable Gulp plugin to format and lint TypeScript code.

Example

Turn this:

var heyo:     number

class incrediblybad
   {
private horrible_FielD: number
     dogedoge: () => any = () =>
   {
     return null      ;
  }
                      public   dude= <any>                       4;
}

Into this:

var heyo: number

class incrediblybad {
  private horrible_FielD: number
  dogedoge: () => any = () => {
    return null;
  }
  public dude = <any>4;
}

In bonus, you get this error:

[11:46:23] [gulp-tslint] error verybad.ts[3, 7]: name must be in pascal case

Usage

Step 1. Install:

npm install --save-dev pretty-typescript

Step 2. Use:

const prettyTypescript = require('pretty-typescript');

gulp.task('prettify', function () {
  gulp.src('src/**/*.ts')
    .pipe(prettyTypescript())
    .pipe(gulp.dest('src'));


// to fail the build when the linter complain : 
gulp.task('prettify', function () {
  gulp.src('src/**/*.ts')
    .pipe(prettyTypescript({ emitError: true }))
    .pipe(gulp.dest('src'));

});

Step 3. Profit !

Made with <3 by Coveo

1.15.1

1 year ago

1.15.0

9 years ago

1.13.4

9 years ago

1.13.3

9 years ago

1.13.1

9 years ago

1.14.0

9 years ago

1.13.0

9 years ago

1.12.1

9 years ago

1.12.0

9 years ago

1.11.0

10 years ago

1.10.0

10 years ago

1.9.0

10 years ago

1.8.0

10 years ago

1.7.0

10 years ago

1.6.0

10 years ago

1.5.0

10 years ago

1.4.0

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago