index.js
function (pluginOptions) {
    // If user options are undefined, set an empty options object
    if (!pluginOptions) {
        pluginOptions = {};
    }
    // Save off pluginOptions so we can get it in `report()`
    tslintPlugin.pluginOptions = pluginOptions;
    // TSLint default options
    var options = {
        fix: pluginOptions.fix || false,
        formatter: pluginOptions.formatter || "prose",
        formattersDirectory: pluginOptions.formattersDirectory || null,
        rulesDirectory: pluginOptions.rulesDirectory || null
    };
    var linter = getTslint(pluginOptions);
    var tslint = new linter.Linter(options, pluginOptions.program);
    return map(function (file, cb) {
        // Skip
        if (file.isNull()) {
            return cb(null, file);
        }
        // Stream is not supported
        if (file.isStream()) {
            return cb(new PluginError("gulp-tslint", "Streaming not supported"));
        }
        var configuration = (pluginOptions.configuration === null ||
            pluginOptions.configuration === undefined ||
            isString(pluginOptions.configuration))
            // Configuration can be a file path or null, if it's unknown
            ? linter.Configuration.findConfiguration(pluginOptions.configuration || null, file.path).results
            : pluginOptions.configuration;
        tslint.lint(file.path, file.contents.toString("utf8"), configuration);
        file.tslint = tslint.getResult();
        // Clear all results for current file from tslint
        tslint.failures = [];
        tslint.fixes = [];
        // Pass file
        cb(null, file);
    });
}
function (pluginOptions) {
    // If user options are undefined, set an empty options object
    if (!pluginOptions) {
        pluginOptions = {};
    }
    // Save off pluginOptions so we can get it in `report()`
    tslintPlugin.pluginOptions = pluginOptions;
    // TSLint default options
    var options = {
        fix: pluginOptions.fix || false,
        formatter: pluginOptions.formatter || "prose",
        formattersDirectory: pluginOptions.formattersDirectory || null,
        rulesDirectory: pluginOptions.rulesDirectory || null
    };
    var linter = getTslint(pluginOptions);
    var tslint = new linter.Linter(options, pluginOptions.program);
    return map(function (file, cb) {
        // Skip
        if (file.isNull()) {
            return cb(null, file);
        }
        // Stream is not supported
        if (file.isStream()) {
            return cb(new PluginError("gulp-tslint", "Streaming not supported"));
        }
        var configuration = (pluginOptions.configuration === null ||
            pluginOptions.configuration === undefined ||
            isString(pluginOptions.configuration))
            // Configuration can be a file path or null, if it's unknown
            ? linter.Configuration.findConfiguration(pluginOptions.configuration || null, file.path).results
            : pluginOptions.configuration;
        tslint.lint(file.path, file.contents.toString("utf8"), configuration);
        file.tslint = tslint.getResult();
        // Clear all results for current file from tslint
        tslint.failures = [];
        tslint.fixes = [];
        // Pass file
        cb(null, file);
    });
}
function ( pluginOptions ) { // If user options are undefined, set an empty options object if ( ! pluginOptions ) { pluginOptions = { } ; } // Save off pluginOptions so we can get it in `report()` tslintPlugin . pluginOptions = pluginOptions ; // TSLint default options var options = { fix : pluginOptions . fix || false , formatter : pluginOptions . formatter || "prose" , formattersDirectory : pluginOptions . formattersDirectory || null , rulesDirectory : pluginOptions . rulesDirectory || null } ; var linter = getTslint ( pluginOptions ) ; var tslint = new linter . Linter ( options , pluginOptions . program ) ; return map ( function ( file , cb ) { // Skip if ( file . isNull ( ) ) { return cb ( null , file ) ; } // Stream is not supported if ( file . isStream ( ) ) { return cb ( new PluginError ( "gulp-tslint" , "Streaming not supported" ) ) ; } var configuration = ( pluginOptions . configuration === null || pluginOptions . configuration === undefined || isString ( pluginOptions . configuration ) ) // Configuration can be a file path or null, if it's unknown ? linter . Configuration . findConfiguration ( pluginOptions . configuration || null , file . path ) . results : pluginOptions . configuration ; tslint . lint ( file . path , file . contents . toString ( "utf8" ) , configuration ) ; file . tslint = tslint . getResult ( ) ; // Clear all results for current file from tslint tslint . failures = [ ] ; tslint . fixes = [ ] ; // Pass file cb ( null , file ) ; } ) ; }
Main plugin function
@param {PluginOptions} [pluginOptions] contains the options for gulp-tslint.
Optional.
@returns {any}
Main plugin function