A quite delectable Gulp plugin to format and lint TypeScript code.
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
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'));
});
Step 3. Profit !
Made with <3 by Coveo