gulp-tslint is a Gulp plugin that integrates the TSLint static analysis tool into a Gulp build pipeline for TypeScript projects. It allows developers to lint TypeScript files as part of their Gulp tasks, applying TSLint's rules and custom formatters to report issues. The current stable version is 8.1.4. A critical point for users to understand is its dependency on TSLint, which has officially been deprecated by its maintainers in favor of ESLint. Consequently, `gulp-tslint` is effectively in an abandoned state, as its upstream linter is no longer maintained. Users should be aware that new TSLint rules or features will not be added, and future TypeScript language features may not be fully supported. The plugin offers various output formatters and options to control error reporting behavior, such as preventing Gulp from exiting on lint failures, and supports custom TSLint configurations.
npm install gulp-tslintVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up a Gulp task to lint TypeScript files using `gulp-tslint`, applying a 'stylish' formatter and configuring error reporting behavior. It assumes a `tslint.json` file is present or configuration is provided inline.
Consider migrating your TypeScript projects to use ESLint with its TypeScript plugin (`@typescript-eslint/eslint-plugin`) and integrating it with Gulp via `gulp-eslint` or a similar plugin.
Remove any `reporter` options from `tslint.report()` and instead specify the desired `formatter` (e.g., 'verbose', 'stylish') within the `tslint()` options object.
Ensure a `tslint.json` file is present in your project root or an ancestor directory, or provide the `configuration` option with a path to a TSLint config file or an inline configuration object.
To prevent Gulp from stopping on lint errors, set the `emitError` option to `false` in the `tslint.report()` call: `.pipe(tslint.report({ emitError: false }))`.Install the required peer dependencies using `npm install --save-dev tslint typescript`.
Review the linting errors reported in the console and fix the code, or set `emitError: false` in `tslint.report()` to allow the Gulp task to complete despite linting failures.
Run `npm install --save-dev tslint` to install the required peer dependency.
Create a `tslint.json` file in your project root, or specify the `configuration` option with a path to your config file or an inline configuration object in the `gulp-tslint` options.
Ensure you are using `import tslint from 'gulp-tslint';` and then calling `tslint.report()` as a method of the imported `tslint` object.