Registry / testing / gulp-tslint

gulp-tslint

JSON →
library8.1.4jsnpmunverified

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-tslint
INSTALL
IMPORT
SIG · GULP-TSLINT
G
gulp-tslint
testingjavascriptv8.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tslint
import tslint from 'gulp-tslint';
import { tslint } from 'gulp-tslint';
The primary plugin function is exported as the default export.
tslint.report
import tslint from 'gulp-tslint'; // ... pipe(tslint.report())
import { report } from 'gulp-tslint';
The `report` function is a property of the default `tslint` export, not a separate named export.
tslint (CommonJS)
const tslint = require('gulp-tslint');
Standard CommonJS import for Node.js environments. Follows the same access pattern for `tslint.report`.

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.

import gulp from 'gulp'; import tslint from 'gulp-tslint'; import * as path from 'path'; // IMPORTANT: Ensure you have a 'tslint.json' file in your project root // or provide configuration via the `tslint()` options. // Example 'tslint.json' for basic rules: // { // "rules": { // "no-console": true, // "class-name": true, // "curly": true // } // } gulp.task('lint-ts', () => gulp.src(path.join(__dirname, 'src/**/*.ts')) // Adjust this path to your TypeScript source files .pipe(tslint({ // Optionally, specify configuration directly or a path to a custom config file: // configuration: { // rules: { // "no-console": true // } // }, // configuration: 'config/my-tslint-rules.json', formatter: 'stylish' // 'stylish' offers a readable output; other options exist (e.g., 'verbose') })) .pipe(tslint.report({ emitError: true, // Set to 'false' to prevent Gulp from halting on lint failures summarizeFailureOutput: true // Provides a concise summary in the console on failure })) ); gulp.task('default', gulp.series('lint-ts'));
Debug
Known issues
deprecatedTSLint, the underlying linter for `gulp-tslint`, has been officially deprecated by its maintainers in favor of ESLint. This means `gulp-tslint` will not receive updates for new TypeScript features or linting rules, and its long-term viability is severely limited.
fix
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.
affects: >=1.0.0
breakingAs of `gulp-tslint` v6.0.0, the `reporter` option in `.report()` calls has been removed. All formatting and reporting should now be handled via the `formatter` option directly within the `tslint()` call.
fix
Remove any `reporter` options from `tslint.report()` and instead specify the desired `formatter` (e.g., 'verbose', 'stylish') within the `tslint()` options object.
affects: >=6.0.0
gotchaA `tslint.json` configuration file is mandatory. If not found in a parent directory of the input file, or explicitly provided via the `configuration` option, `gulp-tslint` will likely fail to lint or apply desired rules.
fix
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.
affects: >=1.0.0
gotchaBy default, `gulp-tslint` will emit a `PluginError` and halt the Gulp task if any linting failures are found.
fix
To prevent Gulp from stopping on lint errors, set the `emitError` option to `false` in the `tslint.report()` call: `.pipe(tslint.report({ emitError: false }))`.
affects: >=1.0.0
gotcha`tslint` (>=5.0.0-dev) and `typescript` (>=2) are peer dependencies and must be installed separately in your project alongside `gulp-tslint`. Failure to install them will result in runtime errors.
fix
Install the required peer dependencies using `npm install --save-dev tslint typescript`.
affects: >=1.0.0
Errors
Common errors & fixes
Error in plugin 'gulp-tslint': Failed to lint: <filename>
TSLint found one or more errors in the specified file, and the `emitError` option in `tslint.report()` is either `true` or unset (default `true`), causing Gulp to halt.
fix
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.
Error: Cannot find module 'tslint'
The `tslint` peer dependency has not been installed in your project.
fix
Run `npm install --save-dev tslint` to install the required peer dependency.
Error: ENOENT: no such file or directory, open '<path>/tslint.json'
`gulp-tslint` could not find a `tslint.json` configuration file in the project or ancestor directories, and no explicit `configuration` option was provided.
fix
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.
TypeError: tslint.report is not a function
You are likely trying to import `report` as a named export (e.g., `import { report } from 'gulp-tslint';`) instead of accessing it as a property of the default export.
fix
Ensure you are using `import tslint from 'gulp-tslint';` and then calling `tslint.report()` as a method of the imported `tslint` object.
Upgrade
Version history
8.1.4latest on npm
Audit
Dependencies
tslintrequiredRequired for linting TypeScript files; gulp-tslint is a wrapper that utilizes tslint's core functionality.
typescriptrequiredTSLint requires a compatible version of TypeScript to parse files.
Agent activity
12 hits · last 30 days
node
8
Amazon
1
Resources