Lint your source files with TSLint.
(String|Array) Glob or array of globs (What's a glob?) matching TypeScript files. Default: 'app/**/*.ts'
.
(Object) All tslint options. Default:
{
configuration: 'tslint.json',
rulesDirectory: null,
tslint: null
}
(String) A string with the name of the reporter for outputting errors. Default: "verbose"
. Options: "json", "prose", "verbose", "full", "msbuild"
. See the gulp-tslint docs for descriptions.
(Object) All reporter options. Default:
{
emitError: true,
reportLimit: 0,
summarizeFailureOutput: false
}
To use this task, install the npm package:
npm install --save-dev ionic-gulp-tslint
Note: this package is already added by default to Ionic 2 starters.
Add the following to the gulpfile.js
in order to run gulp lint
from a terminal and use the rules found in the tslint.json
file.
var tslint = require('ionic-gulp-tslint');
// default options
gulp.task('lint', tslint);
Many of the options can be overridden from the defaults. The following task passes custom options.
var tslint = require('ionic-gulp-tslint');
// override options
gulp.task('lint', function () {
return tslint({
src: 'app/**/*.ts',
tslintOptions: {
configuration: 'source/tslint.json'
},
reporter: "prose",
reportOptions: {
emitError: true
}
});
});